Raspberry Pi 2 / Kodi remote control with LIRC
Here is how you get any control remote, old or new, to work with OSMC/Kodi on the raspberry pi 2, or any other raspberry really.
A while ago i bought myself a Raspberry Pi 2 Model B with the intension to make my home media center.
One of the first things you are faced with is how to control it without having a keyboard attached to it all the time, there are two ways, the android app Kore which i actually recommend, its specially good to deal with your media and for text input.
An ordinary IR remote control
Another way is to use an ordinary IR remote control, you can use an old remote control or in my case i just use the control remote from the TV itself, because usually this controls came with extra buttons meant to be used with dvd players or other stuff, so i just have the same remote to control both TV and my media center thus avoiding the usual mess of having 3 or 4 remotes....
The sensor
The first thing to do is to get a sensor that can read our remote IR signal, in this LINK we can see a list of sensors known to work with LIRC, i am using the TSOP 4830 which is not on that list but i can confirm it also works with my panasonic remote has it should for others. Next we need a 120 Ω resistor a 100 nF capacitor some wires and some female pin headers like in the picture :
Now you should connect the 100 nF between Vs(supply voltage) and GND, and the resistor should be on the output pin like in the picture:
Next put some nice thermal shrink isolator on all pins and connectors :
Connecting the sensor to the PI
We now have a GND, POWER and input pin, and according to the Raspberry PI pin out :
We will connect :
TSOP4830 Raspberry Pi PIN 1 ---> PIN 12 (GPIO18) PIN 2 ---> PIN 6 (GND) PIN 3 ---> PIN 1 (3.3V)
Now stick the sensor in front of the TV :
Configuring the remote with LIRC.
OSMC/Kodi uses the software LIRC to configure and control the media center. So we already have our sensor attatched to the raspberry now we are going to need an IR remote control and a laptop.
We need to connect into the raspberry thru SSH access, you can do this by simply open a terminal window in any UNIX system or if you are using Microsoft Windows you should then use Putty.
Because i will be using Linux i will use the word terminal.
So open a terminal and type in the command :
ssh This email address is being protected from spambots. You need JavaScript enabled to view it.
The default user and pass is : osmc.
Next in order to use IRRECORD which is a part of LIRC, we need to shut LIRC down with the command :
sudo systemctl stop eventlircd.service
We now start using IRRECORD with the command :
sudo irrecord -d /dev/lirc0 ./panasonic_rm.conf
Where panasonic_rm is the name i gave it based on my remote, you might want to change this name but it will always have to end in .conf.
Now you will have to follow what IRRECORD will ask from you, which should be pretty basic.
- Press several buttons from the remote randomly for 1 second each.
- Insert the name of the key you want to configure, but only valid key names will be accepted, to get a list of valid buttons open another terminal and get in the raspberry again with SSH like shown before and put in the command,
irrecord --list-namespace | less
Once you finished with the keys, instead of putting another key just hit RETURN to finish this process. - Press the same key several times until you get a message of Success.
Now the IRRECORD process is done and we have file named panasonic_rm.conf in the current folder which should be the home folder.
We now need to copy our file over to the correct folder so that LIRC can see it, with the command :
sudo cp panasonic_rm.conf /etc/lirc/
The final step, inside OSMC/Kodi, go to SYSTEM-->My OSMC-->Remotes, there you scroll until you find our file panasonic_rm.conf, press RETURN and confirm.
This should take effect immediatly but somtimes it doesn't, in that case just reboot the system.
Success there you are, Have Fun.
Finally i made a small video showing some configuration.