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.
Hi, i’m new in this arduino stuff and i am experimenting some issues on my own, first i’m not getting any god response from the arduino you see when i start running the COM board i only see zeros, then when i press the reset button and i move the joystick the values from the axes turned into 255, and the “zbut” and “cbut” still zero, i already saw the connnection of the arduino and the nunchuk and it’s ok any sugesstions?
Hi Richard,
Did you download the WiichuckDemo.zip zip file, uncompress it, and open the .pde file in there? That zip is all setup to work well on Arduino 0023 and earlier. (It doesn’t quite work yet for Arduino 1.0)
Do not put the “nunchuck_funcs.h” file in a “libraries” directory. It won’t work. It should be in the same directory as the WiichuckDemo.pde file.
“Hi
I’m new to Arduino and an having trouble with teh WiiChuckDemo.
Whenever I run verify the demo I get loads of errors, with the top one being
‘WiichuckDemo.cpp:9:28: error: nunchuck_funcs.h: No such file or directory’
Looking at the Arduino help, I’ve created a libraries folder under my project folder (with the nunchuck_funcs.h inside), but still get same errors. I’ve also stuck libraries folder in a number of places, but no success.
Any suggestions?
Thanks”
Same problem as Martin.
How did you fix it Martin?
I’m having the same problem as SA_Engineer, no output from the nunchuk (4.7v measured across + and – but constant v between – and c or d). I assume it must be a faulty unit? any other explanations?
I know the WiiChuck adapter will work with most Wii expansion controllers, but I noticed today that the adapter fits into the GameCube controller port, Does the GameCube controller use the I2C bus to communicate and can I possibly use the GameCube controller with the WiiChuck
Hi, I’m using the wii nunchuk and arduino. I connected and all good.
but, as I can convert the data information in angles and “G”?
AccX = 512
AccY = 524
AccZ = 740
What members of the Arduino family will this system of input not work with?
I’ve got here both the one named for 2009, and the Mini, and was looking at the Ardweeny in September at the Maker Faire that was held in Queens at the Worlds Fair grounds. (Of course for that one I’d also need its attending prototype fixture that the thing plugs into to make using it easier. The firm calls it a ProtoShield.)
For the mini it depends on the chosen I/O pins I believe, there are three on the board itself that the user is required to connect to directly, because of manufacturing issues.
Hey Martin I’m having the same problem with the ‘WiichuckDemo.cpp:9:28: error: nunchuck_funcs.h: No such file or directory’ How did you fix it? Thanks!
Thanks for the code, it worked right away! I’m using an Arduino Fio with this and wonder how I can change the pins to 4,5,6,7 instead? It would put it in better placement.
Scratch That. Got it working.
Thanks
Hi
I’m new to Arduino and an having trouble with teh WiiChuckDemo.
Whenever I run verify the demo I get loads of errors, with the top one being
‘WiichuckDemo.cpp:9:28: error: nunchuck_funcs.h: No such file or directory’
Looking at the Arduino help, I’ve created a libraries folder under my project folder (with the nunchuck_funcs.h inside), but still get same errors. I’ve also stuck libraries folder in a number of places, but no success.
Any suggestions?
Thanks
Wow, that was quick. Thanks a lot! :D
Sounds like the baud rate on the Serial Monitor in the Arduino software is not set to what the sketch transmit at (which is 19200, I believe)
n00b question (sorry!) — I run the demo program on my Duemilanove (328) with the nunchuck plugged in, and all I get in the serial monitor is a row of letters with funny accents on them. The letters change as I move the nunchuck (so I guess there is some data transfer), but I can’t seem to get any numeric output.
Here’s an example of the output I’m geting: “þ÷óþþþúþ÷ûûûþóÿ÷ûþûû÷ûþ”
Quick question. Why types of issues would there be with combining the Wii Nunchuck code with this Roomba code?
http://www.netfluvia.org/layer8/?p=127
http://roombahacking.com/software/arduino/RoombaBumpTurn.pde
I have a wireless Nunchuck and all of the proper cables and wires for hooking both it and my Roomba. I am thinking of making a program that moves the Roomba forward, back and turning at different speeds (I hope) with the Analog Stick, Turbo (just make it go as fast as it can) with the Z button, and all-stop (break) with C button.
Would there be any issues with talking to and getting back information from either device?
Morning SA_Engineer,
With I2C the clock and data lines are pulled high. The slave (nunchuck) has to pull them low. Since you are seeing all one’s (The 255 is just 8 bits worth of one’s.) it sounds like you are getting no response from the nunchuck.
Is it something as simple a bad connection between the nunchuck and the arduino? Is the nunchuck connector upside down perhaps?
I do not think the ‘328 has anything to do with it. For reference, I used the Arduino v22 and Tod’s s/w available this morning (July 23).
Good luck,
Michael
I am not sure what I am doing wrong, but I cannot get the data to update. It finishes setup then proceeds to show the same row of data (255 255…1 1) no matter what I do to the nunchuck. I am using an arduino with ATMEGA328. I don’t know if this has anything to do with it. I also am not too confident that the wire library is correct. Has anyone had any issues like this? If so, please help