The tilt-switch or tilt sensor as called is a component that is used to detect orientation or inclination, they are usually made by a cavity of some shape (cylindrical is popular, although not always) and a conductive free mass inside, such as a blob of mercury or rolling ball. One end of the cavity has two conductive elements (poles). When the sensor is oriented so that that end is downwards, the mass rolls onto the poles and shorts them, acting as a switch throw. So Sometimes it is referred to as "mercury switches", "tilt switches" or "rolling ball sensors".


- 1 Uno board
- 1 USB data cable
- 1 Tilt-switch
- Several jumper wires

Experimental Principle

The principle is very simple. The switch mainly uses the ball inside it to activate an electronic circuit when the sensor reaches a specific position. When the ball in tilt switch runs from one end to the other end because of external force shaking, the tilt switch will connect or disconnect based on the ball’s position.

Experimental Procedures

Step 1: Connect circuit as shown in Fig1. The corresponding schematic diagram is shown in Fig2. (Schematic is generated by EAGLE)
Step 2Program the Arduino (download program from documents).
Step 3: Compile the program.
Step 4: Burn the program into Uno board.

circuit connection

Fig1: the connection of the tilt sensor

eagle schematic

Fig2: the schematic (the external LED is used to indicate the LED on the real board on Pin13, since it is not shown in the Uno’s symbol)

Now, if you incline the switch, the LED attached to pin 13 on Uno board will light up.

Experimental summary

This simple and exciting experiment is another control circuit, it allows you to build a triggering system based on mechanical condition (which is the slop of the switch in our case), a wild range of applications can be done based on this experiment. 


1-Arduino progrme (code)
2-Eagle file