Related articles: Wand-Controlled Robot
As a symbol of the magician’s intentionally directed will-power, the wand is an excellent interface for ritual computing with multimedia, and facilitates physical activity in ways that keyboards and mouses do not. Imagine projecting a giant digital sigil onto a wall, and after using the wand to banish the ritual space, you intone an incantation and thrust your wand toward the sigil which promptly ignites in a blaze of virtual fire. Or you could manipulate a virtual poppet, activate a robot servitor or eldritch machine, etc. There are nearly limitless possibilities.
Here is an example of using a Kymera Magic Wand to manipulate an icosahedron on my computer (sorry the animation is so difficult to see):
The Kymera wand is a programmable infrared remote control device developed and sold by The Wand Company in the UK. It is marketed for television RC.
The Kymera can transmit up to 13 distinct infrared signals in response to these distinct actions:
- Rotate anticlockwise
- Rotate clockwise
- Flick upwards
- Flick downwards
- Flick left
- Flick right
- Tap on top
- Tap on side
- Big swish
- Push forward
- Double tap on top
- Double tap on side
- Pull back
The wand contains a vibrator that pulses a number of times to let you know what state the wand is in, similar to the haptic feedback in video game controllers and cellular telephones. Signal programming is a cinch as the wand records signals from other RC devices. For the example in this article, I programmed my wand with a Sony television RC.
To interface with my computer, I am using an Arduino microcontroller with a Parallax IR receiver from Jameco, and Ken Shirriff’s outstanding multi-protocol infrared remote library. The Arduino translates the IR signals into hexadecimal values which it sends to Processing over the serial port. The Processing sketch draws and animates the icosahedron in response to the hex values received.
Source Code
Here is the source code for what is shown in the above demo video.
Arduino
/** * Wand Test 1 (Arduino) * by Joshua Madara, hyperRitual.com * requires IRremote library by Ken Shirriff * http://www.arcfn.com/2009/08/multi-protocol-infrared-remote-library.html */ #include <IRremote.h> int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results; void setup() { Serial.begin(57600); irrecv.enableIRIn(); // start the receiver } void loop() { if (irrecv.decode(&results)) { // if there is something to send Serial.println(results.value, HEX); // send current value to Processing irrecv.resume(); // receive the next value } }
Processing
/** * Wand Test 1 (Processing) * by Joshua Madara, hyperRitual.com * requires Dimension3D, Shape3D, and Icosahedron by * Ira Greenburg * Processing \ Examples \ 3D \ Form \ Icosahedra */ import processing.serial.*; Serial arduinoPort; Icosahedron ico1; float xRot = 0; float yRot = 0; float zoom = 0; int sw1 = 0; // switch state variable void setup(){ size(800, 600, P3D); arduinoPort = new Serial(this, Serial.list()[1], 57600); ico1 = new Icosahedron(100); stroke(255, 0, 0); noFill(); } void draw(){ background(0); lights(); translate(width/2, height/2); getWandState(); switch(sw1) { case 1: // rotate down xRot-=0.05; break; case 2: // rotate up xRot+=0.05; break; case 3: // rotate left yRot-=0.05; break; case 4: // rotate right yRot+=0.05; break; case 5: // zoom in zoom+=5; break; case 6: // zoom out zoom-=5; break; } //pushMatrix(); translate(0, 0, zoom); rotateX(xRot); rotateY(yRot); ico1.create(); //popMatrix(); } void getWandState() { while(arduinoPort.available() > 0) { String inBuffer = arduinoPort.readString(); if(inBuffer != null) { String theValue = inBuffer.trim(); println(theValue); if(theValue.equals("210") == true) { // flick down sw1 = 1; } else if(theValue.equals("A10") == true) { // flick up sw1 = 2; } else if(theValue.equals("410") == true) { // flick left sw1 = 3; } else if(theValue.equals("C10") == true) { // flick right sw1 = 4; } else if(theValue.equals("E10") == true) { // push forward sw1 = 5; } else if(theValue.equals("610") == true) { // pull back sw1 = 6; } else if(theValue.equals("110") == true) { // big swish sw1 = 0; } } } }
Joshua, I am located in London, seemingly that part is hard to come by via RS or Maplin and delivery from US is about £12 alone… I will research a bit into it but if anyone got this working with another sensor, let me know.
Roger that. I would think that any similar 38kHz receiver should work. Do you have an oscilloscope handy? Are you able to detect any changes at all on the pin you are reading the receiver on? Here is an Arduino sketch that may help, and here is an article describing a Radio Shack module, that is pretty detailed.
I will have a look. Issue is I am in London, so I will have to see if Maplin or RS are stocking anything similar.
This stuff is absolutely marvelous. I’ve been using games and digital media for magic for a long time, but I didn’t know this kind of hardware (and people who were willing to spend the time on it) existed.
Your work reminds me a lot of the music of Coil in visual format. Those two were pretty artistic pioneers in the meshing of tech and magic :D
Hey, there. Thank you for the kind words. Would like to hear about your own works with games and digital media for magic. If you are in Seattle in time for the Esoteric Book Conference, please stop in and say hello. I will have some projects on display there.
Great stuff. I am trying to get the wand working on my arduino uno with a TSOP382 Vishay IR receiver. The code seems to be running but no data. Any idea if there is something wrong with my setup? Does OSX have any effect on this?
Marcus, thank you for your comment. You certainly have a different setup than I, but I see no obvious problems, although I do see two other people have reported problems with the TSOP382 on Arduino (1, 2). Not sure what the capacitor was for in the first example there; looking over the receiver’s data sheet, I see no need for one, at least not for this application. Here is some code from Sparkfun, that you can use to test the receiver without the wand — is that part working OK for you?
If you would post your technical details and code to the Arduino forum, I could help you troubleshoot from there.
Hi Joshua,
no that code didn’t work either. I will have to check if the receiver or wand is not doing it’s job.
Given that, what receiver model DOES work? DO you have a list of those by any chance? Or should I be able to just rip one out of an existing remote?
Marcus, I do not have a list, but I am using one from Parallax, model 350-00014 (cheaper to order directly from Parallax than Jameco, although sometimes I add Parallax parts to a Jameco order, to save on shipping costs).