Arduino Home Security System





Introduction: Arduino Home Security System

This a Home Security System using Arduino Mega 2560, which will trigger alarm when any door is opened or movement detected in the room when the system is activated. Its a nice project for anyone in final year in the university. you can upgrade it even much better. will be here to help. Have fun!!

Step 1: Items Needed

the items needed are shown in the pictures, not forgetting the camera, you can use a dashcam from the ones use in a car. you can also add IP camera to broadcast live videos online.

all this components can be purchased cheap on eBay

> Arduino Mega 2560 is the main brain for the system

> Arduino Uno is for the lights in the house

> keypad for entering pin to activate and de-activate the system

>breadboard for the components and connection

>Servo for the movement of the camera with respect to the sensor or motion detected

>PIR motion sensor for the rooms to detect any movement

> 20X4 LCD display screen for display of the results and indicating the location of the motion detected, alarm status etc

>Magnetic Door rid switch, this is attached to the doors to detect when door is open or closed

> buzzer for the alarm

> Jumper wires for connection

>DS 1305 for interrupt input

>RGB led


> 1KOhm resistorsX4

>4.7KOhm potentiometers X2

>Relay to control camera on and off status and the LED if you using 12V LEDs if not you can choose to ignore the relay and power up the camera with your laptop and any low voltage LED's with 3V-5V can power up with the Arduino..

this devices will be connected using the circuit diagram shown in next stage.

Step 2: Circuit Diagrams of the Connection

With the circuit diagram the circuit creation begins following the pattern arranged on the diagram.

I must say that this isn't for beginners new to Arduino and programming in Arduino but can challenge you to learn more as you create it, am here to help every step of the way to help you build and make it better than mine.

Step 3: Connection of the Devices

First test the LCD screen display with the short code. test the components functionality with code as you build along to solve error problems and avoid a system that dosn't work. a complete system with error can be hard to solve if it was handled step-by-step. most of the problem that will arise are due to either wrong connection, code error or defective component used. be sure to watch out for those alone the way

NB: remember to attach 1KOhm resistor to the positive leads of the PIR sensor to act as pull-up resistor.

Step 4: Build Your House Model

the model depends on how you want it to look like, chose a design and build, that will help to test the device in a real-time situation. i used plywood at first, and later tried it with cardboard paper. Any can be great for the job.

it doesn't matter the compartments you choose to build, if you build 3 bedrooms, you will need 3 PIR sensors and an additional code which is similar to the others but different pin-outs and it will still work great. you can also have a garage or make it more complex.

the roof i used a cardboard and cut out a print of patterns from A4 paper.

Step 5: Assembly Components Into the Model House

The Magnetic door rid's go behind the front door and backdoor, while the PIR sensors go in the rooms, label the rooms as bedroom 1 and bedroom 2 or 3 if you chose to add more.

Now perform a test on the servo's operation, be sure its moving the right direction and angle required. you will have to update the code if your model house isn't the exact shape and size as mine. That's just to change the position in the code.

Step 6: Final Phase

Put all stuffs together and give it one more trial. each door opening should trigger the alarm and the screen displays which door is opened. any motion in the rooms should also trigger the alarm and displayed onscreen the point of movement.

attached is the code!!



Step 7: Code and a Short Video I Made Before Completing This Project

Attached is a short video during the assembling testing and the code. hope this inspires you to do more and better. have fun. am here if you face any challenges...Adios!!



    • Oil Contest

      Oil Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Clocks Contest

      Clocks Contest

    40 Discussions

    How you connect the two arduino's?


    Please how did it look like with the edit code for me? Thank you very much Roman email.

    Please, it was up to 10 seconds to implement the exit time?
    Please send the code to :

    I would not have had to put the camera in the spinane desert and maybe even a GSM module through which would come up with a sms for the number thank you

    I want the servos to stop at the defined angle but they arent stopping kindly help me out asap as i have to submit it tomorrow

    2 more answers

    Hi Raj, sorry for the delay in reply. Depending on the size of your house you will have to update the angle of rotation of the servo in the code to suit your house size and rotation.

    I have made everything but the servo doesnot stop at all it keeps moving can you help me out with that

    2 more answers

    Yes it keeps on rotating without any pause

    I tried doing this but it always says system deactivated whenever I enter the password instead of saying system activated. Reply asap its urgent

    2 more answers

    sorry I've been away for a while working on something.

    normally check if all doors closed tightly cause with little opening, that an open-circuit hence it cant be activated. turn system and check everything is sealed tight then power it back on. hope that helps. cheers!

    I already had the same problem and after try and error I knew the reason, The doors of back and front must be closed .
    If one was opened, system gave you these message

    Please, need your help urgently,
    I bought all the project components,and connect circuit same as your diagram but it doesn’t work ,just screen lighting without text.
    If you can help me answered me and i will contact you by e.mail

    6 replies

    Most problem with display has to do with either the connection of the potentiometer. Try to reconnect again and be mindful of the keypad Row and column to the Arduino pins. Adjust the potentiometer to reduce brightness if need be. Hit me up if it works. Cheers

    Thanks for replying to me, i finally knew the reasons, there’s two missing wires not in the diagram but i found solution from internet.
    My problem now is the rotation of servo motor after arriving to true postion still rotating.
    My question is ther’s any trick in the code or it’s completely correct .
    What is your advice to me.
    All system now working perfect except motor.

    Yh the motor will rotate but since the model u built may not be exactly the same size as mine the servo will not get the exact position right unless u update the code. If you go through the code carefully u will see where that servo code is and the position I set was, 65, 145, 10 etc. This can be changed depending on how you want it but try playing with it and test it till u get the right angle needed. Thnks

    I already changed servo motor with new one, and it works well , the old one was damage, now i have another problem . After connecting motor the lcd had badly effect, do you have solution to me to these problem
    Hope you answered me today.

    need to know the voltage of power supply to project and if you have solution to missbehave of lcd when connecting motor to system