Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to set up LIRC on Raspbian Buster (2019, 4.x kernel)

Infrared and LIRC

Beware: These instructions have been cobbled together from all of the sources I found that got my specific unit working. I can verify it works on a Pi 3B running the latest OS as of summer 2019. Everyone's hardware and system will be a bit different so your mileage may vary. Before you go crazy trying to debug issues sending a signal, grab an existing lirc config for any remote and use the lirc CLI to send a signal out and verify your hardware is sending the signal by viewing the IR LED through a front-facing smartphone camera (almost all smartphone front cameras - even new iPhones - will not filter out IR light and you should see the LED flash when sending a signal). If you see your hardware is sending a signal and/or you can see that the IR input is seeing some signal, then you know your setup works and the issue may be that the remote you're trying to learn simply won't work with LIRC. I know for a fact that many Comcast/Xfinity cable remotes are actually RF devices and need to have IR mode turned on manually. Furthermore, I know for a fact that some TV and cable box remotes, for whatever reason, are too complex to work with LIRC. Try a very very simple remote before moving on to fancier devices.

In 2019 lirc_rpi, the Linux kernel module provided with Raspbian before, was replaced with gpio-ir and gpio-ir-tx. This tutorial is updated for Raspbian Buster. If you need to setup ANAVI Infrared pHAT on an older version of Raspbian, for example from 2018-04-18, please have a look at the old user's manual.

Setting up LIRC

Perform the steps below to build LIRC from source, to patch it and to enable the infrared receiver and transmitter on ANAVI Infrared pHAT:

  • Install dependencies
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 update
sudo apt 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
  • Download LIRC source code
mkdir ~/lirc-src
cd ~/lirc-src
apt source lirc
  • Apply a patch to fix LIRC for Raspberry Pi
wget https://raw.githubusercontent.com/neuralassembly/raspi/master/lirc-gpio-ir-0.10.patch
patch -p0 -i lirc-gpio-ir-0.10.patch
cd lirc-0.10.1
debuild -uc -us -b
  • Install LIRC (built on the previous step)
cd ~/lirc-src
sudo apt install ./liblirc0_0.10.1-5.2_armhf.deb ./liblircclient0_0.10.1-5.2_armhf.deb ./lirc_0.10.1-5.2_armhf.deb

NOTE: the installation is expected to fail the first time when you run it. After applying changes to some configurations LIRC will be installed again in the next steps.

  • Deploy LIRC configurations:
sudo cp /etc/lirc/lirc_options.conf.dist /etc/lirc/lirc_options.conf
sudo cp /etc/lirc/lircd.conf.dist /etc/lirc/lircd.conf
  • Edit /etc/lirc/lirc_options.conf and make sure that driver and device are set as:
driver          = default
device          = /dev/lirc1

NOTE: Device /dev/lirc1 is the receiver and device /dev/lirc0 is the transmitter. Initially /dev/lirc1 is used to scan a remote control. After that the configuration has to be updated to /dev/lirc0 in order to send infrared commands.

  • Edit /boot/config.txt (with sudo or as root) and configure kernel extensions by adding the following line to the end of the file:
dtoverlay=gpio-ir,gpio_pin=18
dtoverlay=gpio-ir-tx,gpio_pin=17
  • Run the LIRC installation again:
cd ~/lirc-src
sudo apt install -y --allow-downgrades ./liblirc0_0.10.1-5.2_armhf.deb ./liblircclient0_0.10.1-5.2_armhf.deb ./lirc_0.10.1-5.2_armhf.deb
  • Reboot Raspberry Pi:
sudo shutdown -r 0

Using IR Receiver

Follow the steps below to verify that the IR receiver is working as expected:

  • Stop LIRC systemd service:
sudo systemctl stop lircd
  • Start outputting raw data from the IR receiver
mode2 -d /dev/lirc1
  • Point a remote control at the IR receiver on ANAVI Infrared pHAT and press its buttons. If the IR receiver is configured successfully you will see similar output:
space 3662230
pulse 2428
space 594
pulse 1201
space 596
pulse 1230
space 595
pulse 1209
space 590
pulse 1204

Using IR LED

Follow the steps below to create LIRC configuration file and test the infrared transmitter:

  • Stop LIRC systemd service
sudo systemctl stop lircd
  • List all available names for buttons supported by LIRC:
irrecord --list-namespace
  • Type in the following command to create new LIRC control configuration file and follow the on screen instructions to scan a remote control:
irrecord -d /dev/lirc1 ~/lircd.conf

Example configuration output with name hifi:

Using driver default on device /dev/lirc1

irrecord -  application for recording IR-codes for usage with lirc
Copyright (C) 1998,1999 Christoph Bartelmus(lirc@bartelmus.de)

This program will record the signals from your remote control
and create a config file for lircd.

A proper config file for lircd is maybe the most vital part of this
package, so you should invest some time to create a working config
file. Although I put a good deal of effort in this program it is often
not possible to automatically recognize all features of a remote
control. Often short-comings of the receiver hardware make it nearly
impossible. If you have problems to create a config file READ THE
DOCUMENTATION at https://sf.net/p/lirc-remotes/wiki

If there already is a remote control of the same brand available at
http://sf.net/p/lirc-remotes you might want to try using such a
remote as a template. The config files already contains all
parameters of the protocol used by remotes of a certain brand and
knowing these parameters makes the job of this program much
easier. There are also template files for the most common protocols
available. Templates can be downloaded using irdb-get(1). You use a
template file by providing the path of the file as a command line
parameter.

Please take the time to finish the file as described in
https://sourceforge.net/p/lirc-remotes/wiki/Checklist/ an send it
to  <lirc@bartelmus.de> so it can be made available to others.

Press RETURN to continue.

Checking for ambient light  creating too much disturbances.
Please don't press any buttons, just wait a few seconds...

No significant noise (received 0 bytes)

Enter name of remote (only ascii, no spaces) :hifi
Using hifi.lircd.conf as output filename

Now start pressing buttons on your remote control.

It is very important that you press many different buttons randomly
and hold them down for approximately one second. Each button should
generate at least one dot but never more than ten dots of output.
Don't stop pressing buttons until two lines of dots (2x80) have
been generated.

Press RETURN now to start recording.
................................................................................
Got gap (45034 us)}

Please keep on pressing buttons like described above.
...............................................................................

Please enter the name for the next button (press <ENTER> to finish recording)
KEY_POWER

Now hold down button "KEY_POWER".

Please enter the name for the next button (press <ENTER> to finish recording)

Checking for toggle bit mask.
Please press an arbitrary button repeatedly as fast as possible.
Make sure you keep pressing the SAME button and that you DON'T HOLD
the button down!.
If you can't see any dots appear, wait a bit between button presses.

Press RETURN to continue.
..............................Cannot find any toggle mask.
You have only recorded one button in a non-raw configuration file.
This file doesn't really make much sense, you should record at
least two or three buttons to get meaningful results. You can add
more buttons next time you run irrecord.


Successfully written config file hifi.lircd.conf
  • Backup the original LIRC configuration file:
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd-backup.conf
  • Load the new configuration file, for example:

NOTE: The name of configuration depends on the selected name of remote. Please adapt the command below depending on your name of remote!

sudo mv hifi.lircd.conf /etc/lirc/lircd.conf
  • Switch LIRC configurations to the device for transmitting. Edit again /etc/lirc/lirc_options.conf and make sure that driver and device are set as:
driver          = default
device          = /dev/lirc0

NOTE: In this case the device is /dev/lirc0.

  • Launch LIRC systemd service again:
sudo systemctl start lircd
  • List all saved keys, for example:

NOTE: Please adapt the command below depending on your name of remote!

irsend LIST hifi ""
    • Test the configuration file by sending recorded IR command, for example POWER (please note the exact command may vary for different LIRC configuration files, IR devices and IR remote controls):

NOTE: Please adapt the command below depending on your name of remote!

irsend SEND_ONCE hifi KEY_POWER

NOTE: Please keep in mind that in rare cases some devices might require codes to be sent in short bursts, for example:

irsend send_once hifi KEY_POWER KEY_POWER KEY_POWER
@Cuzart

This comment has been minimized.

Copy link

@Cuzart Cuzart commented Feb 5, 2020

Worked out for me thanks mate very helpful !

@billpatrianakos

This comment has been minimized.

Copy link
Owner Author

@billpatrianakos billpatrianakos commented Feb 5, 2020

@Cuzart

This comment has been minimized.

Copy link

@Cuzart Cuzart commented Feb 6, 2020

@jimkou

This comment has been minimized.

Copy link

@jimkou jimkou commented Apr 23, 2020

Μπράβο πολύ καλή δουλειά.

@jimkou

This comment has been minimized.

Copy link

@jimkou jimkou commented Apr 25, 2020

if you have problems with irrecord on raspberry pi 4 like i had you can use pigpiod better..It worked to me much better because on lirc recordings with irrecord didn't go as expected.

https://lifeonroom.com/en/diy-2/aricon-on-using-pigpio-2/

@Matt-K3

This comment has been minimized.

Copy link

@Matt-K3 Matt-K3 commented Jun 2, 2020

Hi mate,

Firstly thanks for the tutorial, doing this kind of work really helps the community and gets noobs like me up to speed faster, very much appreciated.

I'm having issues getting IR send and receive work on Pi (I'm on Buster, on Pi Model B 3 Rev 1.2). I have an Energenie Pi-Mote IR control board. I tried following the instructions from the energenie page, no luck (wouldn't record or register an input code), then I tried following the instructions on the instructables website, again no luck.

Finally I searched for instructions that were specific to Buster, given that I read that there had been kernel updates that may affect how lirc works. I came across your post/tutorial. I have followed it to the letter (with one issue), and am now able to run the mode2 -d /dev/lirc1 command and at least am told that "Using device", though.. I still can't seem to record/detect IR signals when shining an IR remote at the sensor at the energenie board.

I'm wondering if it's related to an error I received while trying to deploy the lirc configurations (I think the lirc_options.conf file couldn't be found). Or perhaps the error when I try to run the lirc install again... error message attached in file.

I don't suppose I could ask for a bit of support/advice/guidance could I?? I'm tearing out my hair with all of this!! :-)

Any help very much appreciated, cheers, Matt

Instructables:
https://www.instructables.com/id/Setup-IR-Remote-Control-Using-LIRC-for-the-Raspber/

energenie page:
https://energenie4u.co.uk/res/pdfs/ENER314-IR_User_guide_V3.pdf

Screenshot 2020-06-02 at 23 40 48

@billpatrianakos

This comment has been minimized.

Copy link
Owner Author

@billpatrianakos billpatrianakos commented Jun 3, 2020

The installation error shouldn’t be a problem. It’s expected to fail the first time. I would check the real simple things first.

Does the remote work to control the device? Use the front facing camera on your phone to see if you can see the infrared light when you press a button on the remote. If you can see a white-ish blue light blinking then you know it’s not the remote.

Try a different, very simple remote to record if you can. I’ve found that the simpler the device/remote, the easier it is to get lirc to detect the signals. Something like a fan remote or any very cheaply made remote, especially if you can see the clear little infrared light at the end of it would be a good choice.

Is your problem that lirc runs through its thing but then when you send a signal nothing happens? If that’s the case it could just be that the remote or device is too complex for lirc. I personally was trying to control a cable box via my Pi using lirc and what I found was that my remote was sending RF signals instead of IR. So I had to put the remote into IR mode and then point it at lirc. Lirc learned some codes but it still failed. It turns out that some remotes are just not compatible with lirc. In the end I searched the official lirc database of remote control config files for a similar remote that worked with my cable box and that’s how I got things working.

If your remote controls the device but lirc doesn’t respond to it then definitely try a simpler remote just to see if it works. Let me know what happens and I might be able to help you figure it out. From what you describe so far it doesn’t sound like a lirc issue but there’s not a lot to go on right now.

@totapio

This comment has been minimized.

Copy link

@totapio totapio commented Jun 25, 2020

Thank you for your effort!! Worked liked charm...

@kikogerde

This comment has been minimized.

Copy link

@kikogerde kikogerde commented Jul 1, 2020

This step fails:

pi@raspberrypi:~/lirc-src $ sudo cp /etc/lirc/lirc_options.conf.dist /etc/lirc/lirc_options.conf cp: cannot stat '/etc/lirc/lirc_options.conf.dist': No such file or directory pi@raspberrypi:~/lirc-src $ sudo cp /etc/lirc/lircd.conf.dist /etc/lirc/lircd.conf cp: cannot stat '/etc/lirc/lircd.conf.dist': No such file or directory

@billpatrianakos

This comment has been minimized.

Copy link
Owner Author

@billpatrianakos billpatrianakos commented Jul 1, 2020

@nicolasbri

This comment has been minimized.

Copy link

@nicolasbri nicolasbri commented Jul 7, 2020

Hi, Thanks for the tutorial. Although, I am having an issue with my generated test.lircd.conf
It is a portable AC remote. Any ideas why the keys are not recorded.
All the keys are set to 0x0:

begin remote

name test
bits 0
flags CONST_LENGTH
eps 0
aeps 0

one 0 0
zero 0 0
gap 50000
toggle_bit_mask 0x0
frequency 38000

  begin codes
      KEY_POWER                0x0
      KEY_MODE                 0x0
      KEY_VOLUMEUP             0x0
      KEY_VOLUMEDOWN           0x0
  end codes

end remote

Thanks
Nicolas

@opensupport-dev

This comment has been minimized.

Copy link

@opensupport-dev opensupport-dev commented Jul 10, 2020

I succeeded to get lirc.conf file from irrecord command but when I executed by using command "irw" to confirm the codes of the pressed buttons, the output of command "irw" was no output on terminal. and I found the below log from "sudo tail -f /var/log/messages" ,even though I presssed any button on the remote controller.

"""
Jul 11 08:37:40 raspberrypi lircd-0.10.1[4392]: Notice: repeat code without last_code received
Jul 11 08:37:41 raspberrypi lircd-0.10.1[4392]: Notice: repeat code without last_code received
Jul 11 08:37:41 raspberrypi lircd-0.10.1[4392]: Notice: repeat code without last_code received
Jul 11 08:37:59 raspberrypi lircd-0.10.1[4392]: Notice: repeat code without last_code received
Jul 11 08:38:00 raspberrypi lircd-0.10.1[4392]: Notice: repeat code without last_code received
"""

The output is always "Notice: repeat code without last_code received", whenever I pressed any button of the remote controller.

Please let me know what the problem is and how to fix it.

Thanks,
Jay

@billpatrianakos

This comment has been minimized.

Copy link
Owner Author

@billpatrianakos billpatrianakos commented Jul 25, 2020

@billpatrianakos

This comment has been minimized.

Copy link
Owner Author

@billpatrianakos billpatrianakos commented Jul 25, 2020

@simanuel

This comment has been minimized.

Copy link

@simanuel simanuel commented Aug 4, 2020

Hi,

i'm getting the same error as Matt-K3 got on 3 Jun:

sudo apt install -y --allow-downgrades ./liblirc0_0.10.1-5.2_armhf.deb ./liblircclient0_0.10.1-5.2_armhf.deb ./lirc_0.10.1-5.2_armhf.deb
Reading package lists... Done
E: Unsupported file ./liblirc0_0.10.1-5.2_armhf.deb given on commandline
E: Unsupported file ./liblircclient0_0.10.1-5.2_armhf.deb given on commandline
E: Unsupported file ./lirc_0.10.1-5.2_armhf.deb given on commandline

And i think because of that the error
cp: cannot stat '/etc/lirc/lirc_options.conf.dist': No such file or directory

I tried reinstalling Buster, was following the tutorial and got the same error.

Thanks for any help!

@r-hede

This comment has been minimized.

Copy link

@r-hede r-hede commented Aug 6, 2020

Hi @simanuel,

The step to "Install LIRC (built on the previous step)":

cd ~/lirc-src
sudo apt install ./liblirc0_0.10.1-5.2_armhf.deb ./liblircclient0_0.10.1-5.2_armhf.deb ./lirc_0.10.1-5.2_armhf.deb

BECOMES:

cd ~/lirc-src
sudo apt install ./liblirc0_0.10.1-6.2~deb10u1_armhf.deb ./liblircclient0_0.10.1-6.2~deb10u1_armhf.deb ./lirc_0.10.1-6.2~deb10u1_armhf.deb

The step to "Deploy LIRC configurations":

sudo cp /etc/lirc/lirc_options.conf.dist /etc/lirc/lirc_options.conf
sudo cp /etc/lirc/lircd.conf.dist /etc/lirc/lircd.conf

BECOMES:

sudo cp ~/lirc-src/lirc-0.10.1/lirc_options.conf /etc/lirc/lirc_options.conf
sudo cp ~/lirc-src/lirc-0.10.1/lircd.conf /etc/lirc/lircd.conf

And the step to "Run the LIRC installation again":

cd ~/lirc-src
sudo apt install -y --allow-downgrades ./liblirc0_0.10.1-5.2_armhf.deb ./liblircclient0_0.10.1-5.2_armhf.deb ./lirc_0.10.1-5.2_armhf.deb

BECOMES:

cd ~/lirc-src
sudo apt install -y --allow-downgrades ./liblirc0_0.10.1-6.2~deb10u1_armhf.deb ./liblircclient0_0.10.1-6.2~deb10u1_armhf.deb ./lirc_0.10.1-6.2~deb10u1_armhf.deb

It worked for me!

Best regards,
Robin Hède.

@simanuel

This comment has been minimized.

Copy link

@simanuel simanuel commented Aug 7, 2020

Hi Robin,

thank you so much for your efforts!
I'm able to install LIRC now, however, the step "Run the LIRC installation again" is resulting in errors now:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'liblirc0' instead of './liblirc0_0.10.1-6.2~deb10u1_armhf.deb'
Note, selecting 'liblircclient0' instead of './liblircclient0_0.10.1-6.2~deb10u1_armhf.deb'
Note, selecting 'lirc' instead of './lirc_0.10.1-6.2~deb10u1_armhf.deb'
liblircclient0 is already the newest version (0.10.1-6.2~deb10u1).
liblirc0 is already the newest version (0.10.1-6.2~deb10u1).
The following package was automatically installed and is no longer required:
  rpi-eeprom-images
Use 'sudo apt autoremove' to remove it.
Suggested packages:
  lirc-compat-remotes lirc-drv-irman lirc-doc lirc-x setserial ir-keytable
Recommended packages:
  gir1.2-vte
The following packages will be DOWNGRADED:
  lirc
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/489 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /home/pi/lirc-src/lirc_0.10.1-6.2~deb10u1_armhf.deb lirc armhf 0.10.1-6.2~deb10u1 [489 kB]
(Reading database ... 104354 files and directories currently installed.)
Preparing to unpack .../lirc_0.10.1-6.2~deb10u1_armhf.deb ...
Unpacking lirc (0.10.1-6.2~deb10u1) over (0.10.1-6.2~deb10u1) ...
Setting up lirc (0.10.1-6.2~deb10u1) ...
Job for lircd.service failed because the control process exited with error code.
See "systemctl status lircd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript lircd, action "restart" failed.
* lircd.service - Flexible IR remote input/output application support
   Loaded: loaded (/lib/systemd/system/lircd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2020-08-07 05:28:11 CEST; 21ms ago
     Docs: man:lircd(8)
           http://lirc.org/html/configure.html
  Process: 1551 ExecStart=/usr/sbin/lircd --nodaemon (code=exited, status=1/FAILURE)
 Main PID: 1551 (code=exited, status=1/FAILURE)

Aug 07 05:28:11 HomePi4 lircd-0.10.1[1551]: Info: lircd:  Opening log, level: Info
Aug 07 05:28:11 HomePi4 lircd-0.10.1[1551]: Notice: Version: lircd 0.10.1
Aug 07 05:28:11 HomePi4 lircd-0.10.1[1551]: Notice: System info: Linux HomePi4 5.4.51-v7l+ #1327 SMP Thu Jul 23 11:04:39 BST 2020 armv7l GNU/Linux
Aug 07 05:28:11 HomePi4 lircd-0.10.1[1551]: Info: Cannot open plugindir /usr/lib/lirc/plugins
Aug 07 05:28:11 HomePi4 lircd[1551]: Driver `default' not found or not loadable (wrong or missing -U/--plugindir?).
Aug 07 05:28:11 HomePi4 lircd[1551]: Available drivers:
Aug 07 05:28:11 HomePi4 lircd-0.10.1[1551]: Info: Cannot open plugindir /usr/lib/lirc/plugins
Aug 07 05:28:11 HomePi4 systemd[1]: lircd.service: Main process exited, code=exited, status=1/FAILURE
Aug 07 05:28:11 HomePi4 systemd[1]: lircd.service: Failed with result 'exit-code'.
Aug 07 05:28:11 HomePi4 systemd[1]: Failed to start Flexible IR remote input/output application support.
dpkg: error processing package lirc (--configure):
 installed lirc package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for systemd (241-7~deb10u4+rpi1) ...
Errors were encountered while processing:
 lirc
E: Sub-process /usr/bin/dpkg returned an error code (1)

Tested on a fresh system again!
Thanks again for your help!

Greetings,
simanuel

@r-hede

This comment has been minimized.

Copy link

@r-hede r-hede commented Aug 7, 2020

Hi @simanuel,

It's my fault, I completely forgot a step.

After the step Deploy LIRC configurations, you have to comment the line plugindir into the file /etc/lirc/lirc_options.conf:

The content of the file /etc/lirc/lirc_options.conf then becomes:

# These are the default options to lircd, if installed as
# /etc/lirc/lirc_options.conf. See the lircd(8) and lircmd(8)
# manpages for info on the different options.
#
# Some tools including mode2 and irw uses values such as
# driver, device, plugindir and loglevel as fallback values
# in not defined elsewhere.

[lircd]
nodaemon        = False
driver          = default
device          = /dev/lirc1
output          = /var/run/lirc/lircd
pidfile         = /var/run/lirc/lircd.pid
#plugindir      = /usr/lib/lirc/plugins
permission      = 666
allow-simulate  = No
repeat-max      = 600
#effective-user =
#listen         = [address:]port
#connect        = host[:port]
#loglevel       = 6
#release        = true
#release_suffix = _EVUP
#logfile        = ...
#driver-options = ...

[lircmd]
uinput          = False
nodaemon        = False

# [modinit]
# code = /usr/sbin/modprobe lirc_serial
# code1 = /usr/bin/setfacl -m g:lirc:rw /dev/uinput
# code2 = ...


# [lircd-uinput]
# add-release-events = False
# release-timeout    = 200
# release-suffix     = _EVUP

After that, you can go to the Run the LIRC installation again step and the error should be gone.

Best regards,
Robin Hède.

@simanuel

This comment has been minimized.

Copy link

@simanuel simanuel commented Aug 11, 2020

Thank you so much, it's finally working!

@harvester-klirk

This comment has been minimized.

Copy link

@harvester-klirk harvester-klirk commented Aug 21, 2020

Hey!
Thank you so much for the tutorial
i applied every step (including the updates which r-hede suggested )
i can record and everything is working fine until transmitting !
i double checked the connections "dtoverlay=gpio-ir-tx,gpio_pin=17"
i am using raspberry pi 4
please help !

@simanuel

This comment has been minimized.

Copy link

@simanuel simanuel commented Aug 21, 2020

Have you changed the device to /dev/lirc0 for sending?

It's working for me, but sadly it's not as reliable as it was on my previous raspberry (before the changes).
Now i have to send commands again often, that really sucks... hope that will change in the near future.

@harvester-klirk

This comment has been minimized.

Copy link

@harvester-klirk harvester-klirk commented Aug 21, 2020

thanks for the quick reply !
yes i have but still no luck
here's my connections
I am really in a dead end !
Thank you in advance!
unnamed

@pietchaki

This comment has been minimized.

Copy link

@pietchaki pietchaki commented Aug 28, 2020

Not all remotes are compatible or readable by LIRC. You may have a remote that either is using RF without you knowing it (I had a cable box remote that can be used in IR mode but defaults to RF) or for some reason just can’t be read by LIRC. My advice for situations like this is, assuming you got as far as setting up a working LIRC installation (which is seems like you did), try recording a different remote (the simpler the remote the better) or see if you can get a premade config file for the device you’re trying to use from the LIRC database. It looks like you have everything properly set up so I don’t think the issue is on the LIRC configuration end of things. I would think it’s something technical about how IR remotes work which is just outside my personal wheelhouse. Sorry I can't be of more help.

I have the same issue, where all buttons get the same code.
I'm pretty sure the problem is not the remote, as it's a kit to use with arduino and/or raspberry.
I'm using a KY-022 IR module, with a TL1838 sensor in it. It came with a simple small remote. I'm sure it is a IR remote, as it has no RF antenna inside, only the IR LED.
Also, I tested with 3 other remotes, from my old Samsung TV, Sony stereo and a generic DVD remote. This DVD remote I was using with LIRC on my old media PC and it worked without any problem there for 7 years. I used a simple serial IR adapter as described here: https://www.lirc.org/images/schematics.gif
PC was a very old and had a bunch of problems, so I changed to a rpi0w to stream from my local PLEX server.

EDIT:
Done the same steps again in a fresh RaspberryOS install and it worked.

PS.: In my install, there was no "/etc/lirc/lirc_options.conf.dist" file, it was already correctly named. Also, there was no failed install attempt.
PS2.: .deb filenames had changed, they are "_0.10.1-6.2" now

@pietchaki

This comment has been minimized.

Copy link

@pietchaki pietchaki commented Sep 1, 2020

I believe it would be better to update the Tutorial and put the current instruction on an "_old" file.

@kangituser

This comment has been minimized.

Copy link

@kangituser kangituser commented Sep 13, 2020

Hi all,

My name's Jonathan.

First of all thank you for this tutorial/wonderfull lib !

I've done the first step of installing LIRC.
That went through just fine. I need help recording signals. i've looked at harverster-klirk's comments in hopes to see a solution. since i have a similar setup (only the receiver is connected at this time, later i will connect the emmiter).

But as for receiving IR signals with mode2, i do see the terminal responds to this since i see the "Using device: /dev/lirc1" message, and the cursor thingy (have no clue what it's called) waits for input.

but, as i've only skimmed through these docs and myabe i missed a thing or two - i understoop just now that you use some kind of usb IR receiver/emmitter - whilst I'm using a war IR reciever component.
i have three outs :
Vcc, ground, signal.

I've put them in the co-responding pins (17 & others).
so i have no clue if this is not working due to the fact that i have implemented a different gpio connection that the usb dongle.

hope you've got some insights for me.

also - maybe it's been updated somwhere - but there have been some changes in the lib that i had to do manually (& that's fine) but i think that for future reference to other users things should be updated.

like the ./liblirc0_0.10.1-5.2_armhf.deb ./liblircclient0_0.10.1-5.2_armhf.deb ./lirc_0.10.1-5.2_armhf.deb files, at the moment after taking all the steps - the number is .1-6.2~deb10u1 so the code can't seem to recognize it.

there are a few more tweaks here & there i've done to compile the lib. i can't recall at the moment, but since this is an ongoing project i'll be doing this quite a lot and will be sure to specify what needs changes.

btw i'm using a RPI 4 with Raspbian Lite (atm i'm reading the old docs in hope to find some salvation to my issue).

thank you so much!

@hkrawczyk

This comment has been minimized.

Copy link

@hkrawczyk hkrawczyk commented Sep 20, 2020

Hi there :) so I've installed Lircs with the provided instructions (big kudos!), but for some reason, I receive nothing on mod2 on /lirc1.
Any ideas about what might be the root cause? Have only one IR remote but sure it is IR cause when I put my finger over IR led its not working. It is Panasonic TV so should be pretty basic I guess.

I've followed all the steps from the instruction - and my hardware set up looks like that

@cbirchinger

This comment has been minimized.

Copy link

@cbirchinger cbirchinger commented Sep 30, 2020

I just failed trying to learn a remote with "irrecord -d /dev/lirc1 ~/lircd.conf".

After the random button pressing phase it always ended up with the error "Cannot find any gap"
and the learned buttons after that had "0x0" as code.

What ended up fixing the issue was always a full reboot after setting the device to /dev/lirc1 (from lirc0)
As soon as lircd ran before with /dev/lirc0 (doesn't matter if it was stopped later), learning failed.

Maybe people getting 0x0 codes during the learning phase run into the same issue.

@thefantas

This comment has been minimized.

Copy link

@thefantas thefantas commented Nov 30, 2020

Not work in Kernel 5.4.x

@billpatrianakos

This comment has been minimized.

Copy link
Owner Author

@billpatrianakos billpatrianakos commented Mar 5, 2021

I have had little success getting learning to work. Only the simplest remotes seem to work. Things like remotes for cable boxes are tough to get working and I recommend looking through the LIRC project's site to see if there's an existing config available for your specific device (there are a lot in there and in some cases you can get away with using a config for a device that's slightly different but in the same family like a cable box remote that's from the same manufacturer but not the exact model you have for example).

To check if LIRC is working at all, I would suggest using the phone camera trick. Get any lirc config online and then use the lirc CLI to output an IR signal manually. Use the front facing (selfie mode) camera on just about any phone, point it at the IR LED, run the commend to output a signal, and you should see the light visibly flash very quickly on your phone screen. That's the simplest and fastest way to see if you're getting output. As far as input, the command line should be able to tell you that when you test using mode2.

LIRC is very finicky and my instructions are incomplete. Use it as a starting point only. I had to cobble this together from multiple sources. Also remember that this is what worked on a Pi 3B back in 2019 using the latest OS available back then. Things may have changed.

This is by far the most talked about topic on any of my repos or gists and unfortunately it's the hardest to debug because everyone is going to be using slightly different hardware and the tutorials out there are not up to date (like this has now become).

But start with making sure the hardware is at least trying to send/receive signals, be sure to reboot after major config changes, and go from there. I wish I could be more helpful but that's all I have for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment