Tuesday, December 5, 2017

Using IR remote on Raspberry Pi 3

Refs:
http://www.instructables.com/id/Raspberry-Pi-Universal-Remote/
https://raspberrypi.stackexchange.com/questions/70945/setting-up-a-remote-control-using-lirc
https://www.raspberrypi.org/forums/viewtopic.php?f=35&t=145751


1. Install lirc
sudo apt-get install lirc

2. Change /etc/modules
sudo vim /etc/modules

Add the following to the bottom of the file:

lirc_dev
lirc_rpi gpio_in_pin=23 gpio_out_pin=22


3. Replace /etc/lirc/hardware.conf with the following content:

########################################################
# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS="--uinput"

# Don't start lircmd even if there seems to be a good config file
# START_LIRCMD=false

# Don't start irexec, even if a good config file seems to exist.
# START_IREXEC=false

# Try to load appropriate kernel modules
LOAD_MODULES=true

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="default"

# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"

# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""
########################################################

4. Update /boot/config.txt by modifying the following line:

# Uncomment this to enable the lirc-rpi module
dtoverlay=lirc-rpi,gpio_in_pin=23,gpio_out_pin=22
# dtparam=gpio_in_pull=up

5. sudo reboot

6. Record the IR commands and save it to /etc/lirc/lircd.conf

7. sudo lircd -d /dev/lirc0

8. irsend -# 600 SEND_ONCE FAIRYLIGHTS KEY_POWER