Anti-Theft Infrared Sensor With Arduino
by vox911 in Circuits > Arduino
833 Views, 1 Favorites, 0 Comments
Anti-Theft Infrared Sensor With Arduino
Hello,
Here's a circuit for PIR sensor.
I have created an Alarm sound that beeps 6 times when a motion is detected.
Connect the Circuit as shown in the Image.
PIR sensor reads the Input signal.
Buzzer writes the output signal. (Buzzing noise)
Video Link provided here :
https://www.youtube.com/watch?v=L_-hoWJNAoQ&t=72s
Supplies
- Arduino UNO
- Jumper wires
- Bread board
- PIR sensor
- Electronic Buzzer.
- Power supply. +5V
Programming for Arduino
Here's the block of code :
int inSignal = 2; //input signal
int outSignal = 3; //output signal
void setup() {
Serial.begin(9600);
pinMode(inSignal, INPUT); //PIR is connected
pinMode(outSignal, OUTPUT); //Buzzer is connected
}
void loop() {
// read the input pin: int buttonState = digitalRead(inSignal);
// print out the state of the button:
if(buttonState==HIGH)
{
for(int i = 0; i<6; i++){//looping on/off sound 6 times
digitalWrite(outSignal, HIGH);
delay(300);
digitalWrite(outSignal, LOW);
delay(300);
Serial.println("Motion Detected!");
}
}
else{
Serial.println("No Motion Detected");
digitalWrite(outSignal, LOW);
}
}