“We have an emergency alert in detention block AA-23.” – Random Death Star Administration Team Member.
When I first moved into my house I found there was a Networx NX-4 alarm installed. Great! All I needed to do after that was add a network connection to it so that I could control it from my home automation system. I had originally planned to buy a serial interface module for the alarm so that I could build an Arduino device to communicate via a serial connection to the Alarm. This would enable me to more or less capture every event as it occurred, and to send input to the alarm – arm, disarm etc.
I was talked out of this on the basis that there was also a new network module available, where instead of me needing to add an Arduino with an Ethernet connection to the serial module, I could just stick their network module in instead – and communicate with that. The network module was a ComNav module.
On the whole, the device is quite good. I’ve only had to completely power the alarm system down (including the disconnection of the battery) once to reboot the network module. After that I’ve not had an issue with it.
However, recently I wanted to teach my home automation system how to monitor the status of each of the alarm sensors. This wasn’t for a function related to the alarm, but instead to allow me to turn lights on if someone walks into a zone. This was primarily for night time – if someone walks into the hallway then turn a light on for them. After five minutes of inactivity then turn the light off again.
Unfortunately, the only technique to achieve that involved my home automation system polling the alarm network module every 1.5 seconds to see if the zone status had changed. I needed to poll so frequently as the sensors are very responsive, and you had to be quick to catch the status change on the alarm network module web interface (the home automation system needed to poll the web interface on repeat).
Whilst this worked, it was very clumsly. I really don’t like having to add polling over the network into my applications. I’d much rather have an event based system instead – more efficient. In this case though it was a necessity – the alarm network module itself didn’t seem overly responsive to zone status changes, and sometimes it just didn’t even notice.
My father suggested building an additional component to add into the alarm circuit that would act in a manner similar to the alarm – checking the voltage/signal coming from each of the sensors. So, that’s what I did.
I used a network based Arduino module (like this one) for my project. There were two main elements in my circuit design.
I didn’t want to put another power supply up near the alarm – especially as I wanted to put my Arduino in the alarm box itself. This meant drawing power for the Arduino directly from the alarm system. The alarm system has a 12V supply, where as the Arduino expects a 5V supply – although technically you can supply up to 20V to an Arduino – you just make the 5V regulator much hotter.
With some guidance, I built a small circuit with an LM7809 9V voltage regulator and a couple of electrolytic capacitors, to drop the supply voltage from the alarm down to 9V which was a much more acceptable input voltage for the Arduino. The Arduino’s built in 5V regulator then takes care of the rest. I was then able to connect the output voltage from the regulator to the VIN pin on the Arduino directly, rather than connect to the Arduino power socket.
I used a multimeter to measure the voltage across the Zone pins (Zone pin and Common). When the zone sensor was not active (no activity detected), the multimeter would measure 6.8V. When the zone sensor was active (activity detected), the multimeter would measure the full voltage (in this case around 13.5V). I created a voltage divider circuit with a high enough resistance to not draw too much current away from the alarm system’s zone inputs. This voltage divider allowed me to drop the voltage at the analogue pin down to under 5V which then allowed me to use the pin to measure the voltage on the zone sensor. The formula for determining the resistances needed for a voltage divider can be found easily on the internet.
Here’s a picture of the shield with the components mounted on the Arduino. The red and black wires are the input voltage from the Alarm system itself. I hijacked a couple of the digital pins on the top shield (after disconnecting them from the base board) to use as the sensor inputs – basically the top of the R1 resistor in the voltage divider connects to a digital pin on the shield. That just allowed me to more easily attach/detach the sensor connections.
With the circuit assembled, I used the analogRead function to measure the voltage (relative to the 5V reference voltage) on the three alarm zone pins. I was measuring a value of 450 (± 2) when there was no activity on the sensor, and a value of around 730 (± 2) with there was activity on the sensor. I put some code in to sample the sensor circuit every 100ms. If there was a change in the reading that crossed the threshold (I set the threshold to about 615), then the Arduino was to send a network event to the home automation system informing it of the change to the individual zone. I placed some dampening code in as well to moderate the frequency of events.
With that installed and mounted in the alarm box, my home automation system was now receiving instantaneous events when a zone was triggered, and with perfect accuracy (unlike my original code that polled the alarm network module every two seconds).
The overall project was quite simple – as you can see the circuits are not complex. The code required very little effort as well, and all of the parts together were relatively cheap – the Arduino being the biggest expense. Depending on how you sourced/configured the Arduino – you could pick that up for under $30.
Small, cheap, dedicated devices like that can be very effective for the function they perform – in this case the delivery of instantaneous events over the network to a home automation system with detail regarding which sensor was triggered, and when the sensor was cleared.