I have a background in electronics and computer programming, but like any good engineer, I don’t want to reinvent the wheel. If an off-the-shelf solution already exists, I’ll buy it and install it. I checked with alarm suppliers and they don’t have any kind of add-on device that sends SMS messages or e-mails for legacy systems. I investigated using an Arduino or Raspberry Pi with a WiFi or GSM module as the basis for a custom-built solution. It’s certainly doable, but it’s not very user friendly. If I need to make changes later, it will involve disconnecting the unit from the alarm system and plugging it into a computer to reprogram. The cost for all that hardware would be over $80 and that’s not counting relay circuits and other miscellaneous parts. I realized that there’s an another commonly available device whose hardware is more powerful and robust, costs less and is much easier to program: a refurbished Android OS phone. I paid $20 for a cheap LG phone for my son to make calls over WiFi for free a while back. It’s got GSM, WiFi, Bluetooth, and a touch screen interface. It runs faster than an Arduino and can be programed using free apps from the Google Play Store. Even someone without any programming experience can do it!
The biggest issue was to figure out a way to interface the cell phone to the alarm system. The siren terminals output 12VDC when the alarm is triggered. I can attach a relay circuit to that, but how to interface it to the cell phone? I could buy an IOIO board from SparkFun and connect it to the phone via USB. It’s not too expensive at $40, but it’s overkill for what’s needed. I remembered that wired headphones sometimes have buttons on them to control the media player. There’s only four electrical connections: left speaker, right speaker, microphone, and common, so where are the data lines? It turns out that commands are sent to the phone by shorting the microphone circuit. A small duration button press tells the media player to toggle between play and pause. A longer duration press can be used for other features. Adding predetermined values of resistance between the microphone connection and ground can trigger additional features like changing tracks or volume. However, we only need one trigger and shorting the microphone input will be the easiest to accomplish. A simple relay circuit connected to the audio jack of the cell phone gives us all the external control input needed.
Cell phones use a 3.5mm 4 conductor jack. This allows for stereo speakers (headphones) as well as a microphone. We could buy a 4 conductor extension cable and hack that up to wire the microphone to ground when the alarm is triggered. A spare 4 conductor 3.5mm wire originally used for video output from an old portable DVD player can be hacked for this project, too. (The red RCA plug is usually the one mapped to the microphone.) The instructions below use a headset adapter that splits out the mono microphone and stereo audio into separate jacks. A mono 3.5mm cable to bare wires is used to connect from the splitter and the output of our relay. It doesn’t matter which method you choose. Pick the easiest and cheapest.
The alarm system will trigger the siren and apply a constant 12 volts for the duration of the event. We don’t want the relay to remain on during for the entire time. Instead, we want a single short pulse sent to switch the relay on and off for approximately a second when the siren is activated. (I should note that this would still work if the relay was left in the on position for the duration of the siren’s activation since the cell phone media button feature works on the initial button press and not its release. However, this type of relay circuit does not cost significantly more than a simple one so the proper input duration can be provided.) This type of electronic circuit is called a monostable multivibrator. I’ve built them in the past using a 555 timer, but assembled power circuit boards are readily available from China for dirt cheap. I found one that does exactly what we need and can be configured by switching a few jumpers around.
Amazon sells both the older and newer design. The biggest difference is the reset button on the newer version. It’s not needed for our application, but it was only $2 more, so I sprung for it. The older version of the relay timer can also be found from other sellers on Amazon (and eBay) for less, but they usually ship the board from China. Search for “FC-32 timer” to find it. One big word of warning about this relay timer circuit:
|Ensure jumper S5 is NOT connected! Enabling this jumper may damage your phone, relay, and alarm system!|
The S5 jumper will tie the input common to the output common. This is a big no-no for this application since we want the alarm siren and cell phone audio jack to be electrically isolated from each other.
Alarm systems may provide 12VDC constant power for external devices. We can add a wired car charger with a MicroUSB jack to supply power to the cell phone. This is completely optional and would only be necessary if the cell phone’s charger couldn’t be plugged into a nearby outlet.
It would be a good idea to disable any power saving features for the dedicated cell phone even when on battery power. Automate can disable the power save feature for you and can even keep the phone “awake” if necessary. I believe any power saving features that could cause issues were introduced in Lollipop. My spare phone had KitKat installed.
Sending SMS messages without cell service can only be done through e-mail. I tried using Google Voice with Hangouts as my SMS client, but SMS messages cant be sent through Hangouts using Automate. It’s also currently not possible to use the Google Voice app with Automate either.
I added a separate fiber in Automate to send an email alert when the phone is on battery power and when AC power is restored. I won’t be providing instructions on how to do this. I’ll leave it as an exercise for the reader.
I programmed the messages to contain the phone numbers to the non-emergency police hotline and my neighbors. My personal cell phone will alert me with a siren sound and display an eye-catching image. I accomplished this by customizing the phone book contact for the cell phone number and/or GMail account used for the alarm system. Some stock messaging apps do not allow for custom contact notification sounds. I had to install Handcent Next SMS on my Samsung device to get that feature.
- Android cell phone
- GERI® DC 12V Delay Relay Delay Turn On / Turn Off Switch Module with Timer
- Headset adapter for headsets with separate headphone / microphone plugs
- 3.5mm Mono Plug to Bare Wire
- 18-20 gauge speaker wire
- Very small flathead screwdriver
- Wire strippers
- 12V to 5V MICRO USB Cable Connector Car Charger Power Supply (optional)
Create the Automate Flow
- Connect your cell phone to your WiFi network, if applicable. Create a new Google account for this phone. I suggest creating the account on a desktop/laptop computer rather than the phone if the Android OS on the device is old.
- Install Automate on the cell phone from the Google Play store.
- Create a new flow as pictured here:
This flow sends an e-mail using the GMail account. You can send SMS messages through e-mail, too, or send them directly if you have cell service. Feel free to expand on the flow to include other forms of communication. Remember to loop back to the beginning.
- If you have a wired headset designed for a cell phone with a button, plug it into the cell phone and test the program. Make sure all of the communications are sent by the cell phone and received on all the other devices.
- Configure personal cell phones receiving the SMS messages from the dedicated one connected to the alarm system to use a custom ringtone/notification and contact picture.
- Optional: Install a remote control app like TeamViewer Host or TeamViewer QuickSupport to remotely control the phone from a computer. It will make further enhancements and fixes easier.
- Set the jumpers for the relay timer as follows: S1=0, S2=1, S4=OFF, S5=OFF, S6=ON, S7=OFF. This will configure it to turn the relay on when 12VDC is applied to VCC and GND for a short amount of time and ensure the input is isolated from the relay outputs.
- Connect the 3.5mm mono plug bare wires to the normally open (NO) terminals of the relay. Use a very small flathead screwdriver to tighten.
- Plug the other end of 3.5mm mono plug into the microphone connection of the splitter. Plug the splitter into the cell phone.
- Use the speaker wire to connect the alarm siren terminals to the input of the relay timer. Be sure to use the correct polarity.
- Trigger the alarm system to test if the relay timing is correct. Use the very small flathead screwdriver to adjust the potentiometer on the relay timer to ensure the duration of time the relay is closed will trigger the fiber in Automate properly.
I thought about adding a feature where the cell phone would make a voice call to me and play a prerecorded message. However, it’s impossible (as far as I know) to play an audio file to a recipient during a phone call. The workaround would be to create a loopback plug. I haven’t actually tested this idea, but it’s what I would attempt. Another way to provide this feature would be to use a third party service to handle automated voice calls. The costs are surprisingly low and the companies usually provide an API to interface your product with their service.
Automate can obtain data like local weather and rainfall. I’m thinking about using a relay controlled by DTMF tones connected to the headphone jack to act as a rain sensor for my sprinkler system. This is why I chose to specify the headset adapter in the parts list above. This project uses the microphone port as a control input and that project will use the headphone jack as an output.