The article will cover the tilt sensor basics and understand its interfacing with Raspberry Pi.
Tilt sensors allow you to detect orientation or tilt. In this tutorial, you will learn about the tilt sensor and understand the interfacing of the tilt sensor with Raspberry Pi.
Before proceeding to learn the tilt sensor with Raspberry Pi, we understand the tilt sensor and the working principle of its operation.
Working Principle of Tilt Sensor
The working principle of tilt sensors is very simple. The tilt sensor produces electrical signals that vary with changes in angular moment. These sensors have a rolling ball, this rolling ball is wrapped in conductive material.
Now you might be thinking, Hey but what I have got is in cylindrical shape !! Mate, you’re right! What you have got is cylindrical in shape, but it is the outer part of the sensor. The outer part of the tilt sensor is made of cylindrical shape and the inner part consists of cavities and rolling balls.
When the sensor is on, and in the horizontal direction, the rolling ball falls downward and an electrical connection occurs. And when the sensor is tilted the rolling ball does not go down and there is no electrical connection.
The Following image will clear your doubt.
Interfacing The Tilt sensor With Raspberry Pi
By now, I believe you have an idea of what a tilt sensor is and how it works. The tilt sensor is just a switch with some modifications.
By reading the above line? You might be thinking that if this is the switch, we can connect this tilt sensor to the Raspberry Pi in the same way that we connect the switch to the Raspberry Pi.
Yes, you are right As I told you earlier, the tilt switch is just a switch and we can interface it with Raspberry Pi in the same way that we interface a switch with Raspberry Pi.
I connected my tilt sensor to Raspberry Pi in the following way. I connected the signal pin of the tilt sensor to the 27 pin number of the Raspberry Pi and the Vcc pin of the Tilt sensor to the 5v of the Raspberry, while the gnd pin of the Raspberry Pi to the Gnd pin of the tilt sensor.
Conclusion Of Raspberry Pi Interfacing With The Raspberry Pi
So, this is how you learned the tilt sensor with Raspberry Pi. If you have any suggestions or doubts, please let me know in the comments section.