RPI IR

From ElectroDragon Wiki

Install and Demo Record

installation animation GIF
Header text Header text Header text
Install LIRC sudo apt-get install lirc Example
config GPIO
  • for new version -> sudo sudo nano /boot/config.txt
  • for old version -> sudo nano /etc/modules
  • For new version -> add following line -> dtoverlay=lirc-rpi,gpio_in_pin=26,gpio_out_pin=17
  • For old version -> Add following modules

lirc_dev lirc_rpi gpio_in_pin=18 gpio_out_pin=17

Config modules
Config LIRC sudo nano /etc/lirc/hardware.conf

edit:

LIRCD_ARGS="--input –listen"
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"

if file not avaialble, then just create as follow

LIRCD_ARGS=”–uinput –listen”
LOAD_MODULES=true
DRIVER=”default”
DEVICE=”/dev/lirc0″
MODULES=”lirc_rpi”
Config LIRC 02 sudo nano /etc/lirc/lirc_options.conf

Edit line

driver = default
device = /dev/lirc0
Try it service

Command

sudo /etc/init.d/lirc stop
sudo /etc/init.d/lirc start 

Or

sudo /etc/init.d/lircd stop
sudo /etc/init.d/lircd start
Run on receiver mode2 -d /dev/lirc0

Data receive like below

  • space 16300
  • pulse 95
  • space 28794
  • pulse 80
  • space 19395
  • pulse 83
  • space 402351
  • pulse 135
  • space 7085
  • pulse 85
  • space 2903

Record and Send

record and config file animation
  • nice reference tutorial here.
Header text Header text Header text
config send
  • stop first -> sudo /etc/init.d/lirc stop (or use sudo /etc/init.d/lircd stop)
  • (skip this, seems useless) run -> irrecord –list-namespace
  • start to config -> irrecord -d /dev/lirc0 ~/lircd.conf

config common keys

  • KEY_VIDEO_PREV
  • KEY_VIDEO_NEXT
  • KEY_VOLUMEUP
  • KEY_VOLUMEDOWN
  • KEY_POWER
Back up lircd.conf, and replace it by ed.lircd.conf
  • back up -> sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf
  • replace -> sudo cp /home/pi/ed.lircd.conf /etc/lirc/lircd.conf
  • restart service -> sudo /etc/init.d/lirc start (or use sudo /etc/init.d/lircd start)
List commands in name space called ed irsend LIST ed ""
  • irsend: 000000000000c837 KEY_VOLUMEDOWN
  • irsend: 00000000000048b7 KEY_VOLUMEUP
  • irsend: 00000000000008f7 KEY_VIDEO_PREV
  • irsend: 0000000000008877 KEY_VIDEO_NEXT
Send commands
  • irsend SEND_ONCE ed KEY_POWER

,