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:
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.
This is what it looks like plugged into the Nunchuck by itself.
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.
And then you can plug in a BlinkM right on top.
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.
I’m both new and stupid. It works great after making your suggested changes. Thanks!
Hi Jim,
That’s the error you get when you just have the .pde file in your sketch directory not both the .pde file and the “nunchuck_funcs.h” file. Try downloading the WiichuckDemo.zip bundle linked above, unzip it into a directory called “WiichuckDemo”, and open that up with the Arduino software. You should see both files open in the Arduino editor. Then you should be able to compile and upload it.
I am trying to run Tod’s example and have hit a wall. I am getting the error:
28: error: nunchuck_funcs.h: No such file or directory In function ‘void setup():
In function ‘void loop()’:
I am new to all this and would appreciate any help that someone could offer.
Thanks.
FunGizmos.com has a huge amount in stock now.
Hey Tod
Any news on when you’ll be making or sending out new adapters? Can i get one from you personally? Everywhere else is sold out.
Thanks
Where can you get a few of these? Littlebird are out of stock, Fun Gizmos only have one and I want 3, and Tinker.It wont ship to Australia.
Do I have to sell a kidney to get one?
I’ve been having problems with the wireless adapters as well. Plug in a wired Wiichuck to the Arduino – nice clean signal, accurate responses. But insert the wireless link in between and it’s noisy as all get out – values jump all over the place without any movement or button presses. Both work fine with the Wii (Lego Batman). Think there is some subtle difference in the timing or the frequency? I’d experiment more if I had the time.
Hello Tod! I have the BlinkM nunchuck sketch set up with all the necesary library’s but it won’t compile in any version of arduino!The bar where compiling starts goes from blue to brown and nothing else.Thanks, Robbie
Sup?
I have NO HACKING EXPERIENCE WHATSOEVER…
just makin’ dat clear… Could this allow the Guitar Hero World Tour guitar to be used as a game controller? Cuz then I could ROCK on Frets on Fire!!!
http://fretsonfire.sourceforge.net/about/
Mr. Awesome
I picked up a Nyko Kama wireless nunchuck, hoping to use it with the WiiChuck:
http://www.gamestop.com/Catalog/ProductDetails.aspx?product_id=68826
It doesn’t seem to be powering up. (It works OK with the Wii, and a regular nunchuck is working OK with my WiiChuck and Arduino.) Has anyone else tried one of these?
Please keep in mind that some of us are just learning. I also need some basic instructions on what to do with the nunchuck_funcs.h file. I’m getting the following error with the following code:
error: stray ‘\’ in program In function ‘void setup()’:
In function ‘void loop()’:
void setup()
{
nunchuck_init_with_power();
Serial.begin(9600);
}
void loop()
{
if (nunchuck_zbutton())
{
Serial.println(”Z”);
}
delay(500);
}
If I do:
#include “WProgram.h”
#include “nunchuck_funcs.h”
I get this error instead:
hardware\libraries\nunchuck_funcs/nunchuck_funcs.h:13:18: error: Wire.h: No such file or directory
In function ‘void loop()’:
I have copies of that file in the hardware\libraries tree AND my sketch folder!
Hi, I’m not sure what you’re asking. You can just drop the nunchuck_funcs.h file in your sketch directory and use the functions like they were library functions.
How do I get the text of the code in the nunchuck_funcs.h link on your page built into an Arduino library?
Thanx
And Brian, I think you’re right. If you want to read multiple nunchucks, it should be possible with a bit of extra hardware like a few transistors acting as switches. Read one, switch to the other, read it, switch back, etc.
Hi Dave,
Yeah, Arduino 0012 changed how sketches are compiled, causing problems for the ones that have include files that contain code. Try adding a
#include <WProgram.h>
right before the#include "nunchuck_funcs.h"
Getting some problems using this in 012.
Code:
#include “nunchuck_funcs.h”
void setup()
{
nunchuck_init_with_power();
Serial.begin(9600);
}
void loop()
{
if (nunchuck_zbutton())
{
Serial.println(“Z”);
}
delay(500);
}
Errors:
Applications/arduino-0012/hardware/libraries/nunchuck_funcs/nunchuck_funcs.h: In function ‘void nunchuck_init()’:
/Applications/arduino-0012/hardware/libraries/nunchuck_funcs/nunchuck_funcs.h:22: error: ‘Wire’ was not declared in this scope
/Applications/arduino-0012/hardware/libraries/nunchuck_funcs/nunchuck_funcs.h: In function ‘void nunchuck_send_request()’:
/Applications/arduino-0012/hardware/libraries/nunchuck_funcs/nunchuck_funcs.h:51: error: ‘Wire’ was not declared in this scope
/Applications/arduino-0012/hardware/libraries/nunchuck_funcs/nunchuck_funcs.h: In function ‘int nunchuck_get_data()’:
/Applications/arduino-0012/hardware/libraries/nunchuck_funcs/nunchuck_funcs.h:69: error: ‘Wire’ was not declared in this scope
Any ideas?
Cheers
clever…is it possible to use 2 nunchucks on the i2c bus of the arduino? perhaps with the use of a multiplexer or some sort of switch for the DATA line? (since both nunchucks have the same address)
bd