Wednesday, 15 February 2017

Remote control?

I'm also fiddling about with RPi audio. I'm not sure where this info should go, but it's here for the moment.

The cheap Chinese Hifiberry Digi+ knock-off board has an IR sensor on it, which in principle can be used to allow a remote control to do things to the system. Interesting...



A bot of research, and it seems you have to use lirc, the Linux IR Controller module. Acting on some hints/instructions in various fora, I've

  • Modified my config.txt to include 
    • dtoverlay=lirc-rpi (load the right module)
    • dtparam=gpio_in_pin=26 (enable the GPIO pin IR sensor is connected to)
  • Rebooted the RPi (took a couple of attempts, with an edit of config.txt for GPIO 26 from 27 - oops)
  • Run mode2 -d /dev/lirc0
  • Pointed my old Virgin Media TV box controller at it...
  • Result! lots of pulse/space codes....
[root@Frontroom ~]# mode2 -d /dev/lirc0
Using device: /dev/lirc0
Using device: /dev/lirc0
Warning: Running as root.
space 16777215
pulse 10974
space 4670
pulse 753
space 577
pulse 731
space 551
pulse 726
space 586

Now I have to teach the lirc software the remote control buttons. It's a wet afternoon.

Update

I did managed to record something from the controller, a post on the runeaudio forum said irrecord didn't work on ArchLinux, but it seemed to for me. At least, it generated a file. I subsequently foundered on a number of errors from the lircd, like "can't find IR thing" and so on. Poo. Maybe I need to get it to work with another platform first, like Raspbian. At least I can now see how it could control the Rune player - it's basically scripts that use mpc, invoked when a specific event is detected.


No comments:

Post a Comment