Goofing around with the Wii Remote
In between sessions of zelda (currently in the Lake Temple, total elapsed time just over fourteen hours), I’ve been considering just how cool the Wii Remote controllers are. For $40 (admittedly, quite a bit for a controller) you get a controller with the following nifty features:
- It communicates wirelessly via Bluetooth, which opens up a whole bunch of possibilities for using them on other machines.
- They include a fair supply of buttons, and a “rumble pack” force feedback device.
- You can play sound back through the remote.
- It’s got four LEDs that you have individual control over.
- It has a three axis, 3.6g accelerometer, so you can read acceleration and orientation from the remote.
- It has an imaging infrared sensor that can be used to determine your orientation compared to the Wii sensor bar.
In short, it’s just a damned cool little device all to itself. I was surfing and discovered wiili.org, a site which is all about wii hacking, and they include links to drivers and libraries for reading the Wii controller on different devices. A download of libcwiimote later, and a bit of programming, and I was reading acceleration data from the remote. Behold the following graph plotted with gnuplot:
Near the beginning, I am holding the remote fairly steady. The red, green and blue lines measure the acceleration in x, y, and z, respectively. Notice that the blue line is offset. This is because of the acceleration due to gravity. Later in the test, I whirled the remote around in circles, which you can see by the rather chaotic motion.
I’m currently working on a little interactive display using OpenGL. More later.
Addendum: A little smoothing of the data makes it look much better. Here’s a different run, with some smoothing…