As you’re probably well aware, the wiimote and nunchuck have a vast array of sensors built into them. Instead of buying pre-assembled breakout board for $35, or attempting to solder a tiny surface mount accelerometer, learn to exploit the features of the Wii Nunchuck and have a fully assembled accelerometer, joystick, and pushbuttons for just $12.50 shipped (on ebay).
Why use the nunchuck insead of the actual WiiMote? Wiimotes can be about $40 and have a lot of extra features you wont need at the moment. Plus, the nunchuck has a cable which can easily be plugged into the Arduino. Of course, there are plenty of other ways to connect the wiimote to your pc but this way we can interact with other hardware using the Arduino. If you’ve never used the Arduino, see our tutorial.
1. Connect the Nunchuck to your Computer
The Nunchuck communicates through 6 bits of data. To read this data, you’ll need to connect the wiimote to a microcontroller. In this case we’ll use the Arduino. You can either cut the cord on your Nunchuck or purchase an adapter so it fits snugly into your Arduino programmer board. View more detailed instructions about connecting the nunchuck and I2C (how they talk to each other).
2. Setup the Software and Download Code
If you don’t already have it, download the Arduino software (free). Next, download the code which deciphers the 6 bits of data send from the Nunchuck and prints it to your computer’s serial port. To learn more about how this communication works, see the author’s tutorials or the original source.
3. Resulting Output
By using the serial monitor of your Arudino software (or other serial monitoring software), you’ll see the above output. Sure, view the results as numbers is fine, but visually representing data in real time is far sexier. Using a program called Processing, you can read the above data and display it like the image below. See our thorough tutorial about how to graphically visualize data.
4. Visualizing Data in Real Time
Watching numbers steam in (step 3 image) is fine and dandy, but sometimes you just need something more to create a truly new perspective. Processing is the program I’ve used, it’s pretty easy to learn, uses the same interface as Arduino, and can render 2D and 3D visualizations with small amounts of code. Check out our tutorial to learn how to graphically visualize data.
Now that you’ve learned how to read data from a nunchuck as well as data visualization, go make something awesome and don’t forget to subscribe to HacknMod for more fantastic posts.