HANDle (Nunchuck control)


Overview

In this tutorial you'll learn how to control the Ada robotic hand with a joystick.

The HANDle is a joystick device that is used to control the Ada hand, in this case the we will use a Wii Nunchuck. This tutorial guides you through configuring the HANDle correctly, and downloading the appropriate firmware to allow the Ada hand to be controlled using a Wii Nunchuck.

This tutorial is for:

You will need:


Connecting the HANDLE

4-Pole headphone connector I2C diagram

4-Pole headphone connector I2C diagram

The Wii Nunchuck is a very cheap controller which incorporates a 2-axis joystick, a 3-axis accelerometer and 2 buttons into a very ergonomic package. The data regarding each of these control inputs is passed out of the Nunchuck using I2C, which means it can be easily integrated as an Ada hand controller.

To do this we need to connect the Nunchuck to the Ada hand.

  1. Plug the WiiChuck Adapter into the connector of the Wii Nunchuck, orientated so that the CLK, NC and GND face upwards
  2. Plug the WiiChuck Adapted into a bread board using the header pins (if there are no header pins, you may need to solder these yourself)
  3. Connect the '+' from the WiiChuck Adapter to the 5V pin on the headphone connector (pictured)
  4. Connect the '-' from the WiiChuck Adapter to the GND pin on the headphone connector
  5. Connect the 'd' from the WiiChuck Adapter to the SDA pin of the headphone connector
  6. Connect the 'c' from the WiiChuck Adapter to the SCL pin of the headphone connector
  7. Plug the headphone connector into the Almond board

You should now have the Nunchuck completely wired up and connected to the Ada hand, the next step is to enable the HANDle in the Artichoke V1.1 firmware and upload it to the hand.


Firmware

ENABLING THE HANDLE firmware

The firmware required for HANDle control is already part of Artichoke V1.2, it just needs to be enabled, recompiled and uploaded to the hand. 

       1. Navigate to the folder where you have downloaded OpenBionics_Artichoke (detailed download instructions here

       2. Open OpenBionics_Artichoke.ino and navigate to the Globals.h file

       3. Find the line with the following text (Line 29)

//#define HANDLE_EN// HANDle (Nunchuck) control

       4. Uncomment the line by removing the '//' before the '#define'. It should look the same as below

#define HANDLE_EN// HANDle (Nunchuck) control

       5. Compile and upload to the Almond board, as detailed in the Artichoke V1.2 User Guide

 

CONFIGURING the HANDLE firmware

Once uploaded and powered, connect using the Serial Monitor (baud 38400).

Once the Ada hand is powered up, enter the command 'A11' to enable the HANDle mode. If you see something resembling the following, then it means the Ada hand was unable to detect the Nunchuck and that you need to double check all of your connections.

Serial port if the HANDle is not connected

Serial port if the HANDle is not connected

If the Nunchuck is connected correctly, you should see the following

Serial port if the HANDle is connected correctly

Serial port if the HANDle is connected correctly


HAND CONTROL

MOVEMENT

Moving the joystick of the Nunchuck forwards closes the hand in the current grip, and moving the joystick backwards opens the hand.

The position of the joystick along the Y-axis is mapped to the 'grip position' of the hand in exponential manner, resulting in a greater sensitivity of movement around the midpoint of the joystick. This allows for finer control of the hand.

 

GRIP CHANGE

The two buttons on the back of the Nunchuck (C & Z) are used to cycle through the grips.

Pressing the 'C' button will increase the grip number, and pressing the 'Z' button will decrease the grip number. If the max/min grip number is reached, it will cycle round to the min/max grip number.

  • 0           Fist Grip
  • 1            Palm Grip (Fist Grip but with thumb extended)
  • 2           Thumbs Up
  • 3           Point
  • 4           Pinch
  • 5           Tripod (Pinch using both index and middle fingers)

CALIBRATING THE JOYSTICK

Occasionally the joystick will not return to the exact midpoint, causing the hand to slowly open/close when the joystick appears central. To recalibrate the midpoint of the joystick, hold both the 'C' and the 'Z' button for 500ms. You should see a confirmation via the serial port when the configuration is complete.

DEBUG DATA

Various pieces of 'HANDle debug data' can be viewed when in HANDle mode. Enter the command 'A12' to view the data from the HANDle, which should resemble the following;

Grip 0 joyPos 69.00 Hand pos 67 Fist
  • Grip # - the current grip number
  • joyPos ##.## - the current position of the joystick along the Y-axis
  • Hand pos ## - the current position of the hand (0 = open, 100 = closed)
  • Fist - the name of the current grip

IMPORTANT NOTE about i2c

The 2 data lines passed through the headphone port on the Almond board are connected to both I2C pins and analogue pins (through a 10k resistor). If the headphone port is being used for analogue data (e.g. muscle sensors), you should not initialise I2C. When using I2C (e.g Nunchuck), the analogue pins need to be pulled high to act as the pull ups for the I2C lines. 

pinMode(A6,OUTPUT);
pinMode(A7,OUTPUT);
digitalWrite(A6,HIGH);
digitalWrite(A7,HIGH);

This is implemented in HANDle.ino within the initialisation sequence of IOconfig().