Hacking the Wiimote IR camera

Arduino Technology

wiimoteir_20081122.jpg

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.

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

14 thoughts on “Hacking the Wiimote IR camera

  1. David Cranor says:

    Thanks! You guys are awesome!

    -David (:

  2. Evil Paul says:

    Great post Jason. It’s nice to see something a bit meatier for the Arduino fans to play with. I need to do some 3.3v interfacing and this is handy info.

  3. Nicky says:

    Does anyone know the part number (or supplier) of the IR camera that is uesed in WII? Or was it developed for WII only?

    1. Anonymous says:

      I have been looking for this exact same thing too. As far as I found out so far is that I think Foxconn is the OEM reseller (or maker) of the Wiimote camera, and the actual maker of the camera is a company called Pixart. But everything I have found points in the direction of it only being available for the Wii, I have not found a reseller just yet..

  4. Mohamed Safaa says:

    Hey, I’m working on the same project but using Arduino uno ATMEGA 328, we don’t use I2C as Arduino chip supports 3.3 volt so we connects it directly to the camera and awfully we have no output of the camera, the output of the camera coordinates is just zeros..
    My question here, should I use I2C, or may I use pin 3.3 volt in Arduino?
    Another question if I have LTC 4300A is it an alternative for LTC 4301 L ?
    How to check that Wii camera sensor is still not dead?

    1. Lucas G says:

      Hey!
      if I don’t misunderstand what you’re saying… you must use the I2C lines, otherwise… where you will get the data from the sensor? I think you have to use the I2C lines for data comunication and the 3.3 is the power supply of the sensor, so arduino I2c pins (analog 4 and 5, look at the hardware part on the arduino page for more info) to get data from the sensor (correctly connected, I was looking around, and looks like you need to “reduce” the arduino I2c voltage, as it works with 5v, but maybe i’m wrong so look carefully) and the 3.3 pin on arduino to power up the sensor…
      I hope this can help a bit, sorry if I misunderstood, and just in case (it’s possible that I write no so correct information) read all you can and make sure about it…
      Have a Nice day, and good luck with that!!!

      (sorry for my english… isn’t my “default” language)

  5. Danny Flam (@NewYorkBrass) says:

    Been using several cameras on a board i built with a 25mhz resonator and directly to the arduino 5v i2c lines, with 2k pullups (pulldowns really) to 3.3V with no problem neither on arduino or any other device – even when 3 devices on same bus.

Comments are closed.

Discuss this article with the rest of the community on our Discord server!
Tagged

ADVERTISEMENT

Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).

FEEDBACK