The Boarduino is an Arduino work-alike kit from Adafruit.com that’s smaller, cheaper, and you can build it yourself.

boarduino

The Boarduino’s small footprint made me want to see how small of a device I could whip up in an hour from some fairly complex components. So I decided to see how small the combination of a Boarduino, a Wii Nunchuck, and a hobby servo motor could be. Here’s a little video of the result.

Hardware

The Wii Nunchuck is an amazing piece of technology. For $20 you get a 3-axis accelerometer, a 2-D analog joystick, two buttons, and it’s all accessed via the standard I2C protocol. A hobby servo is another piece great tech; only one wire is needed (besides power & ground) to specify the angle the motor should turn to. And both of these devices can plug straight into a Boarduino or Arduino board.

The schematic, such as it is, for the device in the video is:
boarduino with nunchuck and servo

Code

The code that the {Bo}arduino is programmed with is:
- wii_nunchuck_servo.pde
It borrows heavily from the great work done by Chad Philips at Windmeadow Labs.

About Boarduino

The Boarduino is small programmable microcontroller and is an Arduino work-alike. It uses the same programming software as Arduino and can substitute for an Arduino in any Arduino projects.

A Boarduino might be better for you if want a smaller and cheaper Arduino and don’t like running wires between your Arduino and a solderless breadboard. The Boarduino is made to be plugged into a solderless breadboard.

All its pins are at standard 0.1″ spacing.

This ends up being cheaper than the standard Arduino prototyping solution of a “shield” board that plugs onto the top of an Arduino board, especially if you do lots of projects. The Boarduino does cover up a substantial part of a breadboard. If this bothers you, there is the Bare Bones Arduino clone from Modern Device.

One of the ways Boarduino is so tiny is that it omits the USB-to-serial interface chip that is part of every Arduino board. Having that always present is really convenient, but it takes up space. The company that makes that chip, makes a cable that with the chip embedded into it.

Adafruit sells this cable, cheaper than anywhere else if you buy it with a kit. If you have multiple Boarduinos, you only need one FTDI cable for them all. And the cables are useful for other little non-Arduino projects that require a USB-to-serial connection.

The Boarduino comes as an easy-to-solder kit, with excellent step-by-step instructions. In fact, the instructions are so good, with schematics and board layout files, you could build your own Boarduino without buying a kit from Adafruit, but they’ve done all the hard work so you just have to solder it together.

This is what the Boarduino kit looks like out of the bag:

If this is off-putting to you, don’t worry. These are really standard parts that are hard to mess up. Adafruit’s documentation not only walks you through what the parts are and how to turn the kit into a working board, but also what tools you’ll need (with links) to get the job done. If you’ve soldered anything before, this will take you about an hour. If you’ve never soldered before, set aside a few hours. At the end you’ll have both an extra useful skill and a new working gizmo.

Finally, if you begin to grow out of the Arduino coding environment, the Boarduino is also a nice little inexpensive AVR ATmega{8,168) development platform. It contains the standard 6-pin ISP header that works with any AVR programmer.

If you like Arduino or AVR stuff, pick up a Boarduino and play with it. Then you too can make Frankensteinian devices like this:

44 Responses to “Boarduino, Wii Nunchucks, and Servos”

[...] Boarduino, Wii nunchucks and servos - Link. [...]

[...] His videography quality is disturbing, and makes me look bad! Check out more about the project including a nice video, on his todbotblog. [...]

your documentation makes me look bad! ;)

I did this a few weeks ago using 2 servo’s with wheels attached and a nunchuck, trying to make a balancing bot. kinda like a segway. It is really amazing how in very little time one can make a simple prototype using an arduino. b.t.w. the servo’s weren’t fast enough to keep the bot from falling over but I just like to experiment. I like your tutorial.

Hi Bart,
There are a many different types of servos. It might be you could find one with a faster “slew rate” that would work for a balancing bot. I’ve not tried it. The standard hobby servos trade off power consumption for slew rate. To move a mass very fast requires a lot of power for a short amount of time.

[...] + Tod E. Kurt plays around with the BoArduino. [...]

I wasn’t able to see the video in Firefox on Linux. Checked the source and went to blip.tv and directly to the video. Still no. Then I went to your channel and I was able to see it.

I don’t know if it is me or blip.tv that sucks, just a helpful tip for other readers.

Hi todbot, thanks for the tip. I’ll try that out. I was thinking an H-bridge and two normal motors might also do the trick but just replacing the servo’s could be a lot easier.

Hi Desiredusername I’m running ubuntu 7.10 using firefox and have no problems with the video so you might want to check your installation of your flash plugin.

Hi Todbot, very nice video. 1) where can I order this boarduino kit 2) is there a way to connect to a datalogger? I have made a mechanical device where a weight using gravity turns a potmeter. The pots output is measured in a datalogger for stream into excel. nice, but not 100% accurate. Curious to know if your concept could be an alternative.

Hi Arie,
There are numerous links in the post pointing directly to where to buy a Boarduino, but specifcally it’s from Adafruit.com.

If your datalogger outputs serial data, then the Boarduino can read it. Many people turn the Arduino/Boarduino into a datalogger. Since it has many analog and digital inputs and a decent amount of RAM and EEPROM (and it’s easy to hook up external I2C EEPROMs), it’s a natural for such tasks.

Hi,

I just assembled my Boarduino and started doing some servo control stuff. It works fine, but every so often the Boarduino resets itself and the program starts from scratch. I have a feeling it’s something to do with noise from the motor in the servo screwing up the power supply. Did you have any similar problems?

[...] Check this out! I blogged this in case I want to refer to it again ;D [...]

Great video and drawings Tod. I may check out the bare bones board.

thanks
chad

excellent idea for a demonstration!

Hi

Thanks for the nice guide, but i get into trouble when i try to reproduce this. The boarduino always hangs after 2 iterations (of recieving bytes), right after the Wire.send(0×00) in the sendzero function. It continues to run 1 time in about 50 tries, and then it works fine. Ive tried this with two boarduinos, and two nunchuks and still get the same hangup. Any thoughts or pointers in the right direction? Did yours just work?

Hi
Thanks for the great guide, however my Nunchuck just wont read very well….it gives me 2 results from the nunchuck only if i remove the yellow wire from the nunchuck, then put it back. My results are the same every time:
Finished setup
0 joy:110,46 acc:49,47,46 but:0,1
1 joy:46,46 acc:49,47,46 but:0,1

It also takes me several attempts to actually get that data

Do you have any ideas?

[...] at home, for instance to build a remote-controlled mood light Apparently a Wii Nunchuk is also pretty popular for connecting to Arduino as it sports a 3-axis accelerometer, joystick and two buttons for under [...]

I hope you don’t mind, but I’ve uploaded your .flv file to Youtube. I couldn’t get it to play in my Firefox, and Youtube was the simplest solution, cause I’m in linux. Of course, in the description I’ve linked back to this article.

Here it is right here:
http://www.youtube.com/watch?v=qqFyadk0Nok

I have picked the data between wiiremote and the nunchuk. I have decrypt something. But I don’t know how to decrypt the whole.
Please contact me if you are study this problem. cokeliu@ev-sparkle.com

Hi Neodudeman,
Some adblock lists for Firefox block blip.tv for some reason. Which is dumb in my opinion, because blip.tv is the most open-source like video site I know of. Oh well. Thanks for uploading to Youtube. If an adblock is not the problem, then I don’t know what’s going on. Youtube’s player is a Flash video (.flv) playing object just like Blip’s player.

[...] commande de console Wii, branchée sur une carte arduino, pour piloter un servomoteur. Des perspective intéressantes pour la robotique. Surtout vu le prix de la manette (20€ alors [...]

plz help me when i try to compile wii_nunchuck_servo.pde i get ALOT of errors:

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:266: error: expected unqualified-id before ‘int’

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:266: error: expected `)’ before ‘int’

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:266: error: expected `)’ before ‘int’

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:267: error: expected unqualified-id before ‘int’

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:267: error: expected `)’ before ‘int’

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:267: error: expected `)’ before ‘int’

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:420: error: ‘__put’ was not declared in this scope

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:420: error: expected primary-expression before ‘char’

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:420: error: expected primary-expression before ’struct’

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:420: error: ‘__get’ was not declared in this scope

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:420: error: expected primary-expression before ’struct’

/Users/dborup/Downloads/arduino-0011/hardware/tools/avr/bin/../lib/gcc/avr/4.0.2/../../../../avr/include/stdio.h:420: error: initializer expression list treated as compound expression

Couldn’t determine program size: hardware/tools/avr/bin/avr-size: ‘/tmp/build51757.tmp/wii_nunchuck_servo.hex’: No such file

Hi Dennis,
It looks like you’re using Arduino 0011 (which is good, it’s the latest). But Arduino 0011 changed a little bit how “#include” statements are processed. To get it to work, comment out the lines

  #include <string .h>
  #include <stdio .h>

from the sketch.

[...] Seems like a Wii Nunchuck will make a great input device for the project. I’m deeply indebted to folks who have put up such great tutorials on how to do this, Tod E. Kurt in particular. [...]

Hi All,
I recently succeded to reproduce some code using Arduino 010 and Wii Nunchuck. Please tell me where are the definitions concerning the number of plots to connect the Wii Nunchuck (analog 4 and 5). If I want to change these definitions and use more entries, which is the procedure.

Hi Georges, Do you mean ‘pins’ instead of ‘points’? You cannot change those pins and sill use the Arduino “Wire.h” library, because analog pins 4 & 5 are also the I2C pins SDA & SCL. This is part of the hardware of the ATmega chip on Arduino.

[...] todbot blog » Blog Archive » Boarduino, Wii Nunchucks, and Servos (tags: arduino wii electronics hardware accelerometer microcontroller projects hacking MAKE nunchuck) [...]

Hello all….
This is such a cool idea and I want to create my own but I’m having a bit of a problem. I’m not using a Arduino, I’m using a VM1 from http://www.microrobotics.co.uk
All was going well and the VM1 tells me that there is a device at address 164 but when I try to communicate with it, I just get 255’s in response. As the VM1 can see the nunchuck, I must have the wiring correct and the addressing wrong me thinks but am not sure what to do next. Because of the addressing differences I’m initializing with the address 164 then sending a 128 then a 0 after then another 0 to start the 6 byte receive. Have I got the 8-bit hex addressing to decimal correct or do you think I’m barking up the wrong tree. Loving your work Todbot.

Hi Chris,

The 164 address is likely because some I2C vendors treat the addresses as being shifted up by one bit (because of the read/write bit). This makes all addresses appear to be multiplied by two, so the Nunchuck address of 82 (0×52 in hex) looks like 164.

Just send 164 as the address and continue as you were going to. You should pretty easily be able to replicate the functionality of “nunchuck_init()”, “send_zero()”, and “nunchuk_decode_byte()” functions of the Arduino sketch linked above.

If after all that it still doesn’t work, try adding 4.7k-10k pullup resistors to the I2C SDA & SCL lines. The Microrobotics I2C app note has a “‘Long Distance’ I2C Bus” example showing this. You probably won’t need them because most microcontrollers include internal pullups that work for short cable runs, but adding them won’t hurt.

Hi, this guide is awesome, but I’m having the same issue as JRolSmith, I always get this:

joy x: 46
joy y: 46
accel x: 187
accel y: 185
accel z: 184
z button: 0
c button: 1

Nothing I do to the nunchuck changes it’s output. I’ve checked the connections with my multimeter, but have found no problems. I’m using a bare bones boarduino, but that shouldn’t change anything, right?
I’d appreciate anything you can tell me. Cheers.

Hi Peter,
A Boarduino is the same as an Arduino for this situation.

Some things to try:
1. Double and triple check your wiring to the Nunchuck. Before I made the “wiichuck adapter” I would always wire it up wrong.

2. Does the Nunchuck work with the Wiimote? It may be the Nunchuck got fried at some point and doesn’t work anywhere.

3. Rebuild the “Wire” library. To do this, in the Arduino application, switch the “Board” type from Diecimila to LilyPad and back again, then re-upload your sketch. Some people have experienced their Wire library getting compiled wrong.

4. Don’t have anything else hooked up to the Boarduino besides USB & the Nunchuck. The Boarduino doesn’t have as much power supply filtering as an Arduino board and other devices can cause issues.

5. Try the WiiChuckClass library instead of my code above. Lots of people are using it and have been having luck. It’s a bit better structured than the code I have up top.

And let me know how things turn out.

Thanks for the reply. I’ve checked my wiring, and I used a mulitmeter on the short detector or whatever it’s called to make sure that my terminals were wired to the proper arduino pins. I tried everything else in various combinations, except that I don’t have a Wiimote. I think I’ll probably rip it open and make sure nothing’s fried, and maybe test the connections. What I don’t understand is that when the nunchuck isn’t getting power, the program doesn’t print at all, so it must be actually sending false data.

Hmm. Well, the not-printing thing isn’t that surprising. The Arduino “Wire” library will just freeze in certain situations of incorrect wiring.

As an experiment, try swapping the two I2C wires that go to Analog input 4 & 5 (that is, put the one you have hooked to Analog in 4 to 5 and vice-versa). It won’t cause any harm and might just work. :)

How are you powering the Nunchuck? From the Boarduino 5V supply?

Yes, I’m powering the nunchuck through the board’s 5v and gnd pins.

This is interesting, I swapped the green and yellow wires as you suggested, and I got the *exact* same result.

I took it out of the case, and saw no fried components. I did, however, see a fifth black wire, which I had cut off with the other fibrous matter inside the wire. Should I try connecting this anywhere?

The black wire is supposedly some sort of “device detect” signal to the wiimote, I don’t think it’s necessary. The white wire is gnd, and the red wire is Vcc (which should be 3.3VDC for the nunchuck, but all the nunchucks I’ve had work fine at 5VDC)

Ok, well I took the voltage down to 4.7 volts, and I don’t get any output, even when swapping yellow and green wires. Do you think it’s a lost cause?

I’m sorry to take up so much of your time and comment space, but I just found out that the Arduino is reporting the following:
joy:46,46 acc:49,47,46 but:0,1

…when the green and yellow wires are *disconnected*. I’m absolutely confounded, and I’m hoping it means something you understand that I don’t.

Noise on the lines can cause stuff like that. The “Wire” implementation of I2C in Arduino is too simple to do check to see if a device is really there or not.

It sounds like it’s time to try this out on another Arduino or to try a different Nunchuck. This is one of the problems with debugging hardware: if it doesn’t work right off the bat, you need duplicates of stuff to exhaust all the possibilities.

It might be you have an ATmega chip with fried analog in pins 4 & 5. Or maybe the solder connections to them on the Boarduino board are intermittent/bad. Having a pre-soldered & tested Arduino can help here.

Alright, will do. Thanks for the help.

My brand new Made in Italy Arduino just got here, I connected the nunchuck and it works perfectly. I guess it was my old board. Thanks again for the help.

I’m using the Arduino Mini 04 and wondering what changes must I make in order to utilize this great information? How does the mini perform in speed, compared to the larger chipset.
Thanks for any help.

Hi Aaron,
The Arduino Mini uses the same microcontroller processor as the regular Arduino. It just uses the smaller surface mount package form of it.

[...] Read wii nunchuck data into arduino Boarduino, Wii Nunchucks, and Servos [...]

Something to say?