Now that the Moode 6.5.0 is released and I had to reinstall lirc, I thought I'd share an up-to-date guide.
At the time of writing the current lirc version is 0.10.1
Guide updated for
Moode 8.3.0. Current lirc version is
0.10.2.
Setup
1. Install lirc:
Code:
sudo apt-get update
sudo apt-get install -y lirc
2. Navigate to lirc directory and disable the devinput driver config:
Code:
cd /etc/lirc
sudo mv ./lircd.conf.d/devinput.lircd.conf ./lircd.conf.d/devinput.lircd.conf.dist
3. Set up the hardware
Open
lirc_options.conf:
Code:
sudo nano lirc_options.conf
And replace
Code:
driver = devinput
device = auto
with
Code:
driver = default
device = /dev/lirc0
4. Set the input pin you want to use
Open
/boot/config.txt:
Code:
sudo nano /boot/config.txt
And add this line at the end (replace 25 with whichever gpio pin you use):
Code:
dtoverlay=gpio-ir,gpio_pin=25
5. Set up the
irexec service to start on boot:
Code:
sudo systemctl enable irexec
6. Reboot
Usage
All your remotes are stored in
/etc/lirc/lircd.conf.d/ directory.
You can have multiple configuration files for different remotes:
Code:
ls /etc/lirc/lircd.conf.d/
KNOB.lircd.conf RC-5330.lircd.conf RM-860.lircd.conf
These files contain remote-specific protocol information and translate IR codes to user-defined key codes:
Code:
KEY_POWER 0x0EFB38
KEY_UP 0x0EFBA7
KEY_DOWN 0x0EFBA6
These key codes are then used in
irexec.lircrc file to map button presses to actions (see
The lircrc file format)
Code:
begin
prog = irexec
button = KEY_POWER
config = python /home/pi/scripts/shutdown.py
end
begin
prog = irexec
button = KEY_UP
repeat = 1
delay = 2
config = mpc volume +5
end
You can get remote configuration files from the
remotes database, or you can record them manually using the
irrecord utility:
1. Stop the
lircd service:
Code:
sudo systemctl stop lircd
2. Run
irrecord and follow the instructions, the generated file will be saved as
/home/pi/myremote.lircd.conf:
Code:
irrecord -n -d /dev/lirc0 ~/myremote.lircd.conf
3. Copy the file to lirc remotes directory:
Code:
sudo cp /home/pi/myremote.lircd.conf /etc/lirc/lircd.conf.d/myremote.lircd.conf
After adding your remotes and configuring the
lircrc file, restart
lircd and
irexec services:
Code:
sudo systemctl restart lircd
sudo systemctl restart irexec