Summary of Wii Nunchuck as general purpose controller via Arduino board
This article details how to interface a standard wired Wii Nunchuck with an Arduino board to create a versatile controller. The setup utilizes the Nunchuck's joystick, two buttons (C and Z), and 3-axis accelerometer to generate variable voltage outputs. These signals can be smoothed via an RC filter to control external devices like robots or electric skateboards, allowing users to switch between joystick steering and tilt-based steering depending on button presses.
Parts used in the Wired Nunchuck Controller Project:
- Wii Nunchuck (wired)
- Arduino board with 328 processor
- Digital Pin 9
- Digital Pin 10
- Digital Pin 11
- Resistor
- Capacitor
- RC filter components
Background:
I made a self-balancing electric skateboard which is steered using a Wii Nunchuck by either using the thumb joystick on the top or by tilting it left or right, depending on which of the two buttons on the end are being pressed.
A simplified self balancing board is described in the instructable here:
www.instructables.com/id/Easy-build-self-balancing-skateboardrobotsegway-/
However people are asking me how the Nunchuck steering control used on one of my earlier boards can be used.
The wired Nunchuck can be seen in use as a steering control in the second half of this video:
www.youtube.com/watch
It can also be seen in use controlling a set of LED’s attached to the Arduino ouputs here:
www.youtube.com/watch
I have another instructable on interfacing a wireless Nunchuck to an Arduino but that is quite tricky and only works with a few specific wireless nunchucks. If starting out I strongly suggest going for the wired standard Nunchuck to begin with as described here.
Purpose:
The purpose of this instructable is to describe how to interface a completely standard Wii Nunchuck (i.e. with a cable) with an Arduino board. The Nunchuck is low cost but powerful with a fully proportional thumb joystick, 2 buttons on the end and a 3 axis accelerometer (position sensor). It is ideal for controlling things with.
The Arduino has been set up to output variable voltages between 0 and 5V which can be used as, for example, steering control inputs for another project such as a robot. You can use the (proper propotional) thumb joystick or the embedded accelerometers (tilt the chuck left right forward or back).
By modifying the code you can easily make it do other things.
I am using an Arduino with a 328 processor (i.e. a recent one) and version 17 of the Arduino software.
The Arduino sketch is attached below.
This is all derived from code developed by Chad Phillips and others, see: http://windmeadow.com/node/42
For more info on wiring up the chuck to the Arduino, download Bionic Arduino Class 4 tutorial which is excellent from TodBot blog:
http://todbot.com/blog/2007/11/24/bionic-arduino-class-notes-3-4/
There is plenty more on this on the net, there is even someone with a Nunchuck controlled electric canoe here:
www.youtube.com/watch
I am just presenting this all together in one place as a way to get started with something that should work OK.
Here are the “c” and “z” buttons on front of the Nunchuck.
Step 2: Arduino board inputs and outputs
- What is the purpose of Digital Pin 9?
It outputs +5V when either end button is pressed to serve as a go/stop control signal. - How does Digital Pin 10 function?
It provides a PWM output that averages 2.5V at neutral, rising to 5V or dropping to 0V based on forward/backward joystick movement. - What happens to Digital Pin 11 when the C button is pressed?
The pin output becomes controlled by the left/right tilt of the Nunchuck rather than the joystick. - Can I use this setup for steering a robot?
Yes, the smoothed voltage from the pins can be used as a steering input signal for other devices. - Why is an RC filter necessary?
An RC filter smooths the PWM pulses into a stable analog voltage suitable for control inputs. - Which Arduino processor version is recommended?
The author uses an Arduino with a 328 processor and software version 17. - What are the two modes of steering described?
Steering can be done using the thumb joystick or by tilting the Nunchuck left and right. - Does letting go of the buttons stop the motors?
Yes, releasing the buttons creates a 0V signal at Pin 9, which can kill power to motors.