Getting inside the WiiMote, I2C, PixArt and all that good stuff…

by Stephen Hobley on May 12, 2008

Some of you will have noticed that I was able to modify a WiiMote to do visible light tracking recently. My goal was to produce a gesture tracking system for the laser harp.

This was OK, but having to use Bluetooth, and Windows was a PITA – I needed a hardware only solution that could be wired straight into the harp.

At the recent Maker Faire I talked to Johnny Lee about the amount of information available on WiiMote internals – he directed me to the WiiMote project forum and I was able to locate this post that hinted at how the PixArt sensor could be attached to a microcontroller using I2C.

http://www.wiimoteproject.com/other/red-laser-and-i2c-bus-done-t579.0.html

Post #34 is pretty crucial:

Here’s how I get this to work:
Remove Pixart sensor from wiimote.
The sensor needs a 25 MHz clock signal here’s a circuit and pinout:
http://www.kako.com/neta/2007-001/2007-001.html
Connect the Sensor to your MC (don’t forget the pullups)
The slave address is 0xB0.
Initialise like here
http://www.kako.com/neta/2006-019/wii_ir_test2_src.zip
http://www.kako.com/neta/2006-019/2006-019.html
Now send 0x38
Capture 8 Bytes from slave
Capture 4 Bytes from slave
(I’ve seen this by sniffing the Bus)
I’m not sure about how to interpret the data(Haven’t even tried this yet, maybe it’s like the basic report?)

Some tips:
Kako.com is Japanese I’ve used babelfish to translate to English http://babelfish.altavista.com/
You can connect the sensor to the extension port and use the wiimote as usual. (With 25MHz Clock extern)
If you have problems with desoldering the sensor you can carefully break the case of the sensor. There is a second SMD case around the cam. I’m not responsible on any damages!

Please share your experience with the community.
If somebody knows how to remove the IR filter please post it here!
Does somebody know if the sensor can be used with 5V?

Fortunately the good ‘ol Arduino has everything we need – 3.3v output and an I2C protocol, accessible using the Wiring language.

Here’s a nice article on using I2C with an Arduino

Over the next few weeks I’m going to be trying to create an Arduino/PixArt/WiiMote hybrid that is capable of 200Hz blob tracking and MIDI controller output…

Stay tuned!

But in the meantime – check out LadyAda’s excellent new Boarduino USB!
All the goodness of a regular Boarduino, now with the FTDI chip/USB built right in.

Share

{ 3 comments… read them below or add one }

brutusx September 30, 2008 at 9:55 am

Stephen, I’m only here because of your Pixart/I2C/Arduino work…

I’m looking forward to finding out how you got it all working. There is enough info on “the internets”, but it’s not presented in a user friendly (read: newbie) format. I’m hoping your experience will be well documented for others to try… Thanks again.

shobley January 19, 2009 at 11:23 am

Hi,

I didn’t really do much more work on it – but this year I will be rebuilding the laser harp and so hopefully I will another crack at it.

Have you made any progress?

wang chao September 20, 2013 at 9:01 am

I want to use the STM32 mcro processor to commnicate with the wiimote IR sensor through I2C interface.But the program always stop here” while(!I2C_CheckEvent(I2C1,I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) { }/* EV6 */”, the IRslaveAddress is 0xB0.could you help me?

void I2C_IRsensor_Reg_Write(uchar RegName, uchar RegValue)
{

/*—– Transmission Phase —–*/
/* Send I2C1 START condition */
I2C_GenerateSTART(I2C1, ENABLE);

/* Test on I2C1 EV5 and clear it */
while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_MODE_SELECT)) /* EV5 */
{
}

I2C_Send7bitAddress(I2C1, IRslaveAddress, I2C_Direction_Transmitter);

while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) /* EV6 */
{
}

I2C_SendData(I2C1, RegName);

while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_TRANSMITTED)) /* EV8 */
{
}

/* Send I2C1 data */
I2C_SendData(I2C1, RegValue);

/* Test on I2C1 EV8 and clear it */
while(!I2C_CheckEvent(I2C1, I2C_EVENT_MASTER_BYTE_TRANSMITTED)) /* EV8 */
{
}

/* Send I2C1 STOP Condition */
I2C_GenerateSTOP(I2C1, ENABLE);
}

Leave a Comment

Comments links could be nofollow free.

Previous post:

Next post: