Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Turning Raspberry PI into Remote Controller
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get install lirc -y
sudo nano /boot/config.txt
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
dtoverlay=gpio-ir,gpio_pin=18
dtoverlay=gpio-ir-tx,gpio_pin=17
sudo nano /etc/lirc/hardware.conf
LIRCD_ARGS="--uinput --listen"
LOAD_MODULES=true
DRIVER="default"
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"
sudo nano /etc/lirc/lirc_options.conf
#driver = devinput
#device = auto
driver = default
device = /dev/lirc0
sudo /etc/init.d/lircd status
sudo cp ~/<model_name>.lircd.conf /etc/lirc/lircd.conf.d/<model_name>.lircd.conf
sudo /etc/init.d/lircd stop
sudo mode2 -m -d /dev/lirc0
sudo nano /boot/config.txt
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
dtoverlay=gpio-ir,gpio_pin=18
#dtoverlay=gpio-ir-tx,gpio_pin=17
sudo mode2 -m -d /dev/lirc0
sudo irrecord -d /dev/lirc0 --disable-namespace
sudo mode2 -m -d /dev/lirc0 > <remote_controller_name>.lircd.conf
begin remote
name tv
flags RAW_CODES
eps 25
aeps 100
ptrail 0
repeat 0 0
gap 20921
begin raw_codes
name SWITCH_ON
8996 4451 552 574 551 576
552 576 551 579 550 575
553 1683 577 550 551 1683
...
564
name SWITCH_OFF
9000 4453 578 548 580 548
578 549 556 572 552 576
552 1683 577 551 550 1683
...
573
end raw_codes
end remote
sudo cp ~/<remote_controller_name>.lircd.conf /ect/lirc/lircd.conf.d/<remote_controller_name>.lircd.conf
sudo mv devinput.lircd.conf devinput.lircd.conf.dist
sudo nano /boot/config.txt
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
dtoverlay=gpio-ir,gpio_pin=18
dtoverlay=gpio-ir-tx,gpio_pin=17
sudo /etc/init.d/lircd status
irsend LIST <remote_controller_name> ""
irsend SEND_ONCE tv SWITCH_ON
@dalepres
Copy link

dalepres commented Jul 26, 2021

Justin,

What are you using for your IR? I'm trying to get a USB IR device, I have irtoy2 and irdroid modules, to work on Raspberry PI OS but neither work with these instructions. Both flash the data received LED when I press buttons in irrecord but irrecord times out in 10 seconds with no data received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment