I made a Raspberry Pi infrared remote control for a television sound bar. Programmatic control offers many exciting possibilities! The user could:

  • add a python Flask service to make the remote available over local wifi network.
  • write an iOS remote control app with buttons that send requests to the Raspberry Pi remote control service.
  • program the system to automatically decrease the sound whenever it exceeds a threshold.
  • program the system to automatically decrease or mute the sound whenever a commercial is detected e.g.

    • analyzing closed captioning text for a word on a list (e.g. “Lexus”, “Tylenol”)
    • at regularly scheduled commercial times (e.g. 19:02, 19:30)

Raspberry Pi IR remote shield

Pi IR remote shield
Raspberry Pi with infrared remote control board

LIRC Linux Infrared Remote Control

“LIRC is a package that allows you to decode and send infra-red signals of many (but not all) commonly used remote controls.”

Calling LIRC irsend

def transmit_command_ir(command):
    """
    instruct infrared transmitter to transmit command
    :parameter command: an IrCommand
    """

    ir_command_string = ir_command(command)

    # Don't allow user to run arbitrary string input, that is a security risk.
    #
    # If LIRC irsend isn't installed, throws error:
    # FileNotFoundError: [Errno 2] No such file or directory: 'irsend': 'irsend'
    #
    # subprocess.run requires Python >= 3.5, so don't use it yet.
    subprocess.call([IRSEND, SEND_ONCE, IR_REMOTE, ir_command_string])

During initial development I used iPhone front facing camera to check the transmit command blinked the infrared LED. The rear facing camera filters infrared, but the front-facing selfie camera doesn’t.

IR LED blink
Checking transmit command blinks the infrared remote control LED

References

remy_python

https://github.com/beepscore/remy_python
Make a Raspberry Pi infrared remote control. The device can programmatically control television sound bar audio volume. The Raspberry Pi uses LIRC (Linux Infrared Remote Control) to send commands to an attached infrared transmitter.

The Python app has two parts:

  • Functions to send commands to the infrared transmitter, which then transmits the commands to the television sound bar
  • A Flask web service to accept television command requests (e.g. volume decrease, volume increase).

The README includes links to similar remote control projects, infrared remote control hardware.

Remy

https://github.com/beepscore/Remy
Remote control television by sending commands from iOS device to a server.

LIRC Linux Infrared Remote Control

https://lirc.org/

Infrared remote control hardware

Raspberry Pi IR Control Expansion Board

https://www.raspberrypiwiki.com/index.php/Raspberry_Pi_IR_Control_Expansion_Board

Icstation 38KHz IR Infrared Remote Control Transceiver Shield for Raspberry Pi 2 3 Module B B+

https://www.amazon.com/IR-Remote-Control-Transceiver-Raspberry/dp/B0713SK7RJ/ref=pd_cp_147_1?pd_rd_w=nydwe&pf_rd_p=ef4dc990-a9ca-4945-ae0b-f8d549198ed6&pf_rd_r=NPTQR2NR66SZXGEC1CFF&pd_rd_r=dc222ec9-1d1f-11e9-82b3-7117715d74e2&pd_rd_wg=OnVSD&pd_rd_i=B0713SK7RJ&psc=1&refRID=NPTQR2NR66SZXGEC1CFF

Inspirational projects

Enough Already by Matt Richardson

https://makezine.com/2011/08/16/enough-already-the-arduino-solution-to-overexposed-celebs/

TV-B-Gone Kit

https://www.adafruit.com/product/73

TV-B-Gone

https://www.tvbgone.com/