Introduction: Home Security System

Picture of Home Security System

We will be using Robot Invented's HomeSystem Arduino Library.

For this project, we'll program our Arduino with RobotInvented's homeSecurity & homeLight modules.

Step 1: Tools

You would need these tools to continue building the security system. Go ahead and get them ready:

Multimeter($24.99) - Radioshack 22-182 15-Range Digital Multimeter
OR Multimeter($2.93) - Generic DT-830D 3 1/2 Digital Multimeter

Multimeter Tutorial:

Breadboard($5.00) - Adafruit 64 Half-size Breadboard
OR Breadboard($0.96) - Generic 8.5CM x 5.5CM 400 Hole Half-Sized Breadboard

Breadboard Tutorial:

Step 2: Software

Picture of Software

The arduino IDE will be used here. If you haven't already installed it, you can download it at

Arduino IDE Tutorial:

Firstly, download RobotsInvented's HomeSystem library from github. Go over to, click on Clone or download then click Download Zip.
You should get a zipped file named Now, locate the zip file and unzip it into Arduino's library folder (default location C:/Program Files/Arduino/libraries or C:/Program Files (x86)/Arduino/libraries).
The directory should look like Figure 1 (HomeSystem folder in Arduino libraries directory).

Next, open up Arduino from your start menu. (Figure 2)
You will get a new sketch like in Figure 3.

To include the library in our code, Go to Sketch menu->Include Library->HomeSystem (Figure 4).
This will add the following line to the top of the sketch (Figure 5):

#include <HomeSystem.h>

Next, we declare the HomeSystem library with the following line (Figure 6):

HomeSystem homeSystem("HomeSystem","Hello World!");

You can replace "Hello World!" with anything you like. Eg:

HomeSystem homeSystem("HomeSystem","I am awesome!");

This text will be displayed on the LCD.

Compile the sketch by clicking Verify (Figure 7). Your IDE will display the "Compiling sketch.." message.

If you see the Done Compiling message (Figure 8), your code is free of syntax errors and the IDE is working as it should be.

Let's learn how to connect the Electronics to our Arduino in the following steps.

Step 3: Verify Supplied Power

Picture of Verify Supplied Power

First up, every electronic project is powered with either AC or DC(Alternate Current or Direct Current).

We get AC from our wall outlets (typically 110-220V). (This current will harm anyone who touches it directly so always avoid direct contact. Take proper precautions while dealing with High Voltage Alternate Current.)

DC current is normally used for everyday electronic circuit applications.

In our case, the Arduino needs to be supplied with low voltage DC(5-12V), so how do we safely obtain this small voltage DC?

We have a few options:
1) A wall AC adapter can convert 110V(or 220V) from our walls to DC(12V low voltage), which can safely power our Arduino.
2) A laptop would be able to safely supply 5V DC through USB, thus it is ideal to power our Arduino with the USB jack (Figure 1).
3) A standard 9V battery (Figure 2) can be used to power the Arduino in order to free it from a wall or laptop. This battery will be attached to Arduino's Power Jack as seen in Figure 3. If a power outage occurs, we can still rely on the home security system to function.

We want to wirelessly mount our home security system to a wall at the end of these instructions, so option #3 will be our preferred choice of power supply

Do note that throughout this instructable, we will be powering the Arduino using Option#2 (Figure 1). This allows us to simultaneously program the Arduino, so go ahead and start by connecting the USB cable to the Arduino.

At this point, the ON Led on the Arduino should be lit (Figure 1).

Now that we have established power through USB, lets test the output voltages.

Take your multimeter and place the positive(red) probe onto the 5V terminal. Place the negative on Ground(black). Your multimeter measurement should read approximately 5V (Figure 4).

If it displays anywhere from 4.9-5.1V, we are good to go! We now know that our Arduino is safe to connect to external hardware.

To check your battery, disconnect the USB cable, then measure 5V while the battery is plugged in (Figures 3 & 4; you should see ~4.9-5.1V too with the battery). Remove the battery jack and reconnect the USB after measuring.

Next up, we give life to the homeSecurity system with an LCD Display!

Power Supply Tutorial:

Step 4: Connect the LCD

Picture of Connect the LCD

First, we attach the female to male connector(12 terminals) to the LCD panel as shown in Figure 1.

In your Arduino sketch, add the following line to setup:


Your code should look like Figure 2.

This initialization configures all pins related to the security system.
Next, we connect the LCD to the Arduino according to the schematic in Figure 3.

Go ahead and verify the code. If it compiles correctly (Figure 4), we can begin our first upload to the Arduino.

In the Arduino IDE, navigate to Tools->Port and select your Arduino's COM port (Figure 5).
Under Tools->Board select Arduino Uno (Figure 6).

Click upload, and you should see a "Done uploading" message displayed if the upload was successful (Figure 7).

If you see text displayed on the screen, you have successfully connected the lcd!

In the next step, we look at adding a keypad which will act as an input to our security system.

LCD Tutorial:

Step 5: ​Keypad As a User Input

Picture of ​Keypad As a User Input

Hook up the 8 terminal connector to the keypad (Figures 2 & 3).

Connect the keypad to the 8 input pins on the Arduino as shown in Figures 4, 5 & 6.

In the Arduino sketch, add the following lines to loop:


Your code should look like Figure 7.

Upload the sketch.
After uploading, you should be able to interact with the system by arming the alarm.[Enter the default arming code: *1234#]

If you successfully armed the system, it should display "Alarm armed" on the LCD.

If you entered a wrong pin code, the message "Invalid pin" is displayed on the LCD.

It is great that your security panel is able to function at this point, but how do we control a lock which activates when the system is armed? Continue on to the next step to find out.

Keypad Tutorial: Arduin...

Step 6: Secure Your Home With a Lock

Picture of Secure Your Home With a Lock

Solenoid locks activate when a voltage is applied to it. We will be using a mosfet to turn on and off the solenoid, which in turn locks & unlocks the door (Figure 2).

Attach the lock connectors as shown in figure 3.

Add the following code to loop:

if(homeSystem.homeSecurity.getIsArmed() == true)

Your code should look like Figure 4.

Upload the code.

Go ahead and arm the system. See what happens when you arm & disarm the alarm.

Next up, attaching a piezo to the security system.

Solenoid Tutorial:

Step 7: ​Adding a Buzzer

Picture of ​Adding a Buzzer

The Buzzer will be Output#2

A buzzer(piezo) is useful for giving feedback to the user. We will be installing a piezo buzzer to act as an alarm to the homeSecurity system as well as to provide feedback sounds when a user interacts with it.

Connect the buzzer as shown in Figure 2.

Upload the code.

Try entering a wrong code into the security panel. The system will trigger and a loud alarm is heard. To stop the alarm, enter a valid pin code.

Now that our homeSecurity module is complete, we will continue to build the homeLight module in the next steps.

Buzzer Tutorial:

Step 8: Connecting Your Relay Switch

Picture of Connecting Your Relay Switch

It's cool when you get to automatically control your home appliances. RobotsInvented's homeLight Library allows you to turn on and off lights in your house!

Let's begin setting up the homeLight module.

You can test the relay's NC(Normally Closed), NO(Normally Open) terminals by checking for a short and open using a multimeter (Figure 3).

The logic of the module is as follows


HIGH No Connection Connected

LOW Connected No Connection

In our case, we would want to turn on the relay whenever we want to switch the light on, therefore we need to ensure that when the relay receives 5 Volts IN (HIGH), we get a connected path which completes the light's circuit. This configuration can be achieved by wiring the light to the NO & COM terminals.

To hook up the homeLight module, refer to Figure 4.

Add the following line of code to the sketch:

Your code should now look like Figure 5.

To control when the light is activated, we will add the PIR sensor to our system in the next step.

Relay Switch Tutorial:

Step 9: PIR Sensor Calibration

Picture of PIR Sensor Calibration

This sensor triggers at the presence of infrared emitting objects (human beings included). Adjusting the 2 potentiometers on the PIC sensor will calibrate the detection range and time delay of our input.

Connect the PIR sensor to the arduino according to Figure 3.

Add the following code to your sketch:

Your code should now look like Figure 4.

Upload the code.

You should now be able to switch on and off the light by walking under the PIR sensor after the alarm is disarmed (Figure 5).

How about using your phone to control the electronics that we have built? Easy, we add a bluetooth module that can be controlled by an Android phone in the next step.

PIR Sensor Tutorial:

Step 10: ​HomeRemote Add On


About This Instructable




Bio: Innovator, Entrepreneur.
More by jeevan900929:
Add instructable to: