Site icon Circuit Ideas for You

Tilt Switch Interfacing Circuit with Arduino Uno

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:

Circuit Working:

Parts List:

ComponentQuantity
Resistors
220Ω 1/4 watt1
Semiconductors
Arduino UNO1
Tilt Sensor Module1
Buzzer 5V1
LED any color1

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:

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.

References:

RS232 Serial Tilt Sensor

Exit mobile version