Tilt sensor is like small switch.
It changes state when we tilt or move it.
Its used for detect direction, movement or vibration.
Here we used Arduino Uno with tilt sensor, buzzer and one LED.
When sensor tilt, Arduino see it.
Then Arduino make buzzer ON and LED ON.
Circuit Coding:
int tiltPin = 2;
int buzzer = 3;
int led = 4;
int tiltState = 0;
void setup() {
pinMode(tiltPin, INPUT);
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
}
void loop() {
tiltState = digitalRead(tiltPin);
if (tiltState == HIGH) {
digitalWrite(buzzer, HIGH);
digitalWrite(led, HIGH);
} else {
digitalWrite(buzzer, LOW);
digitalWrite(led, LOW);
}
}
Coding Explanation:
- Tilt sensor pin connected to digital pin 2.
- Buzzer to pin 3 and LED to pin 4.
- Setup define input output pins.
- Loop read sensor value.
- If sensor state is HIGH then buzzer and LED is ON.
- Else buzzer and LED is OFF.
Circuit Working:

Parts List:
Component | Quantity |
---|---|
Resistors | |
220Ω 1/4 watt | 1 |
Semiconductors | |
Arduino UNO | 1 |
Tilt Sensor Module | 1 |
Buzzer 5V | 1 |
LED any color | 1 |
In the above circuit diagram we have connected Tilt sensor with Arduino UNO.
We have control LED and buzzer by sensor output.
When sensor gets tilt alarm turns ON.
LED and buzzer both are ON.
Normally tilt sensor open or closed depending on position.
When sensor is tilted, it send digital HIGH or LOW to Arduino pin 2.
Arduino check this signal.
If tilt is detected then Arduino send HIGH to pin 3 and pin 4.
This turn ON buzzer and LED.
When it is not tilt then Arduino send LOW.
And Buzzer and LED is OFF.
Formulas with Calculations:
Formula for Tilt Switch Interfacing Circuit is:
Current for LED = V/R
Arduino give 5V.
LED drop approx 2V.
Resistor 220 is ohm used.
So current = (5 – 2) / 220 = 13.6 mA approx.
Safe for LED and Arduino pin.
Buzzer also runs on 5V from Arduino pin.
Current under 20 mA is safe.
Arduino digital pin max is 40 mA so 20 mA recommended.
How to Build:
To build a Tilt Switch Interfacing Circuit with Arduino Uno follow the below steps:
- Gather all the parts as shown in circuit diagram.
- Arduino 5V pin connect to sensor VCC pin.
- Arduino GND pin connect to sensor GND pin.
- Arduino digital pin 2 connect to sensor signal pin.
- Arduino digital pin 3 connect to buzzer positive pin.
- Buzzer negative pin connect to GND.
- Connect Arduino digital pin 4 to LED anode pin through resistor 220 ohm.
- Connect LED cathode to GND.
Conclusion:
Tilt Switch Interfacing Circuit with Arduino Uno is simple project.
It detect tilt motion and gives alarm.
Useful for anti theft alarm, orientation detection, vibration alert.
Circuit is easy to build and it code are simple.
Leave a Reply