KY-017 Mercury Tilt Switch Module – Digital Tilt & Orientation Sensor for Arduino & ESP32
The KY-017 Mercury Tilt Switch Module is a compact sensor designed to detect changes in tilt, inclination, and orientation using a mercury-based mechanical switch.
The module contains a small sealed glass capsule with a conductive mercury droplet. When the sensor is tilted, the mercury moves inside the capsule, opening or closing the electrical contacts and changing the digital output.
The KY-017 is suitable for Arduino, ESP32, Raspberry Pi, robotics, orientation detection, and educational electronics projects.
Key Features
-
Model: KY-017
-
Sensor Type: Mercury Tilt Switch
-
Detection Method: Mechanical Tilt and Orientation
-
Output Type: Digital (HIGH/LOW)
-
Operating Voltage: Typically 3.3V–5V DC
-
Switch Technology: Sealed Mercury Contact
-
3-Pin Interface: Signal (S), VCC (+), GND (-)
- Simple ON/OFF Tilt Detection
- Compact PCB Design
- Compatible with Arduino and Microcontroller Projects
Technical Specifications
| Parameter |
Specification |
| Model |
KY-017 |
| Product Type |
Mercury Tilt Switch Sensor Module |
| Sensor Technology |
Mercury Contact Switch |
| Detection Type |
Tilt / Orientation |
| Operating Voltage |
Typically 3.3V–5V DC |
| Output Type |
Digital |
| Output States |
HIGH / LOW |
| Number of Pins |
3 |
| Pin Configuration |
S / + / - |
| Switch Contact Type |
Mechanical ON/OFF |
| Measurement Type |
Binary Tilt Detection |
| Board Dimensions |
Approximately 18.5 × 15mm |
| Interface |
Digital GPIO |
Pin Configuration
| Pin |
Function |
| S |
Digital Signal Output |
| + |
Power Supply |
| - |
Ground |
Arduino Connection Example
| KY-017 |
Arduino Uno |
| S |
D3 |
| + |
5V |
| - |
GND |
The Arduino monitors the module's digital output to detect a change in the tilt switch position.
Arduino Example Code
const int tiltPin = 3;
void setup() {
pinMode(tiltPin, INPUT);
Serial.begin(9600);
}
void loop() {
int tiltState = digitalRead(tiltPin);
if (tiltState == HIGH) {
Serial.println("Switch HIGH");
} else {
Serial.println("Switch LOW");
}
delay(100);
}
The HIGH and LOW states depend on the sensor's orientation and the module's internal circuit.
Applications
- Tilt and Orientation Detection
- Arduino and ESP32 Projects
- Raspberry Pi GPIO Input
- Robotics and Automation
- Equipment Position Monitoring
- Inclination-Activated Alarms
- Educational Electronics
- DIY Motion-Activated Switching
- Simple Position Detection Systems
Important Notes
-
The KY-017 provides binary tilt detection and does not measure the exact tilt angle.
- It is not an accelerometer or gyroscope.
-
The sensor contains mercury, a hazardous substance, inside a sealed glass capsule.
- Do not break, open, crush, or heat the glass capsule.
- If the capsule breaks, avoid contact with the mercury, isolate the area, and follow appropriate hazardous-material cleanup procedures. Do not use a household vacuum cleaner.
- Dispose of damaged or unwanted modules through an approved hazardous or electronic waste collection service.
- Software debouncing may be necessary to prevent false triggers during movement.
- The switch activation angle depends on the capsule's physical orientation.
- For ESP32 and Raspberry Pi, use 3.3V-compatible signal levels.
- Verify the pin configuration and operating voltage of the supplied module before wiring.
Package Includes
1 × KY-017 Mercury Tilt Switch Module