Tilt sensors allow you to detect orientation or inclination. It acts like a switch. When the tilt sensor is in horizontal position, it is open. When rotate (tilt), the switch is closed and pass the current.
They are small, inexpensive, low-power and easy-to-use. Their simplicity makes them popular for toys, appliances and many other applications.
Inside the can are a pair of balls that make contact with the pins when the case is upright. Tilt the case over and the balls don't touch, thus not making a connection.
There are numerous uses for these basic sensors, but keep in mind you might need to use some debouncing code. By debounce code we mean to check twice in a short period of time to make sure that the output is not HIGH because of vibration in your project but because of real orientation.
Pin Out
GND | Ground |
SIG | Output (LOW when sensor is horizontal-High when tilted) |
NC | Not connected |
VCC | Up to 5 VDC |
Important Note for Using the Tilt Sensor
There are numerous uses for these basic sensors, but keep in mind you might need to use some debouncing code. By debounce code we mean to check twice in a short period of time to make sure that the output is not HIGH because of vibration in your project but because of real orientation.