Intro: Get Email Alerts From Your Home Security System Using Arduino
Using Arduino, we are easily able to retrofit basic email functionality into virtually any existing security system installation. This is particularly suitable for older systems that most likely have long been disconnected from a monitoring service and would otherwise have limited utility. This is NOT a replacement for a monitoring service.
There are commercially available products, like the envisalink, that add additional communication and control functionality, but they are not inexpensive.
This project can be completed for under $10.
What you need:
- Arduino - preferably Uno or Mega
- W5100 Ethernet shield
- Security system - The one used here is a DSC Power 832 PC5010 but pretty much any model with a programmable pin(or any pin that has a measurable state change) can be used.
- Installation manual and programming worksheets - you will also need the installer code to make the necessary changes.
- A length of solid core wire suitable to connect to Arduino header pins.
Step 1: Program the Security System
Word of caution:
- Accessing the security panel or making changes to the installation configuration can set off a tamper alert if you are currently subscribed to a monitoring service.
- Also be sure to keep track of every change you make so that you can revert it back later if needed.
What we are trying to accomplish is to read a state change from the system when the alarm is triggered. Most systems have a programmable output pin which we can use to signal the Arduino. It is also possible to use the signal from the siren(without having to make any changes to the system) but additional circuitry and modification of the Arduino code will be required - I did not go this route because my main objective was to resolve the trouble code so I would be altering the configuration anyway.
Exactly how to program it differs between models, but the basic concept is the same - refer to your system's installation manual for specifics. In the DSC system I'm using:
- I set PGM1 pin to activate when the alarm is triggered. Section, Option.
- In this system you also set the attributes of how and under what conditions the pin functions - Section:
- Set Attribute 1 to ON so it triggers when there is an event on partition 1.
- Set Attribute 3 to OFF so that the pin is either open or switched to ground. If set to ON, the positive output can damage the gpio pin of the Arduino. Always be careful that Arduino input pins don't get more than 5v(some are only 3.3v tolerant)
- All other attributes are set to OFF.
Most security systems have a built-in modem that's designed to primarily communicate with a central monitoring station across phone lines. If they don't constantly get acknowledgement that the data being sent is received, a trouble code will be displayed. Some can be set to send pager messages or to call a personal line without the system looking for a reply(thus not displaying a trouble code) so if yours does, and you have a landline, you can program it to call your phone(s) in addition to sending an email in an event.
If you are not using a monitoring service and/or your system can't be programmed to call a regular phone number without throwing a trouble code, disable the communicator and telephone line monitor(tlm) in the configuration.
Step 2: Program Arduino
First we need to sign up for a service to send our email from.
The service I used is smtp2go which is free and works well with Arduino - the source code used here is based on the setup code from their site.
After you sign up, you need to base64 encode the username and password (found in "Settings" > "Users") in order for it to be used in the sketch.
Configure the sections with //comments to your requirements.
Upload to Arduino.
Step 3: Install Hardware and Test
Install the w5100 shield onto the Arduino and mount it in the enclosure. Velcro tape works well since is non-conductive and removable.
- Connect the wiring:
- PGM1 to pin7 of the arduino
- Aux(+) to Vin
- Aux(-) to Gnd
- Ethernet cable to LAN
Test the system.
Use the serial monitor in the Arduino IDE to see output status. Be sure to disconnect Vin and Gnd from the Arduino before attaching the usb cable to your computer.
Check the spam folder if the serial monitor shows the email was sent successfully but you're not receiving it in your inbox.