“WiiChuck” Wii Nunchuck Adapter Available

Want to hook up a Wii Nunchuck to an Arduino but don’t want to cut up the cord on your Nunchuck? Yeah me too. So I made some of these:

wiichuck_adapter1.jpg

wiichuck_adapter2.jpg

It’s a small PCB that adapts the Wii Nunchuck connector to standard 4-pin header. I call it the “wiichuck adapter”. It plugs directly into the Arduino, no wiring necessary. You can get one too for $4.

Available from the following wonderful shops:
FunGizmos.com. FREE DOMESTIC SHIPPING. International shipping for $1 more.
Little Bird Electronics (Australia)
SparkFun. Ships domestic & internationally. Be sure to order header pins too!
– and just about any SparkFun distributor

One of the coolest things about the Wii (to me) is that the expansion port on the bottom of the Wii remote is an I2C serial connection. This means that anything that plugs into that port can work with microcontrollers like the Arduino or Basic Stamp or others. Of the available peripherals, the Wii Nunchuck is one of the best. It contains a 3-axis accelerometer, a 2-axis joystick, and two buttons. Hooking up a Wii Nunchuck to Arduino is easy and I have class notes describing how to do it. But cutting off the connector of the Nunchuck to get at the wires is a little drastic.

This “wiichuck adapter” let’s you play with the Wii Nunchuck and other Wii remote peripherals without needing you to cut cables. Just plug it into the Wii Nunchuck, then into the Arduino, in to Analog In pins 2,3,4,5. Pins 4&5 are the I2C communication pins and Pins 2&3 can act as the power supply for the Nunchuck.

wiichuck-diag.png

This is what it looks like plugged into the Nunchuck by itself.

wiichuck_adapter3.jpg

Nunchuck and Other I2C Devices (like BlinkM)

You can use other I2C devices at the same time as the Nunchuck. The I2C bus allows for multiple devices. For instance, if you have a BlinkM and also want to use a Nunchuck, no problem. The pinout of the BlinkM and the wiichuck adpater are the same. Just solder a little 4-pin socket header to the top of the wiichuck adapter.

wiichuck-header.jpg

And then you can plug in a BlinkM right on top.

wiichuck-blinkm.jpg

Software

To make it a little easier to play with the Nunchuck, I made a little Nunchuck library for Arduino and demo:
nunchuck_funcs.h
WiichuckDemo.ino
(Or better yet, check out the github repository for it all zipped up. Just unzip and open the .ino in Arduino)

It is based off the original research done by Chad Philips of Windmeadow Labs. The library uses the Wiring I2C library called “Wire”. This library is built-in to Arduino, as long as you have the latest Arduino development environment (0010 currently). To see another Arduino sketch using this library, you can check out the BlinkMChuck example that’s part of the BlinkM examples.

The library functions are:
nunchuck_setpowerpins() — power up a nunchuck plugged directly into an Arduino on analog pins 2,3,4,5.
nunchuck_init() — init a nunchuck connected to an Arduino
nunchuck_get_data() — get a data packet from the Nunchuck

Then you can get at the data packet using various helper functions like:
nunchuck_accelx() — get X-axis acceleration
nunchuck_zbutton() — get Z-button state
– …and so on, see the header file for a complete list

Nunchuck Information

Wiimote/Extension Controllers/Nunchuk — info page about the Nunchuck on WiiLi (Linux for Wii) site
“Wiimote Accessory Bus” — docs about the Nunchuck’s connector.

Getting One / How to Order

Available from the following wonderful shops:
FunGizmos.com. International shipping for $1 more.
Tinker.it (UK)
Little Bird Electronics (Australia)

Update 20 Feb 2008: Over 200 wiichuck adapters sold to more than 50 people in 5 countries. I still have some available if anyone wants one. To those who ordered up to now, you’ll be getting them in the post in a few days.
Update 29 Feb 2008: Over 300 wiichuck adapters sold and I still have many more left. Get yours if you want one. :-) Anyone that’s ordered before today should receive their adapters via first class post soon. I’ll be unable to mail out any orders for the first week of March.
Update 24 Mar 2008: I still have several left. If you’re in AU, you can also get the adapter kit from Little Bird Electronics.
Update 11 Apr 2008: Updated the nunchuck_funcs.h library to easily work with a nunchuck plugged directly into an Arduino by adding a nunchuck_init_with_power() function (see comments below). Also, I still have several adapter kits for sale.
Update 6 May 2008: All Out! But I’ll be doing another board run in a few days and will update here when I have more available.
Update 8 Jun 2008: FunGizmos.com is now carrying Wiichuck adapters! They also have lots of other cool things, like BlinkMs. :-)
Update 7 Jan 2009: Both FunGizmos.com (US) and Tinker.It(UK) carry the Wiichuck adapter.
Update 31 Mar 2009: Fixed small bug that made it not compile under more recent Arduino, and fixed links. Also: if you’re having problems getting this to work, in the Arduino software, go to the “Boards” menu, switch to a different Arduino board type, compile, then switch back to your type. This forces a recompile of the Arduino I2C/TWI library that sometimes doesn’t get compiled correctly.
Update 18 Feb 2010: Updated API description to note that “nunchuck_init_with_power()” was removed in favor of “nunchuck_setpowerpins(); nunchuck_init();”.
Update 6 Dec 2011: Updated to work with Arduino 1.0 (still works with Arudino 0023 too). Changed download links to github repository.

299 Replies to ““WiiChuck” Wii Nunchuck Adapter Available”

  1. Hello,

    There is alternative Wii Nunchuck adapter at Hot Solder.

    Hot Solder

    You can download the design files and C example code. There is no Arduino examples, but it may be useful none the less.

    Regards

    Iain

  2. one more bit of info….the program as is, only read the i2c data once…i must insert


    Wire.send (0x40);

    before

    Wire.send (0x00);

    in the send_to_zero function to get continuous serial output.

  3. Has anyone had any success with the intec wired nunchuk? I have tried everything that I could find on here and elsewhere…I have modified all the examples, and have got it to the point that the Serial ouput is displayed, but it is always


    255 255 1023 1023 1023 1 1
    255 255 1023 1023 1023 1 1
    255 255 1023 1023 1023 1 1

    I have tried the solutions that I could find on here, and I am wondering if it is an initialization issue, or a byte decoding issue…any suggestions?

  4. Hi phate,
    It’s not possible to use more than one nunchuck without additional circuitry, as far as I’m aware of. There have been some discussion on how to do this (in the comments on this post even I think), but I’ve not tried it.

  5. Hi

    I’m having troubles with my arduino and nunchuck. Ive tried with 2 different arduinos and 2 different nunchucks but it keeps freezing at the init() every time. How can i fix this?
    IDE 0018 duemilanove with 168 and diecimila with 328

  6. PS. the 10 bit read out is also provided by Jeff H and both should be on page 7 off these comments

  7. Hello all and tod,

    I’ve got a WARNING for those using a “Black nunchuck”:
    It will only run/work on 3.3v power.
    If you use it with 5v you’ll only get maxed out values however it is not blown up,
    run it on 3.3v and it will work like a sunnyday.

    If you are using a nunchuck that will work with 5v you can use the folowing void setup() instead of the one provided in the wiichuckdemo
    to power your nunchuck and plug it directly in your Arduino Mega

    void setup()
    {
        Serial.begin(9600);
        
        
        pinMode(19, OUTPUT);
        digitalWrite(19, HIGH); //Plus 5v to power pin
        pinMode(18, OUTPUT);
        digitalWrite(18, LOW); //gnd pin
        
        //nunchuck_setpowerpins();
        nunchuck_init(); // send the initilization handshake
        
        Serial.print("WiiChuckDemo ready\n");
    }

    Please note that this is meant for the Arduino Mega and can be used for any I2C appication like BlinkM.

    Also if you use the Z and C button functions by Jeff H you’ll need to add an ‘!’ before the returning value,
    otherwise the code will give an inverted value of what is acctualy bieng pressed, making the functions look like this:

    // returns zbutton state: 1=pressed, 0=notpressed
    static int nunchuck_zbutton()
    {
        return !((nunchuck_buf[5] & 0x01) == 0x01);  // voodoo
    }
    
    // returns zbutton state: 1=pressed, 0=notpressed
    static int nunchuck_cbutton()
    {
        return !((nunchuck_buf[5] & 0x02) == 0x02);  // voodoo
    }
    

    And last:
    If you use the 10 bit read out for the nunchuck accelerometer be sure to store the data in an int not a byte,
    I made that (stupid) mistake. (It’s so hot in here that I can’t thing straight and starting to make beginner mistakes (no offence).)

    ^.^

  8. Hi Simpson,
    The accelerometer system in the Nunchuck is 8-bit resolution over +/-2g, per axis. That’s a range of 0-255 for 4g of acceleration. If you’re just measuring tilt, then a single axis will range from 0g to +1g to -1g (corresponding, say, to no tilt, 90º right tilt, 90º left tilt)

    So this means you get a range of 127 values to measure 180º, for static tilt measurements, and thus you can hope for 180/127 = 1.4º resolution.

    In practice it seems not this good, maybe 3 or 4 degrees resolution.

  9. Very interesting !
    I need a digital spirit level for a work related project and as beginning AVR programmer I’m very interested in projects like these.

    There’s one thing that’s not really clear to me since I have no experience with Wii Nunchucks. (sofar I only hit my head once with a real one ;-) What resolution can I expect from an intact wii nunchuck ? I’d like to have a high resolution within a -5 to +5 degree angle measurement (x or Y axis). I could… build an opamp circuit attached to the analog x/y outputs of the accelerometer to get a high resolution by feeding the output to an ADC-pin. But maybe the I2C output of the nunchuck already is good enough.

  10. Hi,

    I’m having problems to get any real data out. Only get these values running, no change what so ever:
    accx:255 accy:255 zbut:0 cbut:0

    Any clue what could cause this? Do I need to touch twi.h file? Running latest 0018 arduino under OSX.

  11. JJ, you should download the Wiichuckdemo.zip bundle, unzip it so that it creates a Wiichuckdemo folder, then go into Arduino and open up the Wiichuckdemo.pde file in that folder. In Arduino you should see two tabs, one for each file. Arduino needs to have nunchuck_funcs.h in the same directory as the sketch file.

Leave a Reply

Your email address will not be published. Required fields are marked *