A burglar alarm that tweets when an intruder enters the house? What with the fashion for Twitter lately, I thought I’d give it a go, and this also gave me the excuse I’d been looking for to try out the Arduino hardware platform.
The Arduino is a simple embedded board with an AVR processor and sundry IO for interfacing to the outside world. It has several digital IO pins suitable for connection to the output signals of a burglar alarm, so I wired these in to the Arduino and set it to work keeping a constant eye on the alarm status. My alarm panel is somewhat isolated in the house with no nearby Ethernet connection, so I added an Xbee wireless module capable of sending data to another room in the house with Ethernet available. The Arduino spends its time monitoring the alarm output pins and sending the latest status over the air.
At the other end of the wireless connection, I have a Linux server with an Xbee USB module. A Python script running on the server reads the alarm status being received off the air by the Xbee module. If it sees that the Intruder alert signal is being asserted at the alarm panel, it generates notifications in the form of an SMS (via textlocal.com) and a Twitter status update.
Of course an SMS is ultimately the best way to send an urgent message like an intruder alert, but the Twitter updates are useful for posting less important status updates. As well as the intruder alert signal, the module can read a bunch of other status signals from the alarm and post those signals only to Twitter. I use these tweets to post whenever the alarm is set and unset. These updates would be intrusive if they came via SMS, but not when floating past in my Twitter feed. The tweets are sent from a unique Twitter account with protected updates so only I can follow it – they are not broadcast to anyone following my normal tweets.
My experience with the Arduino was that it really is very easy to use for simple interfacing jobs like this. The embedded side of the software is implemented in just a few short lines of code: it reads the state of the digital input pins, and sends the current state to the Xbee wireless module via the AVR’s UART. You can see the code for yourself here.
The active Arduino user community means that third parties are building add-on modules (shields) for Ethernet, Zigbee, RFID, GPS, SD cards and a host of other technologies. Whatever you want to achieve, there could well be a ready-rolled means of doing it quickly with the Arduino. However if you’re planning on a mass home automation project with Arduino/Xbee modules all over the house, you might want to bear in mind the cost (approx £20 for the Arduino, approx £40 for the Xbee and Xbee shield).