Notes to make IR shield (made by LinkSprite) work in Raspberry Pi 3 - Raspbian Buster (bought from Amazon [1]) such that the device can both send and receive without re-configuring the operating system.
The big different with the newer infrared control configuration is that there are two separate devices /dev/lirc0 and /dev/lirc1, where /dev/lirc0 is used for transmitting, and /dev/lirc1 is used for receiving, whereas previous releases used /dev/lirc0 for both receive and send.
Install Drivers
Ensure the operating system is up-to-date and install the lirc driver:
$ sudo apt-get update
$ sudo apt-get install lirc
$ sudo apt-get install lirc
Upgrade to Latest
Following the base install, optionally, install the latest driver from Sourceforge, then unpack and install:
$ sudo apt-get update
$ sudo apt-get remove lirc liblirc0 liblirc-client0
$ sudo su -c "grep '^deb ' /etc/apt/sources.list | sed 's/^deb/deb-src/g' > /etc/apt/sources.list.d/deb-src.list"
$ sudo apt-get install -y vim devscripts dh-exec doxygen expect libasound2-dev libftdi1-dev libsystemd-dev libudev-dev libusb-1.0-0-dev libusb-dev man2html-base portaudio19-dev socat xsltproc python3-yaml dh-python libx11-dev python3-dev python3-setuptools
$ bzip2 -d lirc-0.10.2.tar.bz2 | tar xvf -
$ cd lirc-0.10.2
$ ./configure --prefix=
$ make
$ sudo make install
$ sudo lirc-postinstall
$ sudo systemctl unmask lircd
$ sudo systemctl enable lircd
Note: the --prefix= ensures that the lircd is installed in the same place as the one from the distribution, using configuration in /etc/lirc for example (don't use --prefix=/ as although it works for /etc and /sbin, it doesn't work for all folders, resulting in some paths referred to with //). This approach means that the files will be found in a consistent place, and programs like irsend will work without modification.
Note: it is likely that you will need this if the base install is running lirc-0.10.1 (lircd --version to check).
Configure Driver
# Update the following lines in /boot/config.txt
# uncomment if required, and ensure the pins match your hardware
dtoverlay=gpio-ir,gpio_pin=18
dtoverlay=gpio-ir-tx,gpio_pin=17
# Reboot before testing
$ reboot
# Verify that the drivers are loaded and note the Transmitter Minor No.
$ dmesg | grep lirc
[ 11.405832] rc rc0: lirc_dev: driver gpio-ir-tx registered at minor = 0, no receiver, raw IR transmitter[ 11.482044] rc rc1: lirc_dev: driver gpio_ir_recv registered at minor = 1, raw IR receiver, no transmitter
# Check the corresponding devices are there, and note the minor number to identify which is the transmitter device
# Note that there are two unidirectional devices, not a single bi-directional device.
$ ls -la /dev/lirc*
crw-rw---- 1 root video 251, 0 Dec 17 09:17 /dev/lirc0crw-rw---- 1 root video 251, 1 Dec 17 09:17 /dev/lirc1
# Update / Verify the following lines in /etc/lirc/lirc_options.conf to reflect the 'Transmitter'
driver = defaultdevice = /dev/lirc0
$ sudo systemctl restart lircd
Set up a User's Account
Log in as any user (in this case 'admin') and run the config tool
$ lirc-config-tool
Output dir:/home/admin/.config/lircScanned /etc/lirc/lircd.confFound 0 key symbols.Created:mode_browser.lircrcmode_numeric.lircrcmplayer.lircrcmythtv.lircrcvlc.lircrcvlc_popupmenu_mode.lircrcvolume_alsa.lircrcvolume_mythtv.lircrcvolume_pulse.lircrc
Test Receiving
Note: This does not require the use of the lircd service - it accesses the /dev/lirc1 device directly.
# Test Receipt - Point remote at receiver and press buttons
$ mode2 -d /dev/lirc1
pulse xxxspace xxxpulse xxxspace xxx
Capture a Remote
# Run irrecord to capture the configuration of a remote
$ irrrecord -d /dev/lirc1
# Please take the time to finish this file as described in
# https://sourceforge.net/p/lirc-remotes/wiki/Checklist/
# and make it available to others by sending it to
# <lirc@bartelmus.de>
#
# This config file was automatically generated
# using lirc-0.10.1(default) on Sat Dec 17 10:59:09 2022
# Command line used: -d /dev/lirc1
# Kernel version (uname -r): 5.15.61-v7+
#
# Remote name (as of config file): Denon-RC-1214
# Brand of remote device, the thing you hold in your hand:
# Remote device model nr:
# Remote device info url:
# Does remote device has a bundled capture device e. g., a
# usb dongle? :
# For bundled USB devices: usb vendor id, product id
# and device string (use dmesg or lsusb):
# Type of device controlled
# (TV, VCR, Audio, DVD, Satellite, Cable, HTPC, ...) :
# Device(s) controlled by this remote:
begin remote
name Denon-RC-1214
bits 24
flags SPACE_ENC
eps 30
aeps 100
header 3539 1649
one 479 1200
zero 479 364
ptrail 480
pre_data_bits 24
pre_data 0x2A4C0A
gap 50552
toggle_bit_mask 0x0
frequency 38000
begin codes
KEY_POWER 0x8C0284
KEY_VOLUMEUP 0x82028A
KEY_VOLUMEDOWN 0x8A0282
.....
end codes
end remote
# Copy the created conf file into /etc/lirc/lircd.conf.d
$ sudo cp Denon-RC-1214.conf /etc/lirc/lircd.conf.d
Test Sending
Sending the sequences uses the lircd service.# Instruct the IR module to send a previously recorded
$ irsend send_once "Denon-RC-1214" KEY_POWER
Gotchas
do_connect: could not connect to socket
connect: Connection refused
Cannot open socket /dev/lirc0: Connection refused
1. Check the Modules are Loaded
$ sudo dmesg | grep lirc[ 9.204970] rc rc1: lirc_dev: driver gpio-ir-tx registered at minor = 0, no receiver, raw IR transmitter
[ 9.272018] rc rc0: lirc_dev: driver gpio_ir_recv registered at minor = 1, raw IR receiver, no transmitter
2. Check the device driver is installed
$ ls -la /dev/lirc*crw-rw---- 1 root video 251, 0 Dec 18 17:37 /dev/lirc0
crw-rw---- 1 root video 251, 1 Dec 18 17:37 /dev/lirc1
3. Check the service is running.
$ ps -ef | grep lircdroot 525 1 0 17:38 ? 00:00:00 /usr/sbin/lircd --nodaemon
4. Check the account has been configured
$ ls -la ~/.config/lirctotal 52
drwxr-xr-x 2 admin admin 4096 Dec 18 17:51 .
drwxr-xr-x 3 admin admin 4096 Dec 18 17:51 ..
-rw-r--r-- 1 admin admin 4959 Dec 18 17:51 mode_browser.lircrc
-rw-r--r-- 1 admin admin 1848 Dec 18 17:51 mode_numeric.lircrc
-rw-r--r-- 1 admin admin 2479 Dec 18 17:51 mplayer.lircrc
-rw-r--r-- 1 admin admin 4397 Dec 18 17:51 mythtv.lircrc
-rw-r--r-- 1 admin admin 2667 Dec 18 17:51 vlc.lircrc
-rw-r--r-- 1 admin admin 1540 Dec 18 17:51 vlc_popupmenu_mode.lircrc
-rw-r--r-- 1 admin admin 448 Dec 18 17:51 volume_alsa.lircrc
-rw-r--r-- 1 admin admin 298 Dec 18 17:51 volume_mythtv.lircrc
-rw-r--r-- 1 admin admin 683 Dec 18 17:51 volume_pulse.lircrc
5. Check the Syslog
# Verify no errors, and that lircd is the correct version
$ sudo grep lirc /etc/syslog | tail -200
Dec 22 06:22:44 fuse lircd-0.10.2[520]: Notice: /etc/lirc/lircd.conf.d/devinput.lircd.conf: devinput-32: Multiple values for same code: BTN_TRIGGERDec 22 06:22:44 fuse lircd-0.10.2[520]: Notice: /etc/lirc/lircd.conf.d/devinput.lircd.conf: devinput-32: Multiple values for same code: BTN_TRIGGER_HAPPY1Dec 22 06:22:44 fuse lircd-0.10.2[520]: Notice: /etc/lirc/lircd.conf.d/devinput.lircd.conf: devinput-32: Multiple values for same code: BTN_WHEELDec 22 06:22:44 fuse lircd[520]: lircd-0.10.2[520]: Notice: lircd(default) ready, using /var/run/lirc/lircdDec 22 06:22:44 fuse lircd-0.10.2[520]: Notice: lircd(default) ready, using /var/run/lirc/lircdDec 22 06:24:49 fuse lircd[520]: lircd-0.10.2[520]: Notice: accepted new client on /var/run/lirc/lircdDec 22 06:24:49 fuse lircd-0.10.2[520]: Notice: accepted new client on /var/run/lirc/lircdDec 22 06:24:49 fuse lircd[520]: lircd-0.10.2[520]: Info: Cannot configure the rc device for /dev/lirc0Dec 22 06:24:49 fuse irsend: lirc_command_run: Sending: send_once rc-1214 ext_offDec 22 06:24:49 fuse lircd-0.10.2[520]: Info: Cannot configure the rc device for /dev/lirc0Dec 22 06:24:49 fuse irsend: lirc_command_run, state: 0, input: "BEGIN"Dec 22 06:24:49 fuse irsend: lirc_command_run, state: 1, input: "send_once rc-1214 ext_off"Dec 22 06:24:49 fuse irsend: lirc_command_run, state: 2, input: "SUCCESS"Dec 22 06:24:49 fuse lircd[520]: lircd-0.10.2[520]: Info: removed clientDec 22 06:24:49 fuse irsend: lirc_command_run, state: 3, input: "END"Dec 22 06:24:49 fuse irsend: lirc_command_run: data:END, status:0
[1] https://www.amazon.com/Infrared-Shield-for-Raspberry-Pi/dp/B00K2IICKK/ref=pd_sbs_328_1?_encoding=UTF8&psc=1&refRID=1QPY33VFCGETBJ17K8QE
[2] http://learn.linksprite.com/raspberry-pi/shield/infrared-transceiver-on-raspberry-pi-lirc-software-installation-and-configuration/
[2] http://learn.linksprite.com/raspberry-pi/shield/infrared-transceiver-on-raspberry-pi-lirc-software-installation-and-configuration/