Site icon Circuit Ideas for You

Tilt Switch Interfacing Circuit with Arduino Uno

The tilt sensor acts like a small switch and changes its state when we tilt or move it; it also detects direction, movement and vibration.

Here we used Arduino Uno with tilt sensor, buzzer and one LED and when sensor tilt, Arduino see it and then Arduino make buzzer ON and LED ON.

Arduino Code:

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:

Tilt Switch Interfacing Circuit Diagram with Arduino Uno

Parts List:

ComponentsQuantity
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 and also we have control LED and buzzer by sensor output.

When sensor gets tilt alarm turns ON and then LED and buzzer both are ON.

The tilt sensor remains open or closed depending on its position, when the sensor tilts, it sends a digital HIGH or LOW signal to Arduino pin 2.

Arduino checks this signal and when it detects a tilt, it sends a HIGH signal to pins 3 and 4, this action turns ON the 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 supplies 5V, the LED drops approximately 2V and the circuit uses a 220Ω resistor.

So current = (5 – 2) / 220 = 13.6 mA approx.

Safe for LED and Arduino pin, buzzer also runs on 5V from Arduino pin and current under 20 mA is safe.

Therefore, an Arduino digital pin can supply up to 40 mA, but designers recommend limiting the current to 20 mA.

How to Build:

To build a Tilt Switch Interfacing Circuit with Arduino Uno follow the below steps:

Conclusion:

To conclude, Tilt Switch Interfacing Circuit with Arduino Uno is simple project; it detect tilt motion and gives alarm.

Moreover, its useful for anti theft alarm, orientation detection, vibration alert and also circuit is easy to build and it code are simple.

Exit mobile version