At the end of 2007, I became interested in a Wii media lab for designing novel interfaces. To explore the feasibility, Veronica Paredes, Andrea Rodriguez and myself experimented with several user interfaces that use a wiimote. I found several tricks, which if you have done much of this before, then you already know. But if you would like to learn how to experiment with a wiimote, and have a wiimote, a bluetooth-enabled computer, 15 minutes and $5, I'll share what I learned.
You must already own:
You'll need to buy:
Device Type: Nintendo RVL-CNT-01 Device Address: 00:1A:E9:3F:DB:1E
Mouse.LeftButton = Wiimote.A Mouse.RightButton = Wiimote.B
Now you're ready to begin experimenting with the wii. GlovePIE includes documentation and auto-complete when scripting. It is by far the easiest scripting environment I have used (easier than Python, ActionScript, VisualBasic, Basic, Max/MSP, etc.). It is also robust, supporting all wiimote sensors, nunchuk, a crude 3D renderer, math library, MIDI playback, text-to-speech, and export to Open Sound Control (OSC). This is all described in the GlovePIE documentation (under the Help menu).
// Trivial test of connectivity and identity. Wiimote.Led1 = true Wiimote2.Led2 = true Wiimote3.Led3 = true Wiimote4.Led4 = trueVisualize a variable. Oftentimes you'll want to see what the data is, in a mode easier to understand than a debug message. I represent a gauge of three values to side-by-side to calibrate sensitivity. Here is a script.
One fairly comprehensive test of GlovePIE is a "MIDI clock" that Veronica, Andrea and myself designed. It demonstrates acceleration sensing, 3D visualization, MIDI playblack, and can be configured for text-to-speech. Here is the GlovePIE script. With additional scripts, multiple wiimotes can be connected (2, 3, and 4).
GlovePIE is not a programming environment (it does not support user-defined functions), and slowed down with complex operations. For that, I exported the necessary wii data to OSC and then used SimpleOSC capture the data every frame in a Python application.
For example, in the one-week project, I drove a virtual lever in an ODE physics simulation, by a physical lever with a wiimote strapped to it. Here is the GlovePIE script:
/* Control OSC roll object by roll of wiimote. */ var.debug = true // OSC Osc1.port = 9001 Osc1.ip = "127.0.0.1" Osc1.broadcast = true Wiimote.Led1 = true // - roll sticks var.angle = wiimote.Roll//Smooth( wiimote.Roll, 10 ) // - pitch Sticks. //var.value = Smooth( wiimote.Pitch, 5 ) Osc1.angle = var.angle if var.debug == true then debug = 'angle: ' + var.angle + ' battery: ' + Wiimote.Battery + '/255.00' obj.Size = [1,0.05,0.05] m obj.roll = var.angle obj2.CubeSize = 0.1 m camera.z = -2 m endif
And here is the Python script that got the angle, using SimpleOSC module.
import osc
def osc_init(self):
osc.init()
self.osc_socket = osc.createListener('127.0.0.1', 9001)
osc.bind(self.set_target_angle_to_osc, "/angle")
# osc.bind(osc_test.printStuff, "/angle") # DEBUG
def set_target_angle_to_osc(self, *msg):
self.target_angle = msg[0][2]
def update_osc(self):
if hasattr(self, 'osc_socket') and self.osc_socket:
osc.getOSC(self.osc_socket)
Wiimote can control Windows Media Player. An included script does this. But the control is sluggish, because Windows Media Player is sluggish.
Wiimote can remap to just about any application. It can, for example, be used to paint in Photoshop with an IRmouse. However, the software is not optimized for this control remap and the IR mouse is somewhat shaky.
It's fun to use the wiimote like a rattler that creates speech. For example:
// text to speech test.
if wiimote.RelAccX <= -10 m per s per s
Say("Wii Wii We Wo Wa Wow Whoa")
//Say("Hello world")
endif
if wiimote.RelAccY <= -10 m per s per s
Say("Woooooooooooo")
//Say("Hello world")
endif
if wiimote.RelAccZ <= -10 m per s per s
Say("Waaaaaaaaaaaaaaaa")
//Say("Hello world")
endif
The camera only has a viewing angle of about 45 degrees. Furthermore the LED on has an emission angle of about 45 degrees, so wide ranges movement, such as swinging your arm or holding a stylus at various angles are not received. This hampered the use of a chopstick interface, because two wiimotes are used for triangulation, and the volume that contains the chopsticks is constrained, as are the angles at which the chopsticks can be held.
At this point, hopefully you have enough examples to start experimenting. I have a lot more to learn, and would enjoy learning from your experiments on the wii.