ARDUINO Burglar Alarm Using Infrared Emitter-Detector Pair

48,339

36

23

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

http://learnthroughexample.blogspot.in/search/label/arduino

Step 1: REQUIREMENT :

  1. Arduino uno R3
  2. Breadboard
  3. Connecting wires / Jumper cables
  4. Infrared Emitter and Detector pair LED(not the sensor module)
  5. PCB mount BUZZER
  6. 1kohm Resistor
  7. 10kohm PotentiometeR

** the white LED is the Infrared emitter ,While the black is the Infrared Detector .

Step 2: CIRCUIT DIAGRAM :

Step 3: SOURCE CODE:

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);
  }

Step 4: DISCUSSIONS :

First build the circuit according to the circuit diagram provided .

Now i will explain to you how the circuit works .

  • The white Led you see in the pictures is an Infrared Emitter . You power it on like a normal LED .
  • Now if this is your first time with an IR Led , its very common that you'll mistake your LED to be spoiled as you wont find it glowing ,but that isn't the case really .
  • Infrared light is out of the visible spectrum range so even if it is glowing , you wont be able to see it with naked eyes.
  • To see if your emitter LED(White) is working properly : switch on your cell phone camera and see the LED through it , you will see that there is a purple Glow .
  • This ensures that your IR emitter (White ) is working perfectly and it is emitting light of a particular range of frequency . Now lets come to the Black LED .
  • The back LED is the IR detector. The reason that it is made black is that Black color has the highest absorption ; so it Absorbs most of the infrared light Emitted by the Emitter .
  • Now what happens if an object stands in between the Emitter and the detector ?? . OBVIOUSLY the amount of infrared radiations intercepted by the detector will now be lesser due to the obstruction .This is the catch !! .
  • When such a situation occurs , I trigger the alarm to denote Intrusion .

Now that you've got your concept right , LETS FOCUS ON THE CODE .

  • In line 10 we begin the serial communication to see the values being intercepted on the serial monitor for both the cases i.e
  • case 1.) no obstruction in the path of the emitter and the detector .
  • case 2.)obstruction in the path of the emitter and the detector .
  • for both these cases , we have to observe the values being reflected on the serial monitor , based on which we will decide for which value being exceeded we will be triggering the alarm .
  • Note that for my experiment the threshold value was set to 1005 . This might not be the case for you. Hence try to monitor the values that you are intercepting and choose your threshold accordingly .

**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 .

Step 5: PROJECT VIDEO :

Thank you all for watching .

Share

    Recommendations

    • First Time Author

      First Time Author
    • Big and Small Contest

      Big and Small Contest
    • Toys Contest

      Toys Contest

    23 Discussions

    0
    None
    MohaleM

    1 year ago

    How did you measure your threshold value??

    0
    None
    JonW27

    1 year ago

    Thank you so much for the time you spent putting this instructable together! My son and I put it together earlier today. We had a few minor issues, all our own (resistors in the wrong location and had to tweak the presence value for a shorter distance (we didn't use the pot). After a few min, it was all working just fine! Thank you again!!

    0
    None
    DavidD637

    1 year ago

    my buzzer continuously sounds

    0
    None
    DavidD637

    1 year ago

    my IR LEDs aren't working. can u help me?

    0
    None
    siddharthm22

    2 years ago

    Can you please tell me how to learn programming arduino

    0
    None
    SarvangDAaryas2

    Reply 2 years ago

    Potentiometer doesnot play a much important role. test it.

    0
    None
    ShrobonBAaryas2

    Reply 2 years ago

    Hi Aaryas , i haven't actually made use of the potentiometer . I have listed it as a requirement since you might have a different pair of IR-LED which work at a specific voltage level , so the Potentiometer can prove to be handy in adjusting the voltage to your IR LED .

    Hope this helps.

    0
    None
    Aaryas2ShrobonB

    Reply 2 years ago

    0k....but if i wanna include potentiometer then where should i connect it in the circuit????

    0
    None
    akshat_soni

    2 years ago

    bro can i use more than one pair of emitter detector...i want to make track of near abt 6 pair of ir...
    my project topic is "vehicle movemnt based smart street light with external light sensing"
    plz help me to get the code respect to this project...

    thnx in advance

    0
    None
    momoy1

    2 years ago

    I get the error "'buzz' was not declared in this scope" when I try run the code on Arduino.

    Any help?

    1 reply
    0
    None
    ShrobonBmomoy1

    Reply 2 years ago

    Can i get the screenshot of the code along with the error ? . It would be easier for me to debug that way . I guess you have either not written the code for the buzz method or perhaps you have named it something else by mistake .

    Just add a screenshot and il help you out .

    0
    None
    EswaranK

    2 years ago

    Thank you man! You helped me a lot. But I have a doubt. Why is that the amount sent by the emitter is more when there is an obstacle. For example, my emitter sends 1020 when there is an obstacle and sends 1019 when there is not obstacle?

    1 reply
    0
    None
    ShrobonBEswaranK

    Reply 2 years ago

    Please check if you provided Vcc to the correct leg of the IR sensor . This should solve it .

    Are you using these type of IR led Pairs or some other mounted sensor ? .

    Do attach a picture of the IR pair , if the problem persists .

    0
    None
    AshkanG

    3 years ago on Introduction

    Hi

    Thanks for sharing.

    One question :) Can I use a similar approach with one pair of IR emitter and detector, to measure near distances after calibration? I wanna move an object with 2 stepper motors in a closed box, and constantly know the its distance to 2 reference walls.

    1 reply
    0
    None
    ShrobonBAshkanG

    Reply 2 years ago

    Yep , this is very much possible with this . But i would suggest using a better precision sensor for higher accuracy . For rough distance calculation this same sketch with minor calibrations should work perfect .

    0
    None
    warnalope

    3 years ago

    This may be a silly question but what role does the potentiometer play in this circuit?

    0
    None
    ShrobonB

    3 years ago on Introduction

    if you find the buzzer ringing all the time , then check the serial monitor on the arduino IDE to see the values that are being sent .

    Try calibrating the value in the program to make appropriate changes , because it depends on the type of IR-LED you used for the project .

    Also do check , the way you have connected the IR-LED's on the breadboard i.e make sure you put in the positive and negative legs appropriately .

    0
    None
    taylor h

    4 years ago on Introduction

    Hi friend. How do I monitor the values my IR sensor is detecting

    0
    None
    bishalg

    4 years ago on Introduction

    why does my buzzer sounds all the time ? whats wrong?