Hi there! This is my first post to the Arduino forums; I wanted to share my elation in (finally!) succeeding at my first Arduino project. And, since the Arduino BT board costs 70-100 USD more than the Arduino NG, I thought others might also be interested in this as a cost-saving measure. ![]()
In case you've been out of touch with the gaming industry lately: Nintendo's new game system, the "Wii", comes with a distinctive controller called the "Wii Remote" (or "wiimote"). It runs on two AA batteries, communicates over bluetooth, and sports 12 buttons, a 3-axis accelerometer, a tiny speaker, and an IR camera. But most important of all, it has an "expansion port" where you can plug in other controllers (most famously the "nunchuk"). Hackers all over the world have been reverse engineering the Wiimote, and now there is an expansive set of of scripts and libraries for all operating systems whichi allow your computer to communicate with it. Here is one of several comprehensive wiki pages on the Wiimote and its communications.
And now, you can (quite simply) use the wiimote to facilitate wireless communications from your Arduino to your PC! You can also use the accelerometer data or play sounds over the speaker, and progress is being made on decoding the data from the infrared camera. The protocol over the expansion port is 400kHz ("fast") I2C, with the peripheral at address 0x52. You write 8-byte packets and they are sent over the bluetooth to the PC.
(If you're inspired by this post and want to run out and by a wiimote from $39.48 or a bluetooth dongle from $2.95, I'll hope you'll consider using these Amazon referral links.)
The connector on the base of the wiimote is a proprietary Nintendo concoction, but has only 6 pins and should be fairly easy to mate with. (I'm currently using a scavenged Nunchuk.) One you have broken out the six pins, as numbered here, simply attach Pin 1 to your Arduino's AREF, pin 2 to Analog In 5, pin 5 to Analog In 4, and pin 6 (or the outside of the connector) to Arduino's GND. (You can even set the power jumper to EXT and, after programming, disconnect the USB cable and power the Arduino from the wiimote.)
I'm not sure if this part is necessary, but you should also find the file lib/targets/libraries/Wire/utility/twi.o under your Arduino tree, and delete it. Then make two changes to twi.c (in the same directory) before rebuilding: first, find the line "#define ATMEGA8" and make sure it's uncommented (i.e. no "//" in front); second, change the line defining TWI_FREQ to set it to 400000L.
Now, you can write a simple program like this:
#include <Wire.h> Â
uint8_t outbuf[] = {0xf2, 0x79, 0x2e, 0x7d,
        0x4d, 0x43, 0x01, 0xfd}; // sample data set
void receiveEvent(int howMany) {
 while(Wire.available()) {
  char c = Wire.receive(); // receive byte as a character
Â
 }
}
void requestEvent() {
 Wire.send(outbuf, 8);  // send data packet
}
void setup() {
 Wire.begin(0x52);           // join i2c bus with address 0x52
 Wire.onReceive(receiveEvent); // register event
 Wire.onRequest(requestEvent); // register event
}
void loop() {
 delay(100);
}
There are lots of ways to get this data on your pc, for simple python scripts see this wiki page.
Happy Ardwiinoing!