Introduction: Record Infrared Codes of Any Remote Control Unit for Usage With Linux Infrared Remote Control (LIRC) on Raspberry Pi's GPIO-based Infrared Receiver

About: Systems Administrator and Software Programmer.


The remote controls that are orphaned when the device they control stopped working are reusable on your Raspberry Pi. After completing this instructable, you may be interested in trying out the following instructables:

Reuse Unwanted Remote Control to Shutdown and Reboot Raspberry Pi

Reuse Unwanted Remote to Launch Graphical Application in Raspberry Pi


This instructable will show how to use program irrecord to:

  1. Capture infrared codes of any remote control
  2. Map the infrared codes with Linux Infrared Remote Control (LIRC) events

Target Readers

Anyone with Raspberry Pi that has infrared (IR) interface)

Any remote control

Step 1: Install and Configure LIRC Daemon

Complete the steps in "Install and configure LIRC Daemon" instructable.

Step 2: Test Whether the Remote Control Unit Is Transmitting Any IR Signal

Complete the steps in my instructable "Use Raspberry Pi To Test Your Remote Control"

Step 3: Record Infrared (IR) Codes of the Remote Control and Map It to LIRC Events

Get your remote control unit ready

Open terminal emulator of Raspberry Pi.

Stop the LIRC daemon

$sudo service lirc stop
$cd ~

Run the program irrecord

$irrecord -d /dev/lirc0 my_remote_control.conf 

When the irrecord program wizard ask you to map key names, open another terminal emulator and list all the possible key names available in LIRC so that you can choose the best one that fits your requirement. The output of the command below is shown in the screenshot

$irrecord --list-namespace

Finally, the irrecord program will process your input and create a configuration file ~/my_remote_control.conf as shown in the third screenshot.