Raspberry Pi Legacy Alarm Interface

We were asked to help someone interface an existing alarm system to the Raspberry Pi, so we have created this short feature on how this can be acheived.

Their alarm system has four digital outputs which are active low (pulled down to around 0V dc when active) and are at around 13V dc when in in an inactive state. It doesn't matter if the inputs are active low or active high because we can simply handle this is the software that we will run on the Raspberry Pi.

The simplest way to safely interface higher dc voltages like this to the Raspberry Pi is to use an opto-isolator IC. We use the ILQ74 quad opto-isolators a lot as they are very cheap and reliable. This 'quad' version of this IC is also perfect because it has four separate opto-isolators to meet the needs of this application.

ILQ74 pins
The ILQ74 inputs are simply LEDs and need a series resistor in line to limit the current entering each LED. If too much current is applied then these will burn out and the IC will be damaged. With a 12V dc input signal we are using a 3k9Ω current limiting resistor drives the ILQ74 input LED with about 3mA. This is plenty in our experience for reliable operation.

This means the input side of the circuit is as shown below. Notice that this is completely electrically isolated from the other side of the ILQ74, to which we are going to connect the Raspberry Pi GPIO pins. This makes it much harder to do any damage to the Raspberry Pi and ensures higher voltages are not applied to the GPIO pins.

The connections to the Raspberry Pi are going to be via four of the GPIO pins exposed on the GPIO header. It doesn't matter which pins are used, so long as they are free (not used by any other hardware) and your software is configured to use the right pins.

To protect the GPIO pins, we always connect them to external hardware via a 1K resistor. This means if they are accidently configured as outputs by mistake, then we can't damage them by shorting them to 0V (ground).

The configuration we are using here is such that when the ILQ74 output stage is working in 'pull-down' mode. This means that is connects the GPIO pin to 0V when the input LED is enabled. In order for this configuration to work though, the GPIO pins need to be 'pulled up' by a 'pull-up' resistor connected to +3.3V (the voltage that the GPIO pins operate at). Fortunately, the Raspberry Pi has on-board pull-up resistors that can be enabled in software, so we don't have to include them in our additional hardware design. These must be enabled in your software though for the circuit to work as intended.

This results in a final circuit design that looks like this:

Share ...
We are on ...
Facebook Twitter
YouTube Flickr Follow us on Pinterest