Electronics · Websites

Raspberry Pi – Control by Magic Wand!

So a friend at work just pointed me to this awesome bit of tech called the Kymera Wand which is also available as Sonic Screwdriver.  Basically it is a Universal Remote, hidden in a wand, and controlled by gesture!

wand-book-english-1500x1178-1024x804

It’s really quite awesome.

Controlling a TV with a flick of the wrist is something magical, but SO much more is possible given the age of home automation.  So a coworker and I started researching what it would take to control EVERYTHING with this little marvel.

Enter the Raspberry PI and the LIRC library.

case2-500x334

LIRC stands for: Linux Infrared Remote Control and has been around for long time.  It took me some work to figure out all the pieces so I’m hoping to simplify that a little for you here.

First, order yourself an IR receiver.  Adafruit is the most accessible at purchasing components here:

157-00

https://www.adafruit.com/products/157

Then, check out these instructions for getting LIRC installed (Alex does a great job getting you going.)

http://alexba.in/blog/2013/01/06/setting-up-lirc-on-the-raspberrypi/

Note: I had to reboot the PI before the *mode* stuff worked.

For our needs – we only need to wire up the “receiver” portion.  Since we’re going to have the Raspberry PI act based on wand flicks.

Note: When I first setup the receiver I got the pin out wrong and the test program didn’t work.

Ok, now assuming you saw pulses when you ran your test program (using a TV remote).  The next step is to program in a button from a “normal” remote control, into the LIRC config files.  This ensure that you haven’t introduced a problem with the wand.

Lirc contains and ingenious little program that allows you to train it to recognize any button from any IR remote.  I tracked down instructions for this here:

linux_ir_anleitung_21

http://www.ocinside.de/html/modding/linux_ir_irrecord_guide.html

WARNING

If you have difficulty – consider using a *clean* power supply.  The ones typically used in IOT devices are cheap and noisy.  Any noise from the power will make it difficult to detect the IR pulses.  You’ll see lots of spurious IR-receives – when none are being sent.  To fix it, consider running the PI from the USB ports on your computer… that should be clean.

With recognition working…

Now that you know your PI is recognizing your remote’s buttons.  It’s time to choose what those buttons will do!

That I found nicely explained here:

https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=58626

The magic bit is below.  Place this, in a file called: /etc/lirc/lircrc

begin
 prog = irexec
 remote = /etc/lirc/own_remote.conf
 button = 
 config = echo "You just pressed 'OK'!" > /var/run/lircrcoutput
end

Note, the config line controls the magic place to hook things up.  Make sure you replace the line . 😉

Phew!  Now all you have to do is train your Kymera to emit the same buttons as those you’ve been using on your REAL remote, and voila – you have a Raspberry PI that reacts your magic wand.

So. Much. Fun.  Next up… see how to control your TP-LINK HS100 outlets with this rig. 🙂