Back

Raspberry Pi LIRC

Setting up

LIRC is the Linux Infra-red remote control library which provides drivers and utilities for managing consumer infra-red devices under Linux.

As of December 2012, LIRC support has recently been added to the preferred RPi distro, Raspbian, but foolproof instructions to get this working are hard to find

Upgrade to the latest distro software

1Make sure the time/date is accurate. Generally a time server should be used, which seems to be built in to the distro, but make sure the time zone is correct.
2If in doubt about the time server, follow the 2 substeps below, extracted from here1
2asudo apt-get install ntpdate
2bsudo ntpdate uk.pool.ntp.org
3Extracting from the instructions here1, the substep below
3asudo apt-get update && apt-get dist-upgrade
4I also ran sudo apt-get upgrade

Install LIRC

5sudo apt-get install lirc

Run the firmware update tool

6Instructions for the update tool are found here2
6asudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi_update && sudo chmod +x /usr/bin/rpi-update
7sudo rpi-update
The update tool will go away and eventually come back when the firmware is upgraded. This should now allow lirc to run

LIRC Basic configuration

8LIRC configuration instructions are here3
8aAdd the following lines to /etc/modules:
lirc_dev
lirc_rpi gpio_in_pin=23 gpio_out_pin=22

Getting the source

The easiest way to work out how to program for LIRC is to look at the source for the existing tools. This can be retrieved using the following command:

git clone git://lirc.git.sourceforge.net/gitroot/lirc/lirc

This unpacks the source into a subdirectory lirc under the current directory

External links

1http://www.raspbian.org/HexxehImages
2https://github.com/Hexxeh/rpi-update/
3http://www.raspberrypi.org/phpBB3/viewtopic.php?f=45&t=7798&start=75