Raspberry Pi IR Transmitter with LIRC
Board: Raspberry Pi Revision 1.0, Model B
sudo apt-get install lirc
/etc/moduleswith provided file
/etc/lirc/hardware.confwith provided file
/boot/config.txtwith provided file
/etc/lirc/lircd.confwith your desired config settings (see lircd.conf example)
- Reboot the pi
sudo shutdown now -r
Send a command from your config file:
irsend SEND_ONCE "ceiling_light" "change_state"
irsend complains about the transmission failing, try removing the
min_repeat parameter from
lircd.conf, or increase the
gap parameter (seriously). In fact, if it ever says the transmission fails, it's almost certain your config file has an invalid parameter, but
irsend sucks and won't tell you what's wrong.
Do keep in mind the Raspberry Pi's pins are numbered terribly. The Python GPIO library in my script uses the "board" numbering, whereas the config files in this repo use the BCM (Broadcom) numbering. In this diagram, the numbers in circles are "board" numbers and the numbers following "GPIO" in the rectangles are "BCM" numbers.
receive.py will give you pulses and their durations. Run it with
python receive.py and kill it with Ctrl-C when you're done (I'm a lazy coder). See
rawPulseData.txt for example output. For my remote, I knew it was the NEC protocol and manually translated the pulses to binary/hex:
0x41b658a7 (my remote only has one button).