FTDI USB IR Blaster / Transmitter using LIRC
Contents
Introduction
Many IR blasters (transmitters) are controlled by PC serial ports. As serial ports become harder to find on newer hardware, USB solutions are needed. This will describe using a USB transmitter from http://www.irblaster.info/usb_blaster.html. Despite what the web page says, the unit I received was NOT an FTDI FT232 based transmitter, but it was based on the better FTDI FT230X chip. It was found that the FT230X chip worked better than the FT232. And despite what the irblaster.info page says, you do not need to compile LIRC to use with Ubuntu 20.04. This page will describe using this transmitter in Ubuntu 20.04, and will also describe using the transmitter in a system that also uses a mceusb LIRC receiver.
Setup
- mceusb IR receiver plugged into USB port
- FTDI FT230 based IR blaster plugged into USB port
- Ubuntu 20.04
- LIRC version 0.10.1. Install these standard packages in Ubuntu (sudo apt install <packagename>): liblirc-client0, liblirc0, lirc, libftdi1-2, lirc-compat-remotes
- Both IR receiver and transmitter will be handled by LIRC. This means that two instances of lircd will be created by the configuration (reference https://www.lirc.org/html/configuration-guide.html#appendix-9).
LIRC Configuration
Essentially, for two different LIRC devices, you need two separate configuration files to describe the hardware and driver part.
MCEUSB receiver
The MCEUSB receivers are handled in the kernel, so the default driver is used. Edit /etc/lirc/lirc_options.conf as below:
[lircd] nodaemon = False driver = default device = /dev/lirc0 output = /var/run/lirc/lircd pidfile = /var/run/lirc/lircd.pid plugindir = /usr/lib/x86_64-linux-gnu/lirc/plugins permission = 666 allow-simulate = No repeat-max = 600
[lircmd] uinput = False nodaemon = False
NOTES: the linux user that runs may need to be part of the linux group that is the lirc dev is part of. So after a reboot, do a ls -la /dev/lirc*
to see the group that the lirc device belongs to, and add the running user to the group that the lirc device is part of. Also, the device may or may not be /dev/lirc0. Look at ls -la /dev/lirc*
and dmesg
to identify your MCEUSB receiver. Also, you may need to create the folder /var/run/lirc, but I am not 100% this was necessary.
Now, you need to copy /usr/share/lirc/remotes/mceusb/lircd.conf.mceusb to /etc/lirc/lircd.conf.d/ AND make sure the file name ends in a .conf (like mceusb.conf). By default, Ubuntu lirc will only load files in the /etc/lirc/lircd.conf.d directory that end in .conf. Also, rename the file /etc/lirc/lircd.conf.d/devinput.lirc.conf to devinput.lirc.conf.disable to disable this file (it is not used.)
FTDI USB Blaster / Transmitter
So, now that MCEUSB receiver has been configured, we need to configure the blaster. This will create a second lircd instance. The big thing is to identify the serial number and output of the blaster device. Look at dmesg
for the serial number. And you may have to just guess at the output number (mine was 2, but I think other websites using similar chips used 3). Since the blaster is FT230X based, we need to use the ftdix driver (if you have a FT232 based device, you would need to use the ftdi driver.) For Ubuntu 20.04, create a file /lib/systemd/system/lircd-blaster.service :
[Unit] Description=IR remote output Transmitter blaster After=network.target [Service] Type=simple ExecStart=/usr/sbin/lircd --driver=ftdix --device=serial=DN0563Z3,output=2 --output=/var/run/lirc/lircd-blaster --pidfile=/var/run/lirc/lircd-blaster.pid --nodaemon [Install] WantedBy=multi-user.target
Here is where I found the serial number in dmesg (you will need to replace the serial=XXXXX in /lib/systemd/system/lircd-blaster.service file with your specific serial number):
[ 1.943640] usb 1-5.4: new full-speed USB device number 6 using xhci_hcd [ 2.053457] usb 1-5.4: New USB device found, idVendor=0403, idProduct=6015, bcdDevice=10.00 [ 2.053472] usb 1-5.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 2.053473] usb 1-5.4: Product: FT230X Basic UART [ 2.053474] usb 1-5.4: Manufacturer: FTDI [ 2.053475] usb 1-5.4: SerialNumber: DN0563Z3
Now, you need to register the new lircd-blaster service with systemd
sudo systemctl daemon-reload
Then enable the service:
sudo systemctl enable lircd-blaster.service
Now, you need to put your satellite or cable box receiver configuration into /etc/lirc/lircd.conf.d/ with the file name ending in .conf My box is a Dish satellite box, so I used the lircd.conf configuration from DISHNetworkLIRCConfiguration and place that file as /etc/lirc/lircd.conf.d/dish.lircd.conf.
That will get the hardware working with LIRC. Do a shutdown (not reboot), then boot. Test MCEUSB with irw
, and create a channel change script pointing to /var/run/lirc/lircd-blaster to change your cable/satellite box channel.
Testing
- For MCEUSB, run
irw
and then point your MCE remote at the receiver, and push buttons. You should see button pushes being received by irw. - For the FTDI blaster, try the channel change script below, passing in the channel number as an command line argument. You will need to point the IR LED within a meter so of the receiver. I tape it directly in front of the receiver.
Integrate with MythTV
- Copy /usr/share/lirc/contrib/lircrc/mythtv.lircrc to the file ~/.mythtv/lircrc. This connects the mce codes to functions in mythfrontend. Those functions can be edited in the mythfrontend Settings->Edit Keys.
- In mythfrontend (v31), go to Settings->General->Remote Control, and set the LIRC Daemon Socket to /var/run/lirc/lircd, and then restart mythfrontend. This connects LIRC daemon to mythfrontend.
- For the channel change script, you will need to configure in MythBackend Setup, under Capture Card.
Channel change script
#!/bin/sh REMOTE_NAME=dish5 # from the dish.lircd.conf file in /etc/lirc/lircd.conf.d/ CHAN=$1 for digit in $(echo $CHAN | sed -e 's/./& /g'); do irsend --device=/var/run/lirc/lircd-blaster SEND_ONCE $REMOTE_NAME $digit sleep 0.4 # note, you may have to tweak the interdigit delay up a bit done