ESP32 KY-017 Mercury Tilt Switch Module Pinout, Wiring and more

KY-017 Mercury Tilt Switch Module image

KY-017

Protocol: Digital

Overview

The KY-017 is a mercury tilt switch module that detects changes in orientation. When tilted beyond a certain angle, the internal mercury switch closes, sending a digital signal. It's suitable for projects requiring simple tilt or motion detection.

About KY-017 Mercury Tilt Switch Module

The KY-017 Mercury Tilt Switch Module is a sensor that detects tilt or inclination. It contains a mercury switch that closes the circuit when tilted to a certain angle, allowing current to flow. This module operates at a voltage range of 3.3V to 5.5V and provides a digital output signal. It’s commonly used in applications such as tilt detection, motion sensing, and orientation monitoring.

Where to Buy KY-017 Mercury Tilt Switch Module

KY-017 Mercury Tilt Switch Module

Starting from

1$ per unit

Amazon com
Amazon.com Ships worldwide
View Price
Amazon de
Amazon.de Ships to EU
View Price
Aliexpress
AliExpress Best value
View Price

Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.

KY-017 Datasheet and Technical Specifications

Operating Voltage 3.3V - 5.5V
Output Type Digital
Dimensions 31 x 15 x 8 mm
Weight 2 g

KY-017 Pinout Diagram

The VCC pin is used to supply power to the sensor, and it typically requires 3.3V or 5V (refer to the datasheet for specific voltage requirements). The GND pin is the ground connection and must be connected to the ground of your ESP32.

  • Pin (-): Connects to ground (GND).
  • Pin (middle): Connects to VCC (3.3V to 5V).
  • Pin (S): Outputs the digital signal; connect to a digital input on your microcontroller.

KY-017 Wiring with ESP32

  • KY-017 Pin (-): Connect to ESP32 GND.
  • KY-017 Pin (middle): Connect to ESP32 3.3V or 5V.
  • KY-017 Pin (S): Connect to a digital GPIO pin on ESP32 (e.g., GPIO4).

KY-017 Troubleshooting Guide

Common Issues

❌ No Response from Sensor

⚠️ False Triggering

Debugging Tips

🔍 Serial Monitor

⚡ Voltage Checks

KY-017 Code Examples

Arduino Example

C++
🔧

ESP-IDF Example

C++
🏠

ESPHome Example

YAML
🛠️

PlatformIO Example

C++
🐍

MicroPython Example

Python

Conclusion

The ESP32 KY-017 Mercury Tilt Switch Module is a powerful KY-0xx module sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.

For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.

Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.