In the last post I tested the IR receiver; next step verify the IR LEDs emit light. If you are lucky enough to have a remote in the database maintained @ lirc.sourceforge.net/remotes/, you may not even need to record. None of these worked for my remotes, so I created custom config files for each remote. However, these are great for testing functionality. I found it easier to connect to the Raspberry Pi via FTP with FileZilla to move config files around than via SSH with PuTTy. This did require adjusting permissions using chmod on /etc/lirc/lircd.conf via SSH, to allow the Write operation.

  • Back up the original /etc/lirc/lircd.conf and then replace it with a working config from the LIRC Database.
  • Restart LIRC to pick up these changes:
sudo /etc/init.d/lirc stop
sudo /etc/init.d/lirc start
  • Use irsend to initiate an IR signal:
irsend SEND_ONCE samsung KEY_POWER

The easiest way to verify the IR LEDs are working is to point them at a camera that detects IR and check if the LEDs emit light when initiating the SEND_ONCE command. Some cameras may have a filter to remove light in this spectrum. Older devices are less likely to have these filters; IR was visible on the built in webcam of my HP Envy laptop.

Now that the hardware and LIRC are working, the next step is control from a website. Lirc_web relies on Node.js. For most of the following steps I referenced alexba.in/blog/2013/02/23/controlling-lirc-from-the-web.

  • Install and start lirc_web:
wget https://github.com/alexbain/lirc_web/archive/master.zip
unzip master.zip
mv lirc_web-master lirc_web
rm master.zip
cd lirc_web
npm install
node app.js
sudo nano /etc/init.d/URemote
#! /bin/sh    
# /etc/init.d/lirc_web     
### BEGIN INIT INFO     
# Provides:          lirc_web    
# Required-Start:    $remote_fs $syslog    
# Required-Stop:     $remote_fs $syslog    
# Default-Start:     2 3 4 5    
# Default-Stop:      0 1 6    
# Short-Description: Simple script to start a program at boot    
# Description:       Script to start / stop a program a boot / shutdown.    
### END INIT INFO    
# If you want a command to always run, put it here    
# Carry out specific functions when asked to by the system    
case "$1" in    
  start)    
    echo "Starting lirc_web"    
    # run application you want to start    
    node /home/pi/lirc_web/app.js    
    ;;    
  stop)    
    echo “Stopping lirc_web”    
    # kill application you want to stop    
    killall /home/pi/lirc_web/app.js    
    ;;    
  *)    
    echo “Usage: node /home/pi/lirc_web/app.js {start|stop}”    
    exit 1    
    ;;    
esac    
exit 0  
  • Make the script executable:
sudo chmod 755 /etc/init.d/URemote
  • Test starting and stopping lirc_web with the script:
sudo /etc/init.d/URemote start
sudo /etc/init.d/URemote stop
  • Register the script to be run at start-up:
sudo update-rc.d URemote defaults

If your remotes aren’t in the available index or those config files don’t work, irrecord can be used.

  • Stop lirc to free up /dev/lirc0:
sudo /etc/init.d/lirc stop
  • Create a new remote control configuration file using /dev/lirc0 and save the output to ~/lircd.conf. Once a file is generated for each remote it can be compiled into a single lircd.conf, this is much easier with FTP access. A list of namespace values for buttons is available @ ocinside.de/modding_en/linux_ir_irrecord_list.
irrecord -d /dev/lirc0 ~/lircd.conf
  • After all the remotes are recorded and compiled, the lircd.conf file can be placed @ /etc/lirc/ and then restart LIRC to pick up the new configuration:
sudo /etc/init.d/lirc stop
sudo /etc/init.d/lirc start

To finish of the hardware build I made a case out of Lego bricks, so it stays oriented vertically and has some protection.

Photograph of hardware assembled with a stand made of Lego.

Now control of IR devices is possible from a website, next up controlling Bluetooth devices the same way using GIMX.