0

I am trying to figure out how to read IR codes of a TV remote, so I can build my own web-based remote using a Raspberry Pi 3 with IR receiver and IR transmitter. I see a ton of articles online but could not find an article that articulates a DIY tutorial on just this part.

Ultimately, I want to map all the buttons on a TV remote, and then build a web based interface used to transmit the user selected IR codes to control a TV.

I have a RPi3 (second gen) kit with some basic accessories like breadboard, resistors, and jumper wires. IR receiver and transmitter components are confusing to choose, depending on which article I am reading.

Web User
  • 119
  • 1
  • 6

2 Answers2

2

While answers which are mostly links are discouraged, IR is NOT simple enough to explain in a few paragraphs.

You seem well informed already acknowledging that each button has its own code. That is a little bit over simplified (depending on the "codes" being used), but you at least have a good grasp of it and what you want to do.

The Pi has a great IR package called LIRC (think Linux Infrared Remote Control) which has a lot of documentation.

This link is pretty much exactly what you are looking for and it sounds like you have already looked at quite a few ideas.

This was built using a Pi Zero, just a stripped down Pi. Using LIRC really makes it slick!

www.instructables.com/id/Raspberry-Pi-Zero-Universal-Remote/.

Wendall
  • 221
  • 1
  • 7
1

You can use lirc to achieve what you want. When you have installed it you can use its diagnose tool mode2 to get low level information about the signals that are received from the remote control.

Then you need a configuration file that maps the lirc pulses to the buttons of your remote control. On the internet there is a database with many config files for remote controls. If you cannot find yours you have to training your remote control by yourself with:

rpi ~$ sudo irrecord -n -d /dev/lirc0 ~/lircd.conf

Next step is to use irw to check which button of your remote control has what action (volume up/down etc.).

Finally you can use irexec to map a script to each button on the remote control that is executed when the button is pressed. Within this script you can send commands through a web based interface to control a TV.

For details how to do all this using a Raspberry Pi you can look at Raspberry Pi 3 lirc running/working.


If you are looking for an alternative to lirc you can use direct kernel support with gpio-ir. Look at /boot/overlay/README. There you will find:

Name:   gpio-ir
Info:   Use GPIO pin as rc-core style infrared receiver input. The rc-core-
        based gpio_ir_recv driver maps received keys directly to a
        /dev/input/event* device, all decoding is done by the kernel - LIRC is
        not required! The key mapping and other decoding parameters can be
        configured by "ir-keytable" tool.
Load:   dtoverlay=gpio-ir,<param>=<val>
Params: gpio_pin                Input pin number. Default is 18.

        gpio_pull               Desired pull-up/down state (off, down, up)
                                Default is "up".

        rc-map-name             Default rc keymap (can also be changed by
                                ir-keytable), defaults to "rc-rc6-mce"


Name:   gpio-ir-tx
Info:   Use GPIO pin as bit-banged infrared transmitter output.
        This is an alternative to "pwm-ir-tx". gpio-ir-tx doesn't require
        a PWM so it can be used together with onboard analog audio.
Load:   dtoverlay=gpio-ir-tx,<param>=<val>
Params: gpio_pin                Output GPIO (default 18)

        invert                  "1" = invert the output (make it active-low).
                                Default is "0" (active-high).
Ingo
  • 42,961
  • 20
  • 87
  • 207