Home Security System

201

6

Posted

Introduction: Home Security System

This Instructable will help you make a basic miniature home security system using Arduino.

The way this system works is: If an object breaks the first laser, the red LED will light up indicating for the object to stop. If the object doesn't stop and breaks the second laser the buzzer (alarm) will go off. However, if after breaking the first laser the button on breadboard 2 (the one with the LDR's) is pressed it will deactivate the alarm so that the object can pass the second laser harmlessly.

Step 1: Materials Needed

    A House/piece of cardboard.

    1 Arduino board.

    2 Light Dependant Resistors.

    2 led lights (Red and Green).

    2 laser diodes

    1 Buzzer

    Step 2: Setting Up Laser Diodes With a Button

    Follow the diagram above to set up your laser diodes (use laser diodes instead of the LED's shown above).

    Use this code to start them up when you push the button and turn them off when you push it again. This can help you turn on and off your security system.

    float ldr1, ldr2;
    int x;

    void setup() {

    // put your setup code here, to run once:

    Serial.begin(9600);

    pinMode(13,OUTPUT);

    pinMode(12,INPUT);

    }

    void loop()

    {

    // put your main code here, to run repeatedly:

    x=digitalRead(12);

    delay(100);

    if(x==1)

    {

    digitalWrite(13,HIGH);

    delay(1000);

    }

    }

    Step 3: Setting Up the LDR's, the LED and the LED

    Follow the diagram above to set up the rest of the system.

    Upload this code on the second arduino (connected to LDR's):

    float x,y,c=1;
    int b; void setup() { // put your setup code here, to run once: pinMode(0,INPUT); pinMode(1,INPUT); pinMode(6,OUTPUT); pinMode(5,INPUT); Serial.begin(9600); }

    void loop() { digitalWrite(7,LOW); digitalWrite(8,LOW); x=analogRead(0); y=analogRead(1);

    if(x>150) {digitalWrite(7,HIGH);

    while(c==1) { digitalWrite(7,HIGH); b=digitalRead(5); y=analogRead(1); if(y>150) { digitalWrite(6,HIGH); } if(b==1) { digitalWrite(7,LOW); digitalWrite(8,HIGH); delay(3000); break; } }

    }

    }

    Step 4: Final Step

    Set up the two breadboard such that the laser diodes are pointing at the LDR sensors then start up the lasers and then plug in the Arduino connected to the laser diode.

    Do this in the correct order to have a fully functioning miniature house security system.

    This system can be set up on a large scale as well using the same logic and code.

    Share

      Recommendations

      • Microcontroller Contest

        Microcontroller Contest
      • Science of Cooking

        Science of Cooking
      • Spotless Contest

        Spotless Contest
      user

      We have a be nice policy.
      Please be positive and constructive.

      Tips

      Questions

      Comments