Intro: Midget Tilt Sensor Module
This little article describes a low cost yet reliable tilt sensor module that will work as a standalone tilt switch but ready to go with most microcontroller circuits. The entire circuit operates off a single 5 volt supply. Probably there is no need to explain where such detector would be useful, literally around the globe where tilt and shift is involved!
Step 1: The Circuit
At the heart of the circuit is an inexpensive roller ball tilt switch type SW-520D, which makes the contacts closed when tilt angle is more than a certain degree. It has two terminals coming out of it. Rest of the circuit is centered around the venerable NE555N timer chip. Apart from the timing functions, the two comparators of the timer chip can be used independently for other applications. Here, the timer chip is configured as a simple bipolar latch switch with its two comparator inputs tied together and biased at ½ VCC through a voltage divider. Since the threshold comparator will trip at 2/3 VCC and the trigger comparator will trip at 1/3 VCC, the bias provided by the resistors are centered within the comparators trip limits.
In idle state, output available from the circuit through the connector (J2) is at a logic-low (L) level. Incase of a valid tilt detection, this output goes to a logic-high (H) level - catering a dc voltage of around 3.6V - and remains in this active condition until cleared by the reset switch (S1). The green light (LED2) is the power indicator, and the red light (LED1) notifies the output status. Output of the circuit can directly be connected to the I/O port of a microcontroller in an existing security system for further processing, or it can be exploited to drive a low-current type (<100mA @5V) electromagnetic relay without employing any additional hardware.
Step 2: Construction
Even less-experienced hobbyists will find the assembly of the circuit on a general purpose printed circuit board a fairly easy affair, since there is no complicated wiring and all components are housed on the board. As usual, mind the polarity of electrolytic capacitor and LEDs, and fit the IC in a suitable good quality socket, although this is not necessary. The tilt switch should be mounted at the top side of the circuit board (see mounting reference in the schematic). The finished circuit may be fitted in any of a variety of small ABS cases. As the circuit has no adjustment points it is immediately ready for real-world applications. That's all!