Get help on your project, we are training digital electronics and Arduino (free)

Click here to register
NovaTech Engineerics
Mercury Tilt Switch Module
Availability: In Stock
Condition: New
8 in stock
Will be calculated after you select all properties
Buy Now

This module consists of a mercury switch, a 680Ω resistor and a LED that will light up when tilt is detected. The mercury ball will open/close the circuit when the module is rotated.

Operating Voltage3.3V to 5.5V

KY-017 Connection Diagram

Connect the Power line (middle) and ground (-) to +5 and GND respectively. Connect signal (S) to pin 3 on the Arduino.

SPin 3
KY-017 Arduino connection diagramclick to enlarge

KY-017 Example code

The following sketch will light up the led on pin 13 of the Arduino when the module is tilted.

int led_pin = 13; // Define the LED interface
int switch_pin = 3; // Definition of mercury tilt switch sensor interface
int val; // Defines a numeric variable

void setup()
	pinMode(led_pin, OUTPUT);
	pinMode(switch_pin, INPUT);

void loop()
	val = digitalRead(switch_pin); // check mercury switch state
	if(val == HIGH)
		digitalWrite(led_pin, HIGH);
		digitalWrite(led_pin, LOW);

Technical Details:

Seller SKU: 66
Minimum order quantity: 1
Date first listed on Novatech: Aug 27, 2020

No reviews