Infrared task automation in Linux using the Irdroid USB Infrared Transceiver

This is a Blog post with example usage of the Irdroid USB Infrared Transceiver in Linux for Infrared Task Automation. In the past we had a number of project that inluded creating scripts and cron jobs for executing sequences of infrared commands one after another , defined in scripts / macro’s .

In particular we had a client who needed to send a IR command to a number of STBs (IPTV distribution company) to wake them up from “sleep mode” every couple of hours, before the STB goes sleep mode.

The above task is achievable using the Irdroid USB Infrared Transceiver in Linux, or using the Irdroid-Rpi in combination with a Raspberry Pi.

In practice the client’s hardware configuration consisted of a transcoding server, running Ubuntu 14.04 and a LIRC Daemon for sending / receiving infrared commands. In this particular project my task was to set this box to work with the Irdroid USB Infrared Transceiver and issue a “Menu” command for the particular STB every 5 hours (which avoids the unit/s entering “sleep mode”) .

Tools used:

Tasks:

  • Compiling and installing LIRC on the Linux transcoding machine
  • Digitizing the Infared Remote Control used to control these STBs
  • Setting a CRON Job to send a infrared command every 5 hours

 

First I had to download a patched version of LIRC, compatible with the Irdroid USB Infrared Transceiver from the Irdroid.com download section (see the links at the end of this article). To use the patched version of LIRC , I had to compile it using the standard commands in linux:

  1. ./configure
  2. make
  3. make install

After installing LIRC, you will need a lircd.conf file which holds the remote control commands either in RAW form (pulse / space sequences) or a decoded HEX values / depending on the protocol these can be with different length.

For the above project the original remote control was not already available in the LIRC database (http://lirc.sf.net/remotes) , therefore I had to scan and record the remote control using the “irrecord” utility. The Irrecord utility comes with the LIRC package and it is used to record, decode and store the infrared signals from any (almost) infrared remote.

The Irdroid USB Infrared Transceiver enumerates as a standard Serial ACM device and if you dont have other serial ACM devices in the system it should enumerate automatically as ttyACM0 available as /dev/ttyACM0 .

To record the target remote I have used the command “irrecord -d /dev/ttyACM0 /etc/lirc/lircd.conf” . Once that command is issued you will be asked (in console mode) to make random button presses, which allows irrecord to analize and try to decode the target remote control protocol, then you will be asked to push and name every single button and at the end to save the configuration file and exit. Once done you should end up with a lircd.conf file located at /etc/lirc/lircd.conf .

To start LIRC issue “sudo lircd –device=/dev/ttyACM0 –listen=8765” this will instruct LIRC to listen on port 8765 on All interfaces .

Then you should be able to issue commands :

“irsend SEND_ONCE Remote_name Button_name”

Finally I had to set a cron job to run every 5 hours and issuing the “Menu” command in order to avoid the STBs going in “sleep mode”

That is done via Cron :

0 */5 * * * irsend SEND_ONCE Remote_NAME Remote_COMMAND

The above will send our command every 5 hours.

Downloads:

 


Dont have a Irdroid USB Infrared Transceiver?

– You can purchase one from HERE

Comments are closed.