Overview
This project is for the Security of any valuable object using this setup we can see whether there is any movement in the room or not if there is any type of life present in the room the buzzer will automatically give a tone.
In this security alarm a sensor is used to track the movement of human beings and a buzzer is used as an alarm to tell that there is anybody present in the room.
Hardware required
- Arduino Uno R3
- Resistor
- Jumper Wires
- PIR Sensor
- Breadboard
- Buzzer
Schematic Diagram
Fig 1. Circuit Diagram
Arduino Code :
int pinBuzzer = 3;
int pinSensorPIR = 2;
int valorSensorPIR = 0;
void setup(){
pinMode(pinBuzzer,OUTPUT);
pinMode(pinSensorPIR,INPUT);
}
void loop() {
valorSensorPIR = digitalRead(pinSensorPIR);
if (valorSensorPIR == 1){
Alarm_on();
} else {
Alarm_off();
}
}
void Alarm_on(){
tone(pinBuzzer,1500);
delay(2000);
Alarm_off();
}
void Alarm_off() {
noTone(pinBuzzer);
}
Precautions
- Connections should be done properly.
- Arduino is case Sensitive so code accordingly.
- Give different and appropriate colors to the wires.
- Use resistors for sensors and LCDs.