arduino as wiimote extension

Hi all.

I'm struggling with using a 'duino as a Wii extension. In a nutshell, I'm trying to have the 'duino masqurade as a nunchuck.

I'm working with wiiuse 0.12, BlueSoleil 6, (I think) the WIDCOMM stack, and the Arduino sketch from
windmeadow {dot} com / node /37

Things are almost working .... I get the following output from wiiuse:

wiiuse v0.12 loaded.
By: Michael Laforest <thepara[at]gmail{dot}com>
[INFO] Connected to wiimote [id 1].
Connected to 1 wiimotes (of 1 found).

--- CONTROLLER STATUS [wiimote id 1] ---
attachment: 0
speaker: 0
ir: 0
leds: 1 0 0 0
battery: 0.395000 %
[WARNING] Unknown expansion type. Code: 0x2c30ffff

I've tried adding an init handshake to the sketch's setup routine, but still no luck:

void
setup ()
{
Wire.begin (0x52); // join i2c bus with address 0x52
// this is the nunchuk address.
// all nunchuks use this address
outbuf[0] = 0xa4;
outbuf[1] = 0x40;
outbuf[2] = 0x00;
Wire.send (outbuf, 3);

Wire.onReceive (receiveEvent); // register event
Wire.onRequest (requestEvent); // register event
}

And I've also tried send 0x00 (ack?) after every 6 bytes of data. Still no luck!!

Anyone have any ideas or suggestions?

Thanks,
Tim.

You should use code brackets: its the button in the editor with a # on it.

You can highlight your code and click this button.

I got Frank Zhao's Wiimote Extension Library from here:

and ported it over to the Arduino this afternoon.

My sketch is working with Frank's library, appears to be handshaking with the Wiimote correctly, then transmitting consistently to the Wiimote, which in turn reports to the PC .... the issue to solve appears to be the Arduino/Nunchuck ID.

There are several different web sites and Wiimote libraries available ..... and each one documents or expects something slightly different! It doesn't seem to matter what ID I use, it's always garbled by the time it prints to a console on the PC side. For example, using the Guitar Extension ID
0x00 0x00 0xA4 0x20 0x01 0x03

wiiuse decrypts and reports the extension ID
0xa4200103

Once again, and thoughts, ideas or suggestions?

Thanks,
Tim.

For example, using the Guitar Extension ID
0x00 0x00 0xA4 0x20 0x01 0x03

wiiuse decrypts and reports the extension ID 0xa4200103

Those look the same to me. The second version has leading zeros supressed, and the byte squished together, but it's the same bits...

Using the Wiimote Extension Library, I have successfully had the Arduino masquarding as a Guitar Hero 3 controller!!!! Only took 3 days from cutting the Nunchuk cord to seeing "Guitar Hero 3 extension attached" on the console.

Next week I'll be building a custom controller and writting this up for the Playground.

Gotta love Arduino :sunglasses:

westfw:
Not sure what was going on with the leading zeros, or why they were being suppressed, but that was an example of what I meant by "garbled." With a few tweaks to library to make sure encrypted bytes are sent to the wiimote, it all works, so I'm assuming the dropped zeros were related to encryption/decrytion on the PC driver side.

Tim.