Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


IR Remote Control with Lirc
#46
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
Reply


Messages In This Thread
IR Remote Control with Lirc - by FizzyTea - 05-16-2018, 04:56 PM
RE: IR Remote Control with Lirc - by FizzyTea - 05-16-2018, 05:00 PM
RE: IR Remote Control with Lirc - by remy1961 - 05-16-2018, 09:11 PM
RE: IR Remote Control with Lirc - by FizzyTea - 05-16-2018, 10:14 PM
RE: IR Remote Control with Lirc - by CallMeMike - 07-05-2023, 09:53 AM
RE: IR Remote Control with Lirc - by CallMeMike - 07-06-2023, 10:52 AM
RE: IR Remote Control with Lirc - by DRONE7 - 05-17-2018, 01:17 AM
RE: IR Remote Control with Lirc - by remy1961 - 05-17-2018, 03:37 AM
RE: IR Remote Control with Lirc - by Tim Curtis - 05-17-2018, 10:19 PM
RE: IR Remote Control with Lirc - by FizzyTea - 05-17-2018, 09:06 AM
RE: IR Remote Control with Lirc - by mezcal - 07-22-2018, 05:08 AM
RE: IR Remote Control with Lirc - by FizzyTea - 07-22-2018, 11:05 AM
RE: IR Remote Control with Lirc - by DRONE7 - 09-12-2018, 04:30 AM
RE: IR Remote Control with Lirc - by FizzyTea - 09-12-2018, 10:42 AM
RE: IR Remote Control with Lirc - by stosoorok - 10-21-2018, 03:05 PM
RE: IR Remote Control with Lirc - by frengo - 12-12-2018, 11:26 PM
RE: IR Remote Control with Lirc - by rh2018 - 12-24-2018, 12:07 PM
RE: IR Remote Control with Lirc - by stosoorok - 02-27-2019, 07:51 PM
RE: IR Remote Control with Lirc - by DRONE7 - 12-12-2018, 11:46 PM
RE: IR Remote Control with Lirc - by frengo - 12-13-2018, 01:05 AM
RE: IR Remote Control with Lirc - by DRONE7 - 12-13-2018, 05:57 AM
RE: IR Remote Control with Lirc - by rh2018 - 12-16-2018, 08:18 AM
RE: IR Remote Control with Lirc - by Cardone - 12-13-2018, 09:25 AM
RE: IR Remote Control with Lirc - by frengo - 12-14-2018, 11:52 PM
RE: IR Remote Control with Lirc - by DRONE7 - 12-15-2018, 01:24 AM
RE: IR Remote Control with Lirc - by frengo - 12-15-2018, 07:42 AM
RE: IR Remote Control with Lirc - by DRONE7 - 12-16-2018, 09:22 AM
RE: IR Remote Control with Lirc - by rh2018 - 12-16-2018, 12:24 PM
RE: IR Remote Control with Lirc - by dezotrk - 03-13-2019, 03:46 PM
RE: IR Remote Control with Lirc - by DRONE7 - 03-13-2019, 06:15 PM
RE: IR Remote Control with Lirc - by dezotrk - 03-15-2019, 06:45 PM
RE: IR Remote Control with Lirc - by IT-Andy52 - 03-18-2019, 11:07 AM
RE: IR Remote Control with Lirc - by DRONE7 - 03-19-2019, 02:21 AM
RE: IR Remote Control with Lirc - by IT-Andy52 - 03-19-2019, 09:05 AM
RE: IR Remote Control with Lirc - by DRONE7 - 03-19-2019, 09:40 AM
RE: IR Remote Control with Lirc - by rikardo1979 - 04-15-2019, 12:34 PM
RE: IR Remote Control with Lirc - by Cardone - 04-15-2019, 01:11 PM
RE: IR Remote Control with Lirc - by rikardo1979 - 04-15-2019, 01:21 PM
RE: IR Remote Control with Lirc - by Cardone - 04-15-2019, 02:02 PM
RE: IR Remote Control with Lirc - by rikardo1979 - 04-16-2019, 10:19 AM
RE: IR Remote Control with Lirc - by stosoorok - 04-17-2019, 06:37 PM
RE: IR Remote Control with Lirc - by remy1961 - 04-19-2019, 06:22 PM
RE: IR Remote Control with Lirc - by rikardo1979 - 04-19-2019, 06:49 PM
RE: IR Remote Control with Lirc - by TookaFace - 06-02-2019, 05:22 PM
RE: IR Remote Control with Lirc - by fedormil - 02-23-2020, 05:02 AM
RE: IR Remote Control with Lirc - by burph - 04-04-2020, 12:24 PM
RE: IR Remote Control with Lirc - by waffle - 04-26-2020, 05:41 PM
RE: IR Remote Control with Lirc - by KmPan - 02-07-2021, 03:45 AM
RE: IR Remote Control with Lirc - by gregvds - 03-09-2021, 03:25 PM
RE: IR Remote Control with Lirc - by mmcsn - 03-10-2021, 02:29 PM
RE: IR Remote Control with Lirc - by mmcsn - 03-10-2021, 02:50 PM
RE: IR Remote Control with Lirc - by KmPan - 03-28-2021, 04:49 AM
RE: IR Remote Control with Lirc - by mmcsn - 03-10-2021, 10:54 PM
RE: IR Remote Control with Lirc - by donutswdad - 03-27-2021, 01:21 AM
RE: IR Remote Control with Lirc - by waffle - 04-04-2023, 06:37 PM

Forum Jump: