Achindra Bhatnagar
Published © MIT

Learning IR Codes with Raspberry

Learn IR codes of a remote with a Raspberry and use in your project to control devices remotely

IntermediateProtip4 hours8,451
Learning IR Codes with Raspberry

Things used in this project

Story

Read more

Code

Initial Updates

Plain text
Initial updates to have latest code running
# updates
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo rpi-update

sudo apt-get clean

LIRC Configuration

Plain text
Edit /etc/lirc/hardware.conf and add following updates
#following changes to /etc/lirc/hardware.conf
LIRCD_ARGS="--uinput" 
DRIVER="default" 
DEVICE="/dev/lirc0" 
MODULES="lirc_rpi"

mode2 output

Plain text
mode2 output for IR from a remote
space 16777215
pulse 7704288
space 169
pulse 106
space 1903
space 10811
pulse 33
space 287800
pulse 103351

irsend command

Plain text
Help from irsend command
$ irsend --help
Usage: irsend [options] DIRECTIVE REMOTE CODE [CODE...]

DIRECTIVE
SEND_ONCE         - send CODE [CODE ...] once
SEND_START        - start repeating CODE
SEND_STOP         - stop repeating CODE
LIST              - list configured remote items
SET_TRANSMITTERS  - set transmitters NUM [NUM ...]
SIMULATE          - simulate IR event

REMOTE
Name of remote whose configuration to use from lircd.conf

CODE
Key code as saved in lircd.conf

LIRCD

Plain text
lircd command output in non-daemon mode
$ sudo lircd -n -d /dev/lirc0
lircd-0.9.0-pre1[15822]: lircd(default) ready, using /var/run/lirc/lircd
lircd-0.9.0-pre1[15822]: accepted new client on /var/run/lirc/lircd
lircd-0.9.0-pre1[15822]: removed client
lircd-0.9.0-pre1[15822]: accepted new client on /var/run/lirc/lircd
lircd-0.9.0-pre1[15822]: removed client

Credits

Achindra Bhatnagar

Achindra Bhatnagar

20 projects • 161 followers
Windows Kernel Hacker, IoT Hobbyist, Enthusiast, Developer and Dreamer

Comments