Arduino Technology


You can connect to the Wii remote over bluetooth or use an Arduino to send peripheral data to the Wiimote, but what if you want to interface directly with the Wiimote’s IR camera? The sensor is particularly good at tracking coordinates for 1 to 4 points—it could be a simple way to add sophisticated tracking capabilities to your own project.

David Cranor writes,

There is a great site about hacking the wiimote IR camera to interface it with a computer – but it’s all in Japanese! Perhaps you could post these links and see if anybody could translate it?

This page details how to desolder the camera itself and build a standalone circuit for it so that it can be connected to an I2C bus, and subsequently a computer (i think, anyway – the schematics are in English, and there’s a video).

And this page talks about how to connect the camera to an Arduino via some of I2C shield that he’s built.

I’d really like to have access to this information for my projects, so if somebody would be able to translate these pages, that would be awesome!

A quick run through Google’s Japanese to English translator yielded a reasonably understandable result:

Wii IR sensor connection details
Connecting the Wii IR sensor to Arduino

The second link contains a wealth of information on talking to the IR sensor over I2C, including some details on adjusting sensitivity parameters. The translation is a little rough, but combined with some of the sample code, I think I have the gist of it:

To initialize the IR camera, you have two options: 1) a simple, default initialization or 2) an initialization that allows you to specify 4 configuration parameters that affect the sensitivity of the device.

Simple Initialization:
Just write the following byte sequences, with a small delay between writes (assumes a successful ACK). The first byte on each line is the register you are writing to.
0x30 0x01
0x30 0x08
0x06 0x90
0x08 0xC0
0x1A 0x40
0x33 0x33

Initialization with sensitivity setting:
The author defined 5 sensitivity levels, and there are four parameters (p0, p1, p2, p3) that are adjusted for each level. Here are the settings:

Level 1: p0 = 0x72, p1 = 0x20, p2 = 0x1F, p3 = 0x03
Level 2: p0 = 0xC8, p1 = 0x36, p2 = 0x35, p3 = 0x03
Level 3: p0 = 0xAA, p1 = 0x64, p2 = 0x63, p3 = 0x03
Level 4: p0 = 0x96, p1 = 0xB4, p2 = 0xB3, p3 = 0x04
Level 5: p0 = 0x96, p1 = 0xFE, p2 = 0xFE, p3 = 0x05

Quoting the Wiimote Wiki IR sensor page, these parameters correspond to:
p0: MAXSIZE: Maximum blob size. Wii uses values from 0x62 to 0xc8
p1: GAIN: Sensor Gain. Smaller values = higher gain
p2: GAINLIMIT: Sensor Gain Limit. Must be less than GAIN for camera to function. No other effect?
p3: MINSIZE: Minimum blob size. Wii uses values from 3 to 5

Either pick your own custom settings for the parameters, or choose them from one of the 5 levels above, then send the following data to the device:

0x30, 0x01
0x00, 0x02, 0x00, 0x00, 0x71, 0x01, 0x00, p0
0x07, 0x00, p1
0x1A, p2, p3
0x33, 0x03
0x30, 0x08

The author also links to the following source, which serves as a helloworld for reading sensor data directly from the IR camera:

Wii Remote IR sensor test for Arduino
Wii Remote IR sensor test for ATMEGA168

Finally, since the IR sensor is a 3.3v device, you’ll want to do a little voltage conversion before interfacing it directly with a 5v device like your typical Arduino (Arduino Pro users don’t have to do a thing). Sparkfun has a guide for using 3.3v electronics with 5v microcontrollers, which should be all you need. It makes me wonder if anyone sells a pre-built 3.3v shield.

Hopefully this is all you’ll need to get things working. Make sure to send us a tip if you make something cool using the Wii IR sensor.

HOWTO: Make a Wiimote peripheral
Hook your Wii nunchuck up to an Arduino