In this tutorial i will show you , how to make a simple Inexpensive Intrusion Detection(Burglar alarm) using an Arduino Uno board . This project uses the Infrared Emitter-Detector pair to detect intrusion and triggers an alarm as soon as the object crosses the infrared field .
** To see a Similar Project Made with an LDR click here
**To see more simple arduino projects check out my blog
int dtect=8;
int sense=A0;
int buzzpin=9;
void setup()
{
pinMode(dtect,OUTPUT);
pinMode(sense,INPUT);
pinMode(buzzpin,OUTPUT);
digitalWrite(dtect,HIGH);
Serial.begin(9600);
}void loop()
{
int val=analogRead(sense);
Serial.println(val);
if(val>=1005)
{
buzz(50);
}
}void buzz(unsigned char time)
{
analogWrite(buzzpin,170);
delay(time);
analogWrite(buzzpin,0);
delay(time);
}First build the circuit according to the circuit diagram provided .
Now i will explain to you how the circuit works .
Now that you've got your concept right , LETS FOCUS ON THE CODE .
**Well , hope I have covered all the concepts in detail regarding this project . If you face problems or if you need further detailing on any sub-topic , then please do leave me a comment .
Thank you all for watching .