- Category: Wall-E Build
- Published: 24 February 2016
- Hits: 2065
I looked at many different methods of control and there are lots to choose from. However the Wii nunchuck came very high on this list for a few reasons. The nunchuck has 5 axis of control and 2 buttons in a very small package and some free space internally. This means I can do directional control, basic head control and trigger a couple of additional on/off functions all from a single controller.
In addition the nunchuck is also a standard I2C device so can be easily read from an Ardunio ProMini that will also fit in the case.
Using the nunchuck as a puppet controller also makes sense from a size perspective since it allows control in a very discrete package. This makes it easier to demonstrate Wall-E without it being obvious he's being controlled and keeps up an illusion of autonomy.
Given the amount of space available inside the nunchuck it's possible to squeeze in a Arduino ProMini to act as the brain of the controller, a bluetooth transmitter to relay the controls to Wall-E and a small lithium battery.
The 5 axis and two buttons of the nunchuck are as follows.....
|Joystick X||Forward/Backward Movement|
|Joystick Y||Rotate Left/Right Movement|
|Acceleration X||Tip head forward/backward|
|Acceleration Y||Rotate head left/right|
|Acceleration Z||Tip head left/right|
|Button C||Play next sound|
Activate Solar charger sequence
These will be monitored over I2C by the Arduino and send via bluetooth to the controller inside Wall-E where those movements are translated into commands for the slave controllers.
Using the nunchuck does have a dis-advantage however. A Wii nunchuck has a specific I2C address and this cant be easily changed. As the I2C bus can only have one instance of any address on the network I can only have one nunchuck per Ardiuno (when using hardware I2C only, a second I2C bus can be used over software if required) so if more than one controller is required in future I will need to rethink how this is connected, but for now this is perfect.
Accessing the nunchuck from the Ardunio is simply a case of requesting the data from the nunchuck over the I2C and the nunchuck responding the the current information. The connections on the nunchuck are as follows.....
with VCC being a power line (3.3v but 5v also works), the GND being the ground line and the SDA/SCL being the I2C network connections. Attaching this is done through the Ardunio I2C pins (A4 & A5 for the ProMini)
The ProMini comes with a voltage regulator on the board and placing the battery @3.7v on the RAW pin allows for the Ardunio to be powered and for the VCC pin to output the 3.3v required to run the nunchuck (this can also be done on the 5v version by using a voltage divider made of a 20k and a 10k resistor to make the 3.3v required).
A ardunio demo sketch to show the data from the nunchuck is below but first you will need the correct libary to talk to the nunchuck. This can be found here....
....finally you need a way to see the data from the nunchuck via the serial console on your Ardunio so you can understand what is going on and develop the control scheme. This is done using the following sketch....
* Copyright 2011-2013 Gabriel Bianconi, http://www.gabrielbianconi.com/
* Project URL: http://www.gabrielbianconi.com/projects/arduinonunchuk/
#define BAUDRATE 19200
ArduinoNunchuk nunchuk = ArduinoNunchuk();
This block of code displays the values of the nunchuck in the rserial console of your Arduino, it is my intention to take this value stream and send it over bluetooth to the controller inside Wall-E and have it perform commands on the internal hardware based on these values.