Kymera wand + RPi = MAGIC

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

2. 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.

3. Reboot to save the changes
4. Wire up the receiver!

(from Adafruit website)
Pin 1 goes to GPIO 18, pin 2 goes to GND and pin 3 goes to 5v.
4. sudo /etc/init.d/lirc stop
5. 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.
6. 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.
7. Copy the configuration file to where lirc is looking for it
sudo cp lircd.conf /etc/lirc/lircd.conf
8. Restart lirc
sudo /etc/init.d/lirc restart
9. You can now test that the buttons are working!
irw
10. Now install lirc for Python
sudo easy_install python-lirc
11. 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!
12. 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!

Advertisements

One thought on “Kymera wand + RPi = MAGIC

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s