back
Software IR decoding

version 3.1

Written by Fredrik Hubinette


I've been using an IRMAN for a long time. I didn't like lirc, so I wrote my own software for talking to it. Now, that was fine until I started using an IR distribution block to get IR signals from all over the house. For some reason, both my IRMAN receivers have problems when the input comes from the IR block. A couple of weeks ago I decided to do something about it.

I had a spare arduino sitting around from another project. There are lots of projects on the internet that connect an IR decoder module to an arduino, which is fine, but it seems to me that it would be more reliable to just hook up the arduino directly to the IR distribution block.

The IR distribution block use a standard 3.5mm headphone jack for the IR emitters. It has ground, a 12v signal and a 0.6v signal. The 0.6v and 12v signals are modulated at 40khz. After a bit of experimentation, I found that a simple 2:1 voltage divider allows me to feed the 12v signal directly into an arduino pin. The circuit looks like this:

IR block
signal(12v)----------[2kohm]------+-------pin8
                                  |
              +------[1kohm]------+
              |
gdn-----------+---------------------------gnd
arduino

On the arduino, I run a very very simple 1-bit sampling program. It samples the input at 250khz, and writes back how many samples were high and how many were low on the serial port. You can download the PDE here.

The computer side is a little more interesting, as it has to de-code the carrier signal and the IR protocols. Normally, lirc would be the software for the job, but I don't like how it (doesn't) handle input focus, so I prefer to roll my own. Currently, my decoding software is available as a module that will call a function for each IR signal. I have software that combines this with some of my other hacks to actually send keyboard events to programs.

The irdecoder module, can be downloaded here, like most of my software, it licensed under the GPLv2 license.


This page has been accessed 7,499 times since September 25th, 2011.
Last modified: September 25th, 2011 - Design by Monica & Fredrik Hübinette