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.
- 10k resistor to pull arduino input pin to ground.
- 1.5k resistor to limit current going to the LED side of the optocoupler. Value is based on the input voltage and max current of the optocoupler.
- Optocoupler - I used an FOD817 but this is a very simple circuit with broad requirements, so there are literally hundreds of other ones that will work with remotely similar specs.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
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 3 to ON so that the pin is normally open and is switched to ground when the alarm is activated. 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 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.
smtp2go emails end up going into the spam folder after a while(even if you set them not to). I tried temboo which was more reliable(since it uses gmail), but profiles expire after a month so that's not a viable option either. I included the code for sending from gmail with temboo using a w5100 shield if anyone needs it (their code requires you to use the discontinued and expensive yun).
This version uses temboo gmailv2 which authenticates using the more reliable OAuth with refresh token as opposed to the app password used in gmailv1.
Eventually I settled on using my isp provided email which has port 25 open. You can use any smtp email server/port as long as it doesn't require the connection to be encrypted(since the w5100 doesn't support it). The benefit of using the isp provided one is that google doesn't flag it as spam. The arduino code is almost the same as with smtp2go, but with a few minor changes/updates.
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.
I used a photocoupler to isolate the 13.7v pgm1 signal from the 5v arduino input and ground. It's a "non-inverting optocoupler" circuit.
When the alarm is activated, pgm1 switches from open to ground completing the circuit.
Test the system.
Use the serial monitor in the Arduino IDE to see output status.
Check the spam folder if the serial monitor shows the email was sent successfully but you're not receiving it in your inbox.