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.
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:
Exit the file.
sudo nano /etc/lirc/hardware.conf
Make it look exactly like this:
# Arguments which will be used when launching lircd
# Don't start lircmd even if there seems to be a good config file
# Don't start irexec, even if a good config file seems to exist.
# Try to load appropriate kernel modules
# Run "lircd --driver=help" for a list of supported drivers.
# usually /dev/lirc0 is the correct setting for systems using udev
# Default configuration files for your hardware if any
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.
sudo /etc/init.d/lirc stop
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!
10. Now install lirc for Python
sudo easy_install python-lirc
11. Download and run the test file I’ve written
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:
button = KEY_UP
prog = myprogram
config = up
You must add entries like this for every of the buttons you u set up using
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!