Raspberry Pi: Connecting any old IR Remote Control

Friday 28th July 2017 3:37am

LIRC – Linux Infrared Remote Control

LIRC is a mature and stable open source library that provides the ability to send and receive IR commands. LIRC support is now included by default in the latest version of Raspbian OS.

Wiring the Infra-Red Receiver to the Raspberry Pi

Vishay TSOP31438 wiring is on the picture.
Receiver Pin 1 is DATA, goes to RPi pin 12 (GPIO 18)
Receiver Pin 2 is GND, goes to RPI pin 6 (GROUND)
Recevier Pin 3 is POWER, goes RPi pin 1 (3.3V)

IR Remote Wiring

IR Remote Wiring

Connect to the raspberry pi using SSH (I use putty) and type hostname as raspbmc connecting to port 22 and then click ‘Open’ if you get a security warning click onto ‘Yes’ to except. This will present a shell command on the raspberry pi. Login using the default settings username pi and password raspberry.

At the command prompt type:

irrecord --list-namespace

This will display a list of available names used to record the keystrokes sent from the IR remote control. Compare the names in this list to the buttons on your remote once you have a list of names that correspond with the buttons we are ready to begin mapping. At the command prompt type:

sudo /etc/init.d/lirc stop

This stops the lirc service to free up /dev/lirc0

Type the following to start recording of key presses:

irrecord –d /dev/lirc0 ~/lircd.conf
LIRC Config

LIRC Config

Press Return to start recording of key strokes.

Type the name of each key stroke followed by the return key.


Now point the remote press and hold the corresponding button:

Record LIRC

Record LIRC

Do this for each button in turn. Once you have finished press ‘Return’ this will save the new configuration file.

Next we make a copy of the old lircd.conf file:

sudo cp lircd.conf lircd-old.conf

Now delete the old lircd.conf file:

sudo rm lircd.conf

Make a copy of the lircd.conf.conf file:

sudo cp lircd.conf.conf lircd.conf

Now delete the old lircd.conf.conf file:

sudo rm lircd.conf.conf

Reboot to apply the new changes:

sudo reboot

When the raspberry pi reboots wait for the lirc connection to apply and now your remote should start working.

FB Like & Share