Thursday, 29 February 2024

Configuring Raspberry Pi Infra Red receiver

WALT: Configure Infra Red Receiver for Raspberry Pi 2 (not USB IR receiver).

Hardware specs:

Infra Red Receiver and Remote

  • 3 pin Infra red sensor  -  VCC, GND and Signal.
  • Batterry controlled Remote control emits Infra red light. The remote emits Pulse width modulated IR.

Raspberry Pi

  • RPi 2 model B.
  • All GPIO pins for RPi are capable of Pulse width modulated digital input! Few GPIOs pins are capable of hardware PCM.
  • IR sensor connected to 5v, Gnd and a GPIO.

Software:

  • The Kernel does the Software demodulation of the Infra red signal received from IR sensor.
    • For Raspbian version bullseye, the "gpio-ir" kernal overlay does this. For remote controls that follow standard protocols like NECs, there is no need for lirc.
    • Change the /boot/config.txt file to activate the kernel overlay and reboot.
    • Once rebooted /dev/lirc0 should show up automatically.
  • Use the ir-keytable program to map the demoduled hex keys to the standard keys.
    • For e.g. 
    • $sudo ir-keytable -k 0x45=KEY_1,0x16=KEY_KPASTERISK,0x18=KEY_UP

No comments: