FOLLOW MY BLOG > bengoncalves.net
SEE MY OTHER ISTRUCTABLES > Ben Hur's Profile
The other day my father and I were discussing about the problems of living in a third world country. Because of the social inequality, there is little security on the streets. Also one major problem is that no one is secure, even the 1% richer, because there are know cases of robbers getting inside homes even on private neighbourhoods. We ended up thinking about putting a home security system in our house. The problem is those are very expensive and, in general, they just ring an alarm to scare potential thieves, but they don’t actually warn you in real-time that your house is being invaded. A complete system would be even more expensive. So I got the idea to make my own Arduino based home alarm. I just had to buy a GSM shield for the Arduino Uno, because all other parts I already had.
Step 1: The Parts
For this project you will need:
Step 2: Connecting the Components
First you will place the GSM shield above the Arduino Uno, then you will need to solder the wires GND and VCC together from the two sensors, the buzzer and the relay module input. After that, you connect those soldered wires on the corresponding connector from the GSM shield. Next you will make a connector from the input / output signals from those parts, and the last thing will be to connect the keypad above the shield. It will be:
Arduino Uno / GSM shield pins:
- Pin 0: unconnected;
- Pin 1: unconnected;
- Pin 2: unconnected (the GSM will use this pin);
- Pin 3: unconnected (the GSM will use this pin);
- Pin 4: last row from keypad (keypad pin 4 – from 8);
- Pin 5: unconnected;
- Pin 6: second column from keypad (keypad pin 6 – from 8);
- Pin 7: third column from keypad (keypad pin 7 – from 8);
- Pin 8: unconnected (the GSM will use this pin);
- Pin 9: unconnected (the GSM will use this pin);
- Pin 10: PIR sensor number 2 data;
- Pin 11: siren horn signal (goes to the relay module input);
- Pin 12: PIR sensor number 1 data;
- Pin 13: buzzer signal input;
As it is possible to see, although the keypad has 8 pins, I just connected three (one rom and two columns, allowing two numbers to be read – 1×2 matrix), because this way I can make passwords using these three wires, and there is no need to use all the pins from the keypad. This is because once the movement sensor detects a person walking inside the room, the person will have just 5 seconds to deactivate the alarm, so there is not enough time for the thief to figure out the alarm code. Once the alarm is not disabled on the given time, the GSM shield will proceed to send SMS to you, or to call your phone. The Arduino was programmed to call and once you answer the phone, it will finnish the call. This way it will spare the credits from the mobile operator.
Of course, it is possible to get false readings from the sensor, or even the code can be buggy, so I put an option to disable the alarm just by sending an SMS text from my phone to the Arduino. Also another option you can make is to order the shield to send you one message a day to ensure you it is working correctly.
Step 3: The Code
Just download the code below and compile. It uses the Keypad.h and GSM.h libraries. As the Keypad.h is not standard with the Arduino, I put it to download here too. I suggest you test your setup by steps.
Step 4: Conclusion
Considering the code will make the Arduino Uno send SMS messages and call your phone in only five seconds after someone break into your house, I guess you will have plenty of time to call the police. Of course the siren horn will scare the thieves and they will run away taking whatever they can, but if you don’t use the siren, you will probably end up having them arrested. I hope this way you can have a more secure home. If you have some good idea please leave a comment, that I will improve my system here. Hope you guys find this article useful.