Intruder Security Alarm using Vibration Sensor
Introduction
In today’s tutorial, I will show you how to make an Intruder security alarm using a vibration sensor and Attiny85. You can implement this system in your vehicles so as any intruder or someone tries to sit on your bike, it will create some vibration and the alarm will start buzzing with flashing led.
Working of Intruder security Alarm
In this project, we will connect the vibration sensor to the Digispark Attiny85. When there is no vibration, the output of the vibration sensor is 0 (low voltage), Else the output is 1 (High Voltage). If Attiny85 gets 1 output from the vibration sensor, it will turn on Buzzer and LED.
Components Required
So let’s get started making Intruder security Alarm using a vibration sensor. To make this system more compact, I am using Digispark Attiny85. Following are the lists of all the components that are required for building this project.
S.N | Components Name | Description | Quantity | |
---|---|---|---|---|
1 | DigiSpark Attiny85 Board | DigiSpark Attiny85 Arduino Compatible Board | 1 | https://amzn.to/32km6UD |
2 | Vibration Sensor | Vibration Sensor | 1 | https://amzn.to/3v2Addj |
3 | Buzzer | Small 2 pin Buzzer | 1 | https://amzn.to/2OKdkvv |
4 | LED | 5 Mm RED LED | 1 | https://amzn.to/3cwvtoG |
5 | Jumper Wires | Jumper Cables breadboard friendly | 5 | https://amzn.to/2JWSR44 |
6 | Breadboard | Mini Breadboard | 1 | https://amzn.to/2NP2UKL |
Interface Vibration Sensor, Buzzer, & LED with Attiny85
Now. let’s learn to interface Vibration sensors, Buzzer, & LED with Digispark Attiny85.
I assemble the circuit in a breadboard, but you can order a custom PCB from pcbway.com. It is one of the most trusted PCB and PCB assembly manufacturers. They produce high-quality PCBs at a reasonable price, only $5 for 10 PCBs and $30 for 20 PCB assembly. Besides, new members also receive a $5 bonus.
The circuit connection is fairly simple. Connect the Ground pin of the Vibration sensor, buzzer, and LED to the GND pin of Attiny85. Now, connect the VCC pin of the vibration sensor to the 5Volt pin. Similarly, D0 (signal) pin to P2 pin of Attiny85. Lastly, connect the buzzer positive pin to P3 and the LED positive pin to the P1 pin of Digispark Attiny85. You can follow the schematics and table below to assemble the circuit.
Vibration Sensor | Attiny85 |
VCC | 5V |
GND | GND |
D0 | P2 |
Buzzer | Attiny85 |
Positive | P3 |
GND | GND |
LED | Attiny85 |
Positive | P1 |
Negative | GND |
Similar Projects:
- IoT based Silent Intruder Alarm using Arduino
- Fire Security System using Arduino & Flame Sensor
- ESP8266 based IoT Health Care Panic Alarm for Elderly Folks
- Password Security Lock System Using Arduino & Keypad
Program code
I will explain each and every step of the program code so that it will help you to understand and modify it according to your requirements. First, we defined the variable “Buzz” for the buzzer, “vs” for vibration sensor, and “LED” for Red LED with their interfaced pin with Attiny85.
int Buzz = 3; //Buzzer int LED = 1; //LED int vs =2; // vibration sensor int i=0;
In a void setup, we have defined the pinMode function for all the components
void setup(){ pinMode(Buzz, OUTPUT); pinMode(LED, OUTPUT); pinMode(vs, INPUT); }
Here, in a loop, the program reads the data from the vibration sensor, if there a vibration the result is High. In this condition, Buzzer and LED are turned ON.
void loop(){ int vib = digitalRead(vs); if(vib == HIGH) { for(i=0;i<10;i++) { digitalWrite(Buzz, HIGH); digitalWrite(LED, HIGH); delay(500); digitalWrite(Buzz, LOW); digitalWrite(LED, LOW); delay(100); } }
Else the buzzer and LED remains in an OFF state
else{ digitalWrite(Buzz, LOW); digitalWrite(LED, LOW); } }
Intruder Security Alarm Final Program code
This is the final program code for Intruder security Alarm using vibration sensor and Attiny85 board. Copy this code and paste it in your Arduino IDE.
//The IoT Projects: https://theiotprojects.com //Attiny85 Intruder Security Alarm using Viabration Sensor // Using Digispark ATTINY85 int Buzz = 3; //Buzzer int LED = 1; //LED int vs =2; // vibration sensor int i=0; void setup(){ pinMode(Buzz, OUTPUT); pinMode(LED, OUTPUT); pinMode(vs, INPUT); } void loop(){ int vib = digitalRead(vs); if(vib == HIGH) { for(i=0;i<10;i++) { digitalWrite(Buzz, HIGH); digitalWrite(LED, HIGH); delay(500); digitalWrite(Buzz, LOW); digitalWrite(LED, LOW); delay(100); } } else{ digitalWrite(Buzz, LOW); digitalWrite(LED, LOW); } }
Uploading code & testing project:
Before uploading the code, make sure you have set up your Arduino IDE for the Digispark Attiny85 board.
Now copy the program code provided for the Intruder security Alarm using vibration sensor from above. Select “Digispark (Default-16.5Mhz)” Board from Tools Menu. Also, select programmer as “Micronucleus” and choose its COM port.
Finally, press the upload button after compiling the code, connect your Digispark Attiny85 board within 60 seconds. Wait for “Micronucleus done. Thank you!” Message for the successful upload of the program.
Now it’s time to test the Intruder security Alarm using vibration sensor project. Gently shake the vibration sensor and you will start getting feedback from the buzzer and LED.
Conclusion
So, that’s all for this Intruder security Alarm using vibration sensor project using Attiny85. This is a very useful project and has a wide range of applications in the security field. If you like this tutorial, then share this project with your friends. Need help? Comment down below.