A simple tilt switch detector
A tilt sensor is just a small metal can with two internal contacts and a ball-bearing. As the orientation of the sensor is changes the ball-bearing is either in contact giving an ON reading, or not in contact giving an OFF reading - simple really, and very cheap!
Open and upload the sketch TiltTestV0.ino. Open the serial monitor ( the icon is located at the top-right of the IDE) and check that the message Tilt sensor Reading >> 0 appears.
Now tilt the IO box gently to the right and check that the reading changes to 1.
Note that the print statement in MCU based systems assumes that the serial port is being used.
Now complete the following tasks:
-
Tamper switches are often used to indicate that an object that should be in a fixed position, has been moved.
-
Implement a simple tamper that normally displays a green LED but changes to red when the unit is moved.
-
Make the output a bit more dramatic by flashing the LED strip between WHITE and RED when a tilt signal has been detected.
Tilt sensors are used in a wide variety of devices: tamper switches, pedometers and shock detection are common applications.