DIY Arduino Home Security System using ROHM Sensor Kit Part 1 – Mechanics

DIY Arduino Home Security System using ROHM Sensor Kit Part 1 – Mechanics

arduino home security system

arduino home security system

In this project, we will make a DIY Arduino Home Security System using an Arduino Mega and ROHM’s Sensor Evaluation Kit. The system uses a passive infrared sensor (PIR) sensor to detect any suspicious movement and ROHM’s Temperature Sensor (BD1020HFV) and Barometric Pressure Sensor (BM1383GLV) to detect heat. It will be connected to the internet using Arduino WiFi Shield to communicate with Cayenne API.

When somebody breaks into your place and the motions are detected, the system will trigger a buzzer and send email notifications to you through Cayenne. You will also get notified when the heat that’s higher than the preset temperature is detected. This Home Security Systems can be monitored and controlled 24/7 from the Cayenne website or via the Cayenne App on your smartphone.

A guide to how to setup the sensor shield and connect to Arduino was covered in the previous article. If you haven’t already, please refer back to ROHM Sensor Evaluation Kit Overview.

Hardware

Software

Tools

arduino home security system

Figure 1. Arduino Mega 2650 (left), ROHM Arduino Shield(right), ROHM sensors(top)

arduino home security system

Figure 2. Acrylic casing for Arduino Mega

arduino home security system

Figure 3. Arduino WiFi Shield

arduino home security system

Figure 4. Remote control transmitters and receiver (4 channels)

arduino home security system

Figure 5. Grove Base Shield for Arduino

arduino home security system

Figure 6. Grove PIR Motion Sensor

arduino home security system

Figure 7. Buzzer

arduino home security system

Figure 8. Grove LEDs

arduino home security system

Figure 9. Grove Wrapper/Case and breadboard

arduino home security system

Figure 10. Male-male connectors and Grove Universal 4 pin cables

arduino home security system

Figure 11. 10K Ohm and 100 Ohm Resistors.

arduino home security system

Figure 12. Power supply 12V

 

Install the hardware

Let’s start by assembling the Arduino acrylic casing. Before putting the closure, we need to solder 2 wires (red and black) into Arduino VIN (12V); these wires will be used to power up remote control which requires 12V.

arduino home security system

Figure 13. Assembly of the Arduino casing with two black & red wires soldered.

After assembling the casing, you can place the Mega in it. Use screws to attach the Mega to the acrylic base.

arduino home security system

Figure 14. Mega placed in the casing

 

Prepare acrylic base for Arduino and remote control attachment

Drill holes on acrylic board to attach Arduino Mega and Grove Wrapper/Case. You will have to measure the dimensions of the modules and mark spots on the surface to drill holes. You can see the organization of my board below (Figure 15). You can rearrange the modules on the board to suit your preference. Use double tape to attach breadboard and remote control.

arduino home security system

Figure 15. Acrylic base with Arduino, remote control unit, breadboard and Grove Wrapper/Case attached.

Next, connect the two black and red wires we just soldered from Arduino to the remote control unit. Note: Be careful with the terminal sign (+ and -).

arduino home security system

Figure 16. The two wires (black and red) connected to the remote control unit.

Connect two male-male connector wires to one of the relay channels from the remote control unit. We’ll be using Channel D as shown in Figure 17.

arduino home security system

Figure 17. Two male-male wires connected to the remote control unit.

Add pull-up and pull-down resistors

Now place two resistors (100 Ohm and 10K Ohm) and three male-male wires onto the breadboard (see Figure 18). These resistors will be used as pull-up and pull-down resistors to send a signal from the remote control to Arduino (through Digital pin 41).

When we press remote control transmitter, the relay in remote control’s receiver will be toggled on or off. If the relay is in “ON” position, a 5V from relay will make Arduino pin 41 triggered into HIGH.

Note: The purple cable is for the relay and will be connected to 5V when it is “ON”.  The gray cable will be connected to Arduino pin 41, and the black cable to Arduino GND pin.

arduino home security system

Figure 18. Two resistors and three male-male wires connected on the breadboard.

Attach PIR sensor, buzzer and LEDs

Now, let’s place PIR sensor, Buzzer, Green LED, Blue LED and Red LED into Grove Wrapper/Case that are already screwed into the acrylic base board.

arduino home security system

Figure 19. Assembly of the base board after placing PIR sensor, buzzer, and LEDs.

Attach Arduino WiFi Shield

Let’s place the WiFi Shield on top of Arduino Mega. We have to make sure the pins are aligned correctly.

arduino home security system

Figure 20. WiFi Shield placed on top of Arduino Mega.

Attach ROHM’s Sensor Shield

Next, we need to stack up ROHM’s Sensor Shield on top of the Wifi Shield we just installed. Again, we have to make sure the pins are aligned correctly. Then, we’ll connect the ROHM’s Temperature Sensor (BD1020HFV) to Analog 2 header and ROHM’s Barometric Pressure Sensor (BM138GLV) to I2C header on ROHM’s Sensor Shield (see Figure 21).

arduino home security system

Figure 21. ROHM’s Sensor Shield placed on top of Arduino WiFi Shield.

The Barometric Pressure Sensor (BM138GLV) works with either 1.8V or 3V, and the Temperature sensor with 3V or 5V. So we must set the voltage to 3V by putting the jumper into 3V (see Figure 21).

For more information about ROHM sensors, please refer back to ROHM Sensor Evaluation Kit Overview!

arduino home security system

Figure 22. ROHM Sensor Shield with BD1020HFV and BM138GLV sensors stacked on top of Arduino WiFi Shield.

Add Grove Base Shield

For one last time, we need to stack Grove Base Shield on top of the ROHM Sensor Shield. No more stacking after this, I promise! Always make sure the pins are aligned correctly. Now is a good time to triple check that everything we’ve stacked so far is aligned as it’s supposed to be.

arduino home security system

Figure 23.  Grove Base Shield stacked on top of ROHM Sensor Shield.

Now the stacking is done, let’s connect the black cable from the breadboard to Arduino GND pin. We’ll then connect the white cable from the relay to Arduino pin 5V and gray cable from the breadboard to Arduino pin 41.

arduino home security system

Figure 24. Overall system design

Connect PIR sensor, buzzer and LEDs to Arduino through Grove Base Shield

Now connect PIR sensor, buzzer, and LEDs to Arduino. Use Grove Universal 4 pin cables with one connector to the sensor and the other connector to Grove Base Shield. Pin numbers are already marked on Grove Base Shield so it should be easy to follow. Use the following table for reference:

 

Connection From To Arduino
PIR Motion Sensor Arduino Pin 2 (Digital)
Blue LED Arduino Pin 4 (Digital)
Green LED Arduino Pin 6 (Digital)
Red LED Arduino Pin 8 (Digital)
Buzzer Arduino Pin 5 (Digital)
Remote Control Arduino Pin 41 (Digital)

 

arduino home security system

Figure 25. Connection between PIR sensor, buzzer, LEDs and Arduino through Grove Base Shield.

 

The assigned pin numbers should be consistent throughout; they will be coded as is in our program:

#define PIR_MOTION_SENSOR 2   // Use pin 2 to receive the signal from the module

#define LED1                               4    // Blue Led for motion detected

#define LED2                               6    // Green Led for triggered alarm

#define LED3                               8    // Red Led if motion and trigger switch are on

#define buzzer                             5    // Buzzer  

#define remote                           41    // Remote Control

 

We’re done with hardware installation! This concludes Part 1 of our DIY Arduino Home Security System. In Part 2, we’ll write an offline program to test the system we just built and also connect to the Internet to allow wireless control using Cayenne API. We’ll walk you through the process of creating myDevices Cayenne and establishing a connection (the system to your Cayenne account) so you can wirelessly control the security system even when you’re not home. Stay tuned!

Click here to read Part 2 of this article >

Purnomo Nuhalim
Purnomo Nuhalim
Hailing from Melbourne, Purnomo is a retiree and electronics enthusiast. Currently he is keeping himself busy with various open hardware projects using Arduino and Raspberry Pi. Besides electronics, he is also passionate about aero modelling and astronomy.

Check us out on Social Media