Kernel module GPIO-IR sending IR-Codes

  • Hi everyone,

    I have configured my apple tv remote with the gpio-ir kernel module and ir-keytable. -works fine!

    Now I want to send IR-Commands to my Receiver to turn it on an off from my RPI. Is there a way to do so?

    BR

    Florian

  • In LE8.2 this doesn't work yet, but you'll be able to do that in LE9.0 (it'll work eg in current Milhouse builds).

    LE9.0 uses the newer 4.14 kernel which added support for gpio-ir-tx and pwm-ir-tx. With either one of these dtoverlays you can define a GPIO for transmitting IR data.

    If you don't need analog audio on the RPi I'd recommend using pwm-ir-tx, this results in lower CPU load compared to gpio-ir-tx (the latter has to bit-bang the GPIO at ~38kHz whereas the former offloads lots of the heavy lifting to the PWM).

    With these overlays you get a separate /dev/lircX device node and can use eg ir-ctl -S ... to transmit IR signals.

    so long,

    Hias

  • Hi!

    Thank you very much for the fast answer! I have installed the milhouse build #315 from march and tried both overlays but it doesn't work for me. I get the new lire device in /dev/ but if I want to start ir-keytable to see the scan code from my original remote nothing happens, the program doesn't start. If I uncomment the dtoverlay entry it works. I tried the pwm-ir-tx with gpio12 and the gpio-ir-tx with gpio17. when I try to send rc5 scan code with ir-ctl -d /dev/lirc0 -S rc5:0x1e01 I get no error but also no output from the ir-diode (test with my phone camera).

    Do you have any ideas? Many thanks in advance

    Florian

  • Make sure you are using the correct GPIO pins. The gpio_pin options of the overlays are a bit misleading. Despite their name they specify the GPIO number, not the header pin number...

    gpio-ir, gpio-ir-tx and pwm-ir-tx all default to GPIO 18 (pin 12 of the header) - see the README in /flash/overlays.

    gpio-ir defaulting to GPIO 18 is a relic of old lirc_rpi days which defaulted to GPIO 18 for input and GPIO 17 for output - which is a bit of a pity as GPIO 18 is the only one that's usable for PWM output.

    So, it's best to use pwm-ir-tx with the default GPIO 18 and use any other GPIO (eg GPIO 17 / header pin 11) for receiving IR:

    Code
    dtoverlay=gpio-ir,gpio_pin=17
    dtoverlay=pwm-ir-tx

    This will give you 2 /dev/lircX devices, one for receiving and one for transmitting. The device names could change so it's best to create a udev rule to setup persistent names. eg create a /storage/.config/udev.rules.d/90-lirc-devices.rules files with this content

    Code
    ACTION=="add|change", KERNEL=="lirc*", DRIVERS=="gpio-rc-recv", SYMLINK+="lirc-rx"
    ACTION=="add|change", KERNEL=="lirc*", DRIVERS=="pwm-ir-tx", SYMLINK+="lirc-tx"

    Then you can use the persistent device nodes in ir-ctl. eg

    Code
    ir-ctl -d /dev/lirc-tx -S rc5:0x1234
    ir-ctl -d /dev/lirc-rx -r

    so long,

    Hias