Hardware components

Alarmino is build of three main components:

Arduino Uno

From the very beginning I knew I’m going to use Arduino for this project. This is my first (and so far only) Arduino-based project, and honestly, I was looking for a good excuse to get my hands on this board. The only thing I had to decide was whether to use the (more potent) Arduino-Mega, or the (smaller and cheaper) Uno. After some guesstimating I ended up going with the Uno. This turned out fine, although not extremely comfortably. I ended up using more than 70% of the available 32KB of program memory, and if I’ll want to add substantial functionality in the future, I might find myself in a tight spot.

IComSat – SIM900 GSM/GPRS modem

Choosing a GSM modem for the Arduino took slightly more time; In addition to the IComSat shield I looked at quite a few products:

Obviously I couldn’t test all these boards hands-on to compare them. In the end, it boiled down to price, GSM chip used, and perceived build quality. I selected the IComSat, and I’m quite happy with this selection. Here are some points about the IComSat v1.1 shield:

Advantages:
  • Somewhat flexible design – allows the user to select the Arduino pins used for serial communication (via on-board jumpers)
  • Has connections for power-cycling and reset of the SIM900 chip by the Arduino
  • Has a real-time-clock with a super-cap to maintain the time when disconnected from power (which I use as the RTC of Alarmino)
  • Good build quality
Disadvantages:
  • Somewhat problematic power circuit – draws its power from the Arduino’s 5V pin. The problem with this is that the Arduino can provide up to 0.5A on this pin, and the SIM900 at the heart of the IComSat can draw up to a whopping 2A in some situations. See below how I handled this issue.
  • Somewhat inflexible design – doesn’t allow the user to select the Arduino pins used for power-cycling and reset
  • Lack of adequate software. More about this in the software section.

Interfacing with the alarm system

The only way to interface with the alarm system installed at my home, is through its phone-line connection. The alarm system expects to be connected to a POTS (Plain Old Telephone Service) line. When it needs to report an event, it dials to the central station, and report the event using the Contact-ID protocol.

Emulating a POTS phone line

Before the alarm tries to dial to the central station, it checks to see whether it is connected to a “live” phone line. There are two things that need to exist for the alarm to believe it is connected to a live phone line:

  1. Some DC voltage across the wires – The phone company’s equipment provides about 48V DC across the phone wires. Luckily, devices will typically be content with much lower voltage, and will consider a line as “live” even if they detect 10V or even less. This is done to allow for voltage drop over long phone lines. I used a 12V power source, and as it turned out, my alarm system was happy with it.
  2. A dial tone – This is the 400Hz tone you hear when you pick up the phone.

Providing the DC voltage turned out to be a bit of a problem. Think about it – we have to power the phone connection with DC voltage, and at the same time transmit and receive tones over the same two wires. If we connect the DC source directly to the lines, it will short-circuit the tones signals that need to travel on the same lines (you do remember that a DC source has a zero impedance to any AC signal, right?). A typical arrangement would be something like this:

Phone Line Interface

Here we use coils to isolate the DC and AC signals. On the left you can see the circuit of a symmetrical connection, and on the right the circuit when one of the lines is grounded. This is very simple, but since we’re dealing with low frequency signals, we need huge coils. In fact legacy phone exchanges used exactly this arrangement with 5Hy coils! We’re not talking about baby-proof 5uHy coils, and not even about more respectable 5mHy coils. These are 5Hy behemoth that can only be handled by Real Men (http://www.ee.ryerson.ca/~elf/hack/realmen.html). They are large, they are expensive and they are hard to get by. Luckily there’s a nice trick that allows us to get rid of the coil in exchange for a capacitor and an active component such as an op-amp or a transistor. This circuit is called Gyrator http://en.wikipedia.org/wiki/Gyrator. As you can see in the schematic diagram, I provide the DC voltage to the phone line through a Gyrator designed around a 100uF capacitor and one 2N2222 transistor.

Detecting and decoding DTMF tones

The alarm sends its messages using DTMF tones (http://en.wikipedia.org/wiki/DTMF), so we must be able to decode DTMF tones. At first I thought I could use the Goertzel algorithm (http://en.wikipedia.org/wiki/Goertzel_algorithm) to do that. This is something I did successfully in a previous project of mine, but that project was running on a smartphone with a 700MHz ARM chip. After some quick calculations I reached the conclusion that I stand little chance of achieving this on a 16MHz ATMega328, so I started to look elsewhere. It wasn’t long before I found the M8870 DTMF decoder chip. This chip is so cheap (couldn’t resist. Sorry) that my dilema of software vs. hardware was now over. When the M8870 detects a DTMF digit, it sets its four output pins Q1..Q4 to the digit’s value, and signal the digit’s availability on its StD pin. Q1 to Q4 are connected to an Arduino input port, and StD is connected to the Arduino’s Int1 pin where it generates an interrupt whenever a new DTMF digit is detected.

Detecting On-Hook / Off-Hook

Alarmino needs to be able to detect when the alarm takes the phone line off-hook or on-hook. When the line is on-hook it is characterized by a very high resistance (the current it draws is virtually zero). When the alarm takes the line off-hook its resistance is much lower, and it may draw a current between 20mA and 100mA. In order to sense this, I use a 1-ohm resistor in series with the alarm, and sense the voltage over this resistor with Arduino’s AD4 analog input.

Generating Tones

In order to emulate a POTS phone line, and implement the Contact-ID protocol, Alarmino needs to generate tones and transmit them to the alarm system over the phone line. Generating tones with Arduino is relatively simple. The tones are generated with PWM, so in order to get a clean signal, we should implement a low-pass filter. I decided to implement a 5-elemet low-pass Chebyshev filter (http://en.wikipedia.org/wiki/Chebyshev_filter). It has a cutoff frequency of about 3.4KHz. This filter is probably a slight overkill for this use, but I wanted to make sure the alarm doesn’t misinterpret the Contact-ID tones due to high-frequency noise.
One more thing to notice is that I didn’t bother to match the filter’s impedance. I was more concerned with getting the signal levels to reasonable values with as few components as possible, and I got good results even without impedance matching.

Power Supply

If I had used a separate power supply for Alarmino, I would have had to install a backup battery and a battery charger. This would have become quite expensive, plus it would require replacing the battery every several years (adding even more cost). Since the alarm system already includes a backup battery, I decided to take advantage of it, and draw the power for Alarmino from the alarm system.
The alarm provides between 12V and 14V. This is generally OK for the Arduino, but it’s definitely higher than the ideal voltage. The Arduino has an NCP1117ST linear voltage regulator without a heatsink. This regulator has to dissipate power that is a multiplication of whatever current the Arduino is drawing, by the voltage drop across its IN and OUT pins. Since the GSM modem is also drawing its power from the Arduino, I thought that powering the whole thing with more than 12V might overheat the Arduino’s voltage regulator. To overcome this I’ve added my own linear voltage regulator, that drops the voltage to about 8.2V before it goes to the Arduino. This voltage regulator is based on the LM350, and I fitted it with a nice heatsink, which keeps everybody cool and happy.
One more hurdle that had to be overcome was that the GSM modem draws its power from the Arduino’s 5V pin. This is actually my #1 complaint to the IComSat modem designers. The SIM900 datasheet specifies that under certain conditions it might draw current of up to 2A in bursts of 577uSec every 4615uSec. The Arduino’s NCP1117ST maxes at 1A. Obviously, if left alone, this is not going to be all swell. To solve this issue, I added a 2000uF capacitor (two 1000uF caps in parallel) to the GSM modem’s 5V pin. Assuming that the Arduino can provide almost 1A, this capacitor is going to be drained at about 1A. In 577uS its voltage will drop 0.29V (1A * 577uSec / 2000uF). This is certainly within our comfort zone.

Where I bought components

Before Alarmino, I didn’t have much experience buying electronic components online. At first I looked at the well-known stores such as Farnell/Element14 and RS-Components. The problem with them was the shipping cost. I live in Israel, and shipping here might get relatively expensive, especially with small orders. After looking on some hobbyists forums, I found Tayda Electronics (http://www.taydaelectronics.com/). I was amazed with their prices, and their shipping rates are totally reasonable too. They’re located in Thailand, and given their prices, I thought they’re probably not a top-quality store. However, since they had all the components I needed, the price being excellent, and since I read positive reviews about them, I thought I’ll give them a try.
I must say I was pleasantly surprised. I made two orders there (because after the first order, I changed some of the design and needed more components). Both of them were shipped from their store within a day, and arrived within less than two weeks. I’ve got a mail tracking number so I could track the packages. The packages include exactly what was ordered. The packaging was superb. Every item comes inside a small plastic bag with a printed sticker on it with the component name and quantity. I totally recommend this store. (Sounds like I’m getting a commission from them, I know).

Next

Next, you can read about Alarmino’s software, about the Contact-ID protocol, or go back to Alarmino’s main page.

4 Responses to “Alarmino – Hardware”


  1. 1 Phil September 24, 2012 at 4:34 pm

    Great project! Could you post a parts list for the circuit board? Perhaps the contents of your two orders to Tayda?

  2. 2 Dude July 29, 2013 at 10:34 pm

    Would love to get more detail on the POTS simulator, this has been my barrier to implementing the exact same project.

  3. 3 Zikako August 18, 2013 at 8:54 pm

    Hello li0r,
    I tried to interface the simulator with some alarm control panels and on some the decoder can not detect DTMF tones.
    It was necessary to increase the gain to 2 by replacing the resistance between the pin and IN- and GS.
    Work well…

  4. 4 Keskese April 18, 2014 at 5:02 pm

    What if i wanted to piggy back off a 12V trigger like the horn or strobe light to set off an SMS alert? Hoping that there is an alternative to using the phone line as the trigger. What would be the wiring and coding requirements for such a setup?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.

%d bloggers like this: