Finnian's blog

Software Engineer based in New Zealand

3-Minute Read

Today I had some free time… so I decided to use my favorite gadget for something.

A fellow blogger mentioned to me that I should use a Pi and a Kymera wand to get the Pi to control things… like magic.

I decided to use another IR remote to ‘pair’ with the RPi and then map the wand to the buttons on t’other remote.

BOM:

IR receiver - http://www.adafruit.com/product/157

Kymera wand/IR remote - http://www.adafruit.com/products/389

  1. Install LIRC (Linux Infrared Remote Control - basically the handler for the remote)

sudo apt-get install lirc liblircclient-dev

  1. Setup the receiver

sudo nano /etc/modules

Insert into the bottom of this file:

lirc_dev lirc_rpi gpio_in_pin=18 Exit the file.

sudo nano /etc/lirc/hardware.conf

Make it look exactly like this: # /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="" Exit the file.

  1. Reboot to save the changes
  2. Wire up the receiver! (from Adafruit website) Pin 1 goes to GPIO 18, pin 2 goes to GND and pin 3 goes to 5v.
  3. sudo /etc/init.d/lirc stop
  4. mode2 -d /dev/lirc0 Now press some buttons on your remote whilst pointing it at the receiver. You should see stuff happening when you press buttons.
  5. Now you need to record the signals that the remote sends irrecord -d /dev/lirc0 ~/lircd.conf Just follow the instructions, they are very clear.
  6. Copy the configuration file to where lirc is looking for it sudo cp lircd.conf /etc/lirc/lircd.conf
  7. Restart lirc sudo /etc/init.d/lirc restart
  8. You can now test that the buttons are working! irw
  9. Now install lirc for Python sudo easy_install python-lirc
  10. Download and run the test file I’ve written wget http://github.com/xavbabe/pi_scripts/IR/ir_test.py python ir.py Now press buttons on your remote, you should now see them coming up on your screen!
  11. You must now create the file /etc/lirc/lirc rc and put into it: begin button = KEY_UP prog = myprogram config = up end

You must add entries like this for every of the buttons you u set up using irrecord. 13 Map your Kymera wand (optional)

Put the wand into ’learning’ mode (point upwards and double tap)

Carefully aim it towards and do the control that you want to use. Then, when it has started pulsing rapidly, aim it at the other remote and press the button you want to use on the other remote. Repeat for all the buttons you want to use!

After this, point the wand down and double tap, you are now ready to use it!

To take it a bit further, I would like to make the Python script control other things, like lighting in the house (rather simple idea!).

Hope you found this useful!

Recent Posts