Introduction: 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.
- 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.
Ethernet cable.
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[009], Option[01].
- In this system you also set the attributes of how and under what conditions the pin functions - Section[141]:
- 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.
Source code:
https://github.com/hzmeister/arduino_alarm_email
Configure the sections with //comments to your requirements.
Upload to Arduino.
Update:
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.
Source:
https://github.com/hzmeister/temboo-gmailv2
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.
Source:
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.
7 Comments
Tip 1 year ago
Self monitoring sending a "friend" an email too is best. A security company will not repair a broken window, smashed door or fix anything. If you are away and a break-in has occurred, you need the break-in fixed. So email alerts to friends totally beats a security co. monitoring where they simply confirm what the alarm has already told you. Same for water leakage, freezer failure too. You need action not just confirmation of a problem.
3 years ago
Your idea is excellent. It really saves a lot of money by just monitoring a security system yourself rather than paying a security company to monitor it for you. Your presentation of the topic is excellent. Your mentioned tool for base64 encoding is good. But have a look at that tool https://url-decode.com/tool/base64-encode to base64 encode the username and password. Where you also get more than 100 tools for different tasks.
5 years ago
Most insurance companies unfortunately require offsite monitoring of your alarm system by a security company. To get around reprogramming the system hardware and setting off a "tamper" alert, why not just piggyback off the output siren signal? Some circuitry will be needed to make the signal compatible with an Arduino input.
5 years ago
Nice idea! it can be tweaked to any "alarming" device too if you look for a pin/signal change, such as a little shed alarm
Alarms monitored by an alarm receiving centre usually have a few different outputs. Each system will be different, but on a average monitored system there is a tamper alarm output, a pin X alarm and a pin Y alarm.
Usually when pin X is triggered it is one zone like a PIR or window/door sensor, a monitored alarm company in the UK would then phone a keyholder to tell them the alarm is active. They class this as an unconfirmed alarm as it could be a fault, or a pet that's triggered it.
When another zone or sensor is triggered this then alarms on pin Y which is a secondary output, this is then classed as a confirmed alarm as it usually indicates someone moving about rather than a simple fault of two wires touching or a pet.
If you know the sensors setup that you are using, you could piggy back onto there alarm signal sending a signal high on a normally low channel to indicate to your raspberry pi or arduino pin so you can customise the message you receive.
One downside of this modification is you won't receive an alert in the event of a power cut, a) as your power feed will be down and b) your router/modem will be down, however the alarm can still power a signal to the alarm company as telephone lines don't require power for the signal.
⚠️⚠️Word of caution, if your alarm is monitored call the company before opening it... you could set off a tamper alarm and get a bill for it!⚠️⚠️
Reply 5 years ago
Good insight. Maybe it's different in the UK, but in the US, monitored systems communicate reporting codes to a receiving center using the built-in communicator - there are dozens of different reporting codes that can be programmed to relay information about the system. For the most part the programmable output pins aren't used.
5 years ago
You could probably save a lot of money by just monitoring a security system yourself rather than paying a security company to monitor it for you.
Reply 5 years ago
This is NOT a replacement for a monitoring service. This method adds at least some form of communication back to older systems that would otherwise be rendered useless.