LircPi : nieuw apparaat bedienen met een stokoude afstandsbediening


The project got started after a friend remarked that he could not find  vhs-players of a particular model and brand anymore. Before, I have helped him getting such machines going again, but given their age it is not surprising that more and more of them gave up. He needed these players for his partner who is not really capable or learning how to work with other remotes.At some point, I realized that he could use the old remote control with newer equipment — in particular the more modern hard disk players — when the buttons on the old remote control would send the appropriate codes to the new equipment. This is where the open source Linux Infrared Remote Control software comes in. The name is commonly abbreviated to LIRC. It runs on many platforms but for this project I chose the Raspberry Pi, abbreviated as RPi, as I have already some experience with it.

Choice of software

Setting up the software on the Raspberry Pi is reasonably straightforward. Alex Bain described it in a detailed write-up. The settings and connections are identical to those described in the article. The only thing one should do in advance, is to bring the operating system on the RPi up to date. How to do this is described in the online Raspbian documentation.

Electronic circuitry

But before one may proceed, some hardware needs to be constructed. The essence is to connect an IR light emitting diode to send the commands to a device such as a hard disk player and a photo diode to receive the commands from the remote control. In principle, these components needed are relatively simple and can be obtained off the shelf. However, the outer appearance is also important and after some browsing the internet, a decent looking IR extender set was found that did not cost a lot. The hope was that the electronic circuitry that was in the gadgets could be used. Unfortunately, that was not the case although if one insisted one might adapt the circuitry – at the cost of more components – to use the gadgets without modification. In the present case, they needed to be opened to analyze the connections and so it was not a main effort to modify as well. Connectors are the commonly used 3.5 mm stereo jack plugs.

Below the electronic diagram. Top right the IR sender with the diode from the gadget but with another transistor and two resistors. P5 connects to the board in the RPi casing on the left. For ease of mounting we took SMD transistor and resistors. The supply voltage is 5 Volts nominal value and the resistor R3 limits the current through the photo diode. Its value is 39 Ω which implies a current of about 128 mA at maximum. This is only during ON time which is during short pulses. The resistor R4 limits the base current for the transistor in case of erroneous connection.

The electronic diagram for the IR receiver is on the bottom right and is even simpler as most of the electronics is inside the device, the commonly used TSOP4838.


The board in the RPi looks more daunting, see the left side of the above diagram. This is however more due to the complex wiring of the GPIO adapter of the RPi than due to the necessary electronics. In essence, to couple the input of the GPIO that operates at 3.3 Volts to an external output operating at 5 Volts — or vice versa — a double diode network with pull up resistor to 3.3 Volts is added.  There is really no more to it. The below photo shows the printed circuit board that is soldered to the 28 pin GPIO connector and held in place by an M3 screw. On the right side the two jacks for sender and receiver are barely visible, they are mounted on the back side of the board. On the left side one sees a 5 pin connector that was added for service and connects to the serial transmission/reception pins on the GPIO; these are not shown on the diagram.

The board is a very simple standard printed circuit board with holes in a 0.1 inch pattern and copper islands around each hole. Also here we used SMD components and thin wire to construct the circuitry on the copper side of the board. The wire is enamel coated copper of which the coating disintegrates when heated in the presence of solder and flux.


The complete assembly, where holes are made in the RPi casing to admit the 3.5 mm jacks, is shown below. Apart from the SD-card and the power cable no other connections are necessary for normal operation.


Software installation

Before one may use the LircPi, first the remote control devices of the old instrument and the target instrument need to be made known to the system. This is amply described by the before mentioned Alex Bain in his detailed write-up. Upon completion of this procedure, one should be able to receive signals from the remote control and to control the equipment using software. What is missing, is the connecting software.

The essence is the use of a tool that comes with the LIRC called IREXEC; it is described on the relevant LIRC page. Basically, for each command that the old remote can transmit (and that we wish to use) we have a few lines as given below. The first part specifies the button that is received.  In this case, the remote control is a Philips. The button monitored is the SLEEP key.

 remote = Philips_VR175
 button = KEY_SLEEP
 prog = irexec
 repeat = 0
 config = irsend SEND_ONCE Panasonic_EUR7729KC0 KEY_POWER 
  && echo "Standby"

The second part specifies the action to be taken. It calls the IRSEND program so emit the POWER signal to the remote of a Panasonic player. To assist in monitoring the performance, it also sends the message “Standby” to the standard screen.  Note the double ampersand sign that allows one to concatenate commands. The IRSEND program is also described on a relevant LIRC page.

The whole series of instructions is written to a file that might be called irexec_config so that the command to run it reads

sudo irexec /home/pi/irexec_conf

In order to make this process run upon startup without user intervention, one creates a crontab entry as

@reboot sudo irexec /home/pi/irexec_conf

Personally, Iprefer to invoke a program called “screen” to be able to monitor progress when the RPi is not directly connected to a display.

@reboot screen -d -m sudo irexec /home/pi/irexec_conf

The advantage is that it can keep track of the latest commands sent and will display on a screen once connected. A sufficient description of the program and its installation is given on RasPi.TV. It discusses the program from the point of view of using SSH to communicate by internet, for instance using Putty, but use of the serial connection will also work.

In principle, the gadget can work with connections to the devices doing the IR transmission, emitter and receiver, and with a power cable. It might run for continuously for  quite some time on a 5V power pack that is only once in a while connected to power.

Een gedachte over “LircPi : nieuw apparaat bedienen met een stokoude afstandsbediening”

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *