This project is designed using normally-closed reed switches connected to doors and windows and additional passive infrared (PIR) motion sensors to detect movement of a burglar or an unwanted intruder in your home. The security system can dial up to two phone numbers to alert you. It can also send text message to one of the numbers.
Circuit and working
Fig. 1 shows circuit diagram of the Arduino based GSM home security system. It works off a 12V power supply (connected across CON2). An Arduino microcontroller (MCU) requires only 5V but a GSM modem requires 12V. As Arduino Uno has an inbuilt 5V voltage regulator, a common 12V supply can be used for the whole system. It is built around two Arduino Uno boards (Board 1) and (Board 2), one SIM900 GSM module, TIP142 (T1, T2) and 2N2222 (T3-T5) transistors, magnetic reed switches, PIR motion sensors and a few other components.
Brain of the circuit is Arduino Uno MCU board (Board 1). PIR sensors (connected across CON4 through CON8) detect motion, and output of the PIR sensor goes high when it detects any motion. The software constantly scans for a positive input at pin 9 (D9) of Board 1. When all the reed switches are closed and outputs of all PIR sensors are low, D9 is held low by T5.
A positive output on pin 8 (D8) or pin 11 (D11) of Board 1 is necessary to put the system in armed mode, which is indicated by LED1. As soon as one of the reed switches in the closed loop opens, or PIR sensors detect motion, logic level on D9 goes high via D8 or D11.
Pin 10 (D10) of Board 1 also goes high and latches D9 to 5V. Board 1 then commands SIM900 GSM module to send a text message and make six phone calls each to two different mobile numbers. You can simply ignore the calls and call your neighbour or a security guard to check on your home or premises.
After making a total of 12 phone calls, pin 13 (D13) of Board 1 goes high. It instructs Board 2 to cut off power supply to Board 1 and GSM module for five seconds. T1 switches off and on, thus resetting the system. Board 1 returns to standby mode, which is indicated by LED2.
The system can be activated again by sending an SMS. Each time the circuit is powered up, LED2 lights up to indicate that the system has entered standby mode. It also sends an SMS to your mobile phone that reads ‘Standby Mode.’
You can arm the system by sending SMS ‘$ON$’ and the circuit would reply back ‘Alarm On.’ The system now monitors all reed switches in the closed loop and output from all PIR sensors. It can be disarmed by sending SMS ‘$OFF1234.’ It would reply back ‘Alarm Off.’
A four-digit password is needed to disarm the alarm system by SMS. It can easily be changed by modifying the line in source code of Arduino1.ino sketch as shown below for reference.
|| inchar == ‘F’ || inchar == ‘1’
|| inchar == ‘2’ || inchar == ‘3’
|| inchar == ‘4’)
Before leaving home, you can also press push button S1 for 30 seconds instead of arming the alarm by sending an SMS. LED2 would start flashing. After 30 seconds delay, LED2 stops flashing and LED1 lights up to indicate that the system has been armed. Any unintentional intrusion by you at this point will trigger an alert. So be careful. Even otherwise, you will have 30 seconds to leave home and close the doors.
As shown in Fig. 1, T3 has been used to turn on GSM module via Arduino software. So there is no need to manually start GSM shield. RF chokes (RFCs) L1 and L2, along with decoupling capacitors C3 through C6, filter out stray radio frequencies and noise to avoid false triggering of the alarm system.
LED3 lights up when the alarm is activated. Board 1’s pin 6 (D6) has been used to activate relay RL1. A loud siren can be switched on via the relay to scare the burglar or intruder away. Reed switches can be mounted on door frames of entry and exit doors. Small magnets should be mounted on the doors themselves. When a door is closed, the magnet and the reed switch should be in close contact with each other. PIR sensors should be placed in each room, preferably on the wall and in view of the window.
Pressing switch S2 deactivates the alarm. The switch can be placed in a hidden location outside the house, but it is not recommended. Leave the house after pressing switch S1 and turn off the alarm via SMS when coming home from work in the evening.
Construction and testing
An actual-size, single-side PCB pattern for the Arduino based GSM home security system is shown in Fig. 2 and its component layout in Fig. 3. The circuit can be assembled on the PCB. It can fit easily inside most prototype/custom enclosures.
Download PCB and component layout PDFs: click here
Enter your primary mobile phone number to receive calls and SMS. This number is also used to send SMS commands like ‘$ON’ and ‘$OFF1234.’ Replace xxxxxxxxxx with your ten-digit mobile number in the following line of Arduino1.ino sketch:
// 10 digit mobile number
Enter the second number to receive alerts (phone calls only) in all the following lines under void call():