ir · lirc · raspberryPi 3

Recording ir Remote control codes with LIRC on the Pi 3

We have set up a pi-zero with a hifiberry DAC+ and installed squeezebox media server and a squeezlite player in our living room.

Since we would like to minimize the electricity being used at home I wanted to be able to turn our main amplifier on and off via the pi, allowing us to use the amp/pi-player as an alarm clock in the morning without having to leave the amp running all night.

I set up a pi3 with a breakout board in order to read and record our various remote control commands (power, switching inputs, volume). The circuit uses a 100ohm resistor and a tsop4838 ir receiver plus lirc/irrecord to capture the signals from our remote.

After building the circuit, install the software as follows.

Remote ssh into the pi 3 (ssh pi@stretch.local) and make sure that all packages are up to date:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install lirc
sudo vi /boot/config.txt ---> uncomment the lirc-rpi line (it was added by the install and tells you to uncomment it to enable the interface.)
sudo reboot

Once you reboot you will find that /dev/lirc0 has been created. Now you can run in what ever directory you’d like the files created in… I ran it in my home directory, giving each remote its own filename and then copied the files that were created into /etc/lirc/lircd.conf.d

irrecord -d /dev/lirc0 --disable-namespace

irrecord will prompt you to press various buttons on your remote as well as to name the buttons that it is about to record. By using the disable-namespace option you can create your own custom names; without that option you need to use standard keynames which can be found in the file:

/etc/lirc/lircd.conf.d/devinput.lircd.conf

Standard names are probably best if you are trying to interact with media center type software. Since I am simply trying to record the keys in order to programatically turn my amp and TV on and off with the pi, I’m sticking with my custom key names.

Info:

Original circuit and instructions: Ben Heck’s Raspberry Pi Media Center

Additional/ better circuit diagram: using a pi as a universal remote

 

Leave a Reply