Using lirc with GPIO IR LED

ok, so I used this guide IR Remote Control » Raspberry Pi Geek to make a IR LED to control my TV using my rpi3.

I didn’t really pay attention when I did ‘sudo apt-get install lirc’ and pressed yes to this:

The following extra packages will be installed: libftdi1 liblircclient0 Suggested packages: lirc-x setserial ir-keytable The following packages will be REMOVED: armv7-eventlircd-osmc armv7-lirc-osmc armv7-remote-osmc rbp2-device-osmc The following NEW packages will be installed: libftdi1 liblircclient0 lirc 0 upgraded, 3 newly installed, 4 to remove and 11 not upgraded. Need to get 0 B/398 kB of archives. After this operation, 373 kB disk space will be freed. Do you want to continue? [Y/n]

After realizing that I probably messed something up, I did a ‘sudo apt-get -f install’ and I think that OSMC original lirc configuration is back to normal, but I’m not sure.

using ‘irsend’ command always seems to result in ‘timeout’

my /etc/lirc/lircd.conf file looks like this:

I have the led connected to GPIO 4

my /etc/lirc/hardware.conf looks like this:

LIRCD_ARGS="--uinput" LOAD_MODULES=true DRIVER="default" DEVICE="/dev/lirc0" MODULES="lirc_rpi" LIRCD_CONF="" LIRCMD_CONF=""
I have added the following two lines to the end of /etc/modules

lirc_dev lirc_rpi gpio_out_pin=4

Not sure what to try to get this to work

Edit: Since I’m not really planning on using any other remote functionalities I’m thinking that disabling the lirc integration on OSMC might be the way to go?

Not sure how to do this thought. I have tried disabling lirc in myOSMC before I did the ‘sudo apt-get -f install’ command above to try and repair the damage.

At this moment, lirc option is enabled again, and I have changed the GPIO OUT option to use GPIO 4 instead of the default pin

OSMC already ships LIRC. You just needed to copy your config to your Pi and select it from My OSMC -> Remotes. Unless you know how to revert your changes you should reinstall

Thanks @sam_nazarko

I think I’ve managed to revert back LIRC to as it were. If not I will definitely do a reinstall.

By copying the config to my Pi, are you referring to the specific remote configuration I’m trying to use above? /etc/lirc/lircd.conf

I’m at work right now, but if I remember it correctly /etc/lirc/hardware.conf showed up when I selected browse under remote in myOSMC, but not lircd.conf

Would it be enough to change the GPIO OUT setting to the pin I’m using in ‘remote’ settings under myOSMC, and remove the two lines above from /etc/modules ?

You don’t need to mess with this.

The configuration file you can select in My OSMC → Remotes is actually ‘lircd.conf’. Put it somewhere like home and then select it, and it will work fine. If your remote is popular, consider submitting a pull request and getting it officially included in OSMC.

Yes, that’s the way you should do it. I suspect that guide was written for systems not using device tree overlays, and manually loading the module is a really bad idea.

Thanks @sam_nazarko! I’ll hopefully be able to try this out when I get home from work.

Thank you kindly for your help @sam_nazarko!

After realizing I had to use irsend -d /run/lirc/lircd-lirc0... command instead of just irsend my little IR LED is working great with OSMC! =)

You and the team are really doing great work with OSMC, keep it up! :wink:

1 Like

Good stuff.

Thanks for the kind words