Muscle Control V1.2

OVERVIEW

This tutorial will guide you through the process of using Electromyography (EMG) muscle sensors to control the Ada hand.

This tutorial is for:

You will need:

If you are using 2 MyoWare sensors for dual muscle control, you will also need:

WARNING, THE MYOWARE SENSORS ARE NOT ISOLATED. BEFORE ATTACHING THE ELECTRODES, BE SURE TO READ THROUGH THE MYOWARE DATASHEET


preparing the SENSORS

Electromyography (EMG) sensors are used to detect the electrical potential of your muscles. A signal is picked up from a surface electrode placed on your skin, the signal is then passed through a series of amplifiers and filters to produce a 'clean' signal. The resulting 'clean' signal is within the usable range of a microcontroller, so can be fed into an Analogue to Digital Converter (ADC), where the magnitude of the signal represents the magnitude of the muscle activation, i.e. the greater the signal magnitude, the harder the muscle is tensing. This signal can then be used to open or close the hand.

CONSTRUCTING THE SENSOR

EMG sensors are becoming more widely available; this tutorial involves using either 1 or 2 MyoWare Sensor Boards from Advancer Technologies.


The first step is to attach the power, ground and signal wires from the MyoWare board to the 4-pole headphone jack.

1. Solder the 1m black wire (ground) to the pad next to the negative symbol (-) on the MyoWare board

2. Solder the 1m red wire (positive) to the pad next to the positive symbol (+) on the MyoWare board

3. Solder the 1m green wire (signal) to the pad next to the signal symbol (SIG) on the MyoWare board


If you are using 2 MyoWare sensors for dual muscle control, you will also need to complete steps 4 - 6. If you only have one MyoWare board, you can skip straight to step 7.

4. Solder the 20cm black wire (ground) to connect the negative pads (-) between the first and second MyoWare boards

5. Solder the 20cm red wire (positive) to connect the positive pads (+) between the first and second MyoWare boards

6. Solder the 1.2m blue wire (signal) to the pad next to the signal symbol (SIG) on the second MyoWare board


The next step is to connect the other end of the wires to the 4-pole headphone jack so that the MyoWare boards can connect to the Almond board.

7. Solder the other end of the 1m black wire (ground) to the GND connection of the headphone jack

8. Solder the other end of the 1m red wire (positive) to the 5V connection of the headphone jack

9. Solder the other end of the 1m green wire (signal) to the ADC6 connection of the headphone jack

10. If you are using 2 MyoWare boards, solder the other end of the 1.2m blue wire (signal) to the ADC7 connection of the headphone jack

The assembly of the sensors is now complete.


POSITIONING THE ELECTRODES

WARNING, THE MYOWARE SENSORS ARE NOT ISOLATED. BEFORE ATTACHING THE ELECTRODES, BE SURE TO READ THROUGH THE MYOWARE DATASHEET

Each sensor board requires three electrodes to attach to the skin; 2 electrodes are used for the muscle signal (on board) and a 3rd electrode used for a body/ground reference (black cable). 

  1. Press each of the sticky electrode pads into the electrode sensors
  2. Peel off the paper backing of each sticky electrode and apply the MyoWare board to the outside of the forearm, shown in the image below. The MyoWare board should be placed on the belly of the forearm muscle (see the datasheet for more details on sensor location)
  3. Apply the ground electrode (black) to the elbow

If you are using 2 MyoWare sensors for dual muscle control, you will also need to repeat steps 1 - 3 and place the second MyoWare board on the inside of the forearm.

EMG sensor placement

EMG sensor placement


TESTInG the sensors

WARNING, THE MYOWARE SENSORS ARE NOT ISOLATED. BEFORE ATTACHING THE ELECTRODES, BE SURE TO READ THROUGH THE MYOWARE DATASHEET

Uploading the test firmware

To verify the MyoWare sensors are wired and connected to the skin correctly, you will need to download and run the following Arduino sketch. 

1. Download MyoWare_Sensor_Test.ino 

2. Open the sketch using Arduino

3. If you are using a single MyoWare sensor board, you will need to change the number of EMG channels on line 17 to '1'

#define NUM_EMG_CHANNELS2 // 1 or 2

4. Power the Almond board and connect it to the computer

5. Compile and upload the sketch to the Almond board (click here for a tutorial on uploading to the Almond board)

6. Connect the MyoWare board by plugging the 4-pole headphone connector into the Almond board

7. Open the Serial Monitor (Tools -> Serial Monitor) and set the baud rate to 38400 bps

You should now see a the ADC values relating to the EMG signal from each MyoWare board being printed over the serial monitor, for example:

Ch0: 16 Ch1: 23

(If you are only using a single MyoWare board, you will only see 'Ch0: 16' )


Hand motions for muscle activation (this is a right hand)

Hand motions for muscle activation (this is a right hand)

Using the sensors

The image on the right shows the two hand motions you should perform to activate the inside and outside forearm muscles.

To activate the inside forearm muscle, flex the wrist towards the elbow whilst squeezing the tips of your fingers into the heel of your hand. When you perform this motion, you should see/feel the muscle underneath one of the MyoWare boards tense.

To activate the outside forearm muscle, extend the wrist with an outstretched palm. You should see/feel the muscle underneath the other MyoWare board tense.

 

 


TUNING the sensor gain

When you perform each of these motions, you should see the ADC value for each channel change. 

When your muscle is relaxed, the ADC value should rest around 0 - 300, and when the muscle is tensed it should read around 700 - 900. If the ADC value is too low, you will need to increase the gain of the sensor. Use the flat-head screwdriver to turn the potentiometer clockwise to increase the gain.

For more details see the MyoWare sensor board datasheet here.


Artichoke Muscle Control

The Artichoke Firmware allows the Ada hand to be controlled via muscle signals. The above EMG sensors detect the activation levels of each muscle, and then feed the activation level (analogue signal) into the ADc of the Almond board, via the headphone jack.

There are two main control methods for controlling the hand using the EMG sensors, 'Standard Muscle Control' mode and ' Positional Muscle Control' mode. These modes can be enabled by entering the serial command 'M1' or 'M2' respectively, and will stay enabled until they are disabled by entering the serial command 'M0'.

For more details on mode selection, see the Artichoke Firmware Tutorial.

Standard Muscle Control Mode (M1)

Once 'Standard Muscle Control Mode' (M1) is enabled, the hand processes the ADC value of each EMG channel. If the muscle is not active, a rolling average is taken of the resting ADC value, which is used as the noise floor. This noise floor is a rolling threshold that is used to remove the EMG signal of a relaxed muscle, which simply makes the EMG signal 0 when the muscle is relaxed, and >0 when the muscle is active.

When a the muscle is tensed and relaxed it produces a peak in the EMG signal, which is detected by the hand.

If you are using a two MyoWare sensors, the hand will open fully when a peak is detected on the open muscle, and will close fully when a peak is detected on close muscle. If the open muscle is held tensed for more than 400ms, the hand will cycle to the next grip.

The possible grip patterns are listed in order below:

  1. Fist - all fingers and thumb move
  2. Palm - all fingers move, thumb stays open
  3. Thumbs up - all fingers stay closed, thumb moves
  4. Point - all fingers remain closed, only the index finger moves
  5. Pinch - all fingers remain open, only the thumb and index move
  6. Tripod - ring and pinky remain open, index middle and thumb move

If you are using a single MyoWare sensor, the hand will toggle between being fully open and fully closed when the falling edge of an EMG peak is detected. The grip can also be changed by holding the muscle tensed.

The value for the 'peak threshold', above which the EMG signal is deemed to be at a peak, can be manually changed by entering the serial command 'U###', where # is a value between 0 - 1024. If you simply enter the command 'U', you will see the current value for the 'peak threshold'.

The value for the 'hold duration', which is the amount of time the muscle must remain tensed for the grip to change, can be manually changed by entering the serial command 'T###', where # is a time in ms. If you simply enter the 'T' command, you will see the current value for the 'hold duration'.

Proportional Muscle cOntrol mode (M2)

Positional muscle control is designed to achieve finer control of the hand when using muscle sensors, this mode also more closely reflects how a robotic prosthetic hand is controlled. The hand only moves when a muscle is tensed, where the speed of movement is proportional to how much the muscle is tensed. This means that the hand can be moved slowly by tensing gently and can be moved quickly when tensing more firmly. 

If you are using a two MyoWare sensors, the hand will only move when either the open or close muscles are tensed.

If you are using a single MyoWare sensor, the hand will open when the muscle is relaxed, and will close when the muscle is tensed.

To enable 'Proportional Muscle Control Mode' enter 'M2' over serial, this mode can be disabled by entering 'M0'. For this mode you may need to decrease the 'peak threshold' (U###) to allow for the 'gentle' tenses to be picked up by the hand.

You can change grip in this mode in exactly the same way as in 'Standard Muscle Control' mode.

MUSCLE CONTROL DATA DUMP (M3)

'Muscle Control Data Dump' mode is used to view the EMG and muscle control data in real-time. Upon entering 'M3', you should see the following:

M0 = 178 T0 = 369 N0 = 169 A0 = 0 M1 = 200 T1 = 384 N1 = 184 A1 = 0 DIR None
  • M# - raw muscle signal
  • T# - calculated threshold (noise floor + sensitivity value)
  • N# - noise floor
  • A# - whether the muscle is determined to be active (0 = inactive, 1 = active)
  • DIR - calculated direction of the combined muscle signal (open, close, none)

If you are only using a single MyoWare sensor, you will only see the data relating to the single channel.

With your muscles relaxed, both A0 and A1 should be 0, showing that the muscles are determined to be inactive. If any of them is detected as active, even when the muscle is relaxed, try increasing the sensitivity value by entering 'U###', where # is the new value, typically between 100 - 300, where the lower the number relates to an increase in sensitivity.


EXTRA

I2C MUSCLE SENSORS

An alternative solution for muscle sensing is to use an I2C ADC. Instead of passing the raw analogue signals down through a long cable to the ADC on the Almond board, which could result in an increase in noise, an I2C ADC could be located as close as possible to the muscles/EMG sensor. This would result in a shorter cable length between the output of the EMG sensors and the ADC, thus reducing the chance of noise.

Artichoke is designed to use both analogue (default) and I2C muscle sensors, in particular the AD7995, a 4 channel 10-bit I2C ADC. The library can be found at www.github.com/Open-Bionics/Arduino_Libraries, titled 'I2C_ADC.h'. Once downloaded and installed, it can be enabled within Artichoke by navigating to 'Globals.h'  and uncommenting the following;

//#define USE_I2C_ADC

Uncommenting this line changes the muscle controller to perform an ADC2.read( ) (I2C_ADC) instead of an analogRead( ), enables the I2C_ADC to be initialised and pulls the ADC pins high to configure I2C lines, as discussed below.

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, 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);

ARTICHOKE V1.2 FIRMWARE USER GUIDE


OVERVIEW

In this tutorial you'll learn how to download and install the Artichoke V1.2 firmware for the Ada robotic hand. Artichoke is the version of hand control firmware designed for the Ada hand, running on the Almond board.

This tutorial is for:

You will need:


GETTING ARTICHOKE

Artichoke includes full serial control of individual fingers and grip patterns, muscle control through EMG sensors and provides a framework for adding extra functionality to the hand (nunchuck/joystick control). As with all of Open Bionics developer materials, this firmware is completely free to download and use, and we strongly encourage you to incorporate this into your projects, to improve it and build upon it.

DOWNLOADING AND INSTALLING FINGERLIB.H

Before downloading Artichoke, you need to download and install FingerLib.h, a custom finger control library. FingerLib.h is designed to run on a number of different Arduino compatible microcontrollers, and manages all of the low level motor control and handling of timers, it also includes various example sketches for simple finger control applications.

You will first need to download and install Arduino, next we will install FingerLib.h

  1. Navigate to our GitHub www.github.com/Open-Bionics/FingerLib
  2. Download FingerLib as a ZIP
  3. Extract FingerLib-master.zip and rename it to 'FingerLib' instead of 'FingerLib-master'
  4. Move the FingerLib folder to your Arduino libraries folder (usually My Documents\Arduino\libraries)
  5. Restart Arduino by closing it and opening it again
Download and install Arduino

Download and install Arduino

Download FingerLib from GitHub

Download FingerLib from GitHub

DOWNLOADING AND INSTALLING ARTICHOKE

After FingerLib.h has been downloaded, we now need to download Artichoke and upload it to the Almond board.

  1. Navigate to www.github.com/Open-Bionics/Artichoke
  2. Download OpenBionics_Artichoke as a ZIP
  3. Extract Artichoke-master.zip
  4. Open the file OpenBionics_Artichoke.ino in the Arduino IDE
  5. Power up and connect the Ada hand to your computer
  6. Select the Arduino board (Arduino Mega 2560 or equivalent)
  7. Select the appropriate COM port (Instructions for Mac or PC)
  8. Upload the Artichoke firmware to the hand (if it is a right hand, the thumb may twitch when uploading)
  9. Once uploaded for the first time, the hand may be in demo mode
  10. Whilst in demo mode, the hand cycles through all of the various grips and finger movements
  11. See the next chapter to exit demo mode
Download Artichoke from GitHub

Download Artichoke from GitHub

Open 'OpenBionics_Artichoke.ino' using Arduino

Open 'OpenBionics_Artichoke.ino' using Arduino


USING ARTICHOKE

INITIAL CONFIG

Once uploaded to the Ada hand, connect to the hand via the Serial Monitor. On the bottom right hand corner of the Serial Monitor, set the baud rate to 38400, and set the line ending to 'Carriage Return'.

You should first be greeted with a printout of the firmware version number and board name, followed by a list of possible serial commands. The demo mode should then start, and can be disabled by entering 'A0', without the apostrophes. Entering 'A0' toggles whether demo mode will run on start up (default enabled), and entering 'D' will run demo mode once.

At any time, if you enter '?' the hand will print the list of serial commands, and entering 'A1' will toggle whether the serial commands display on start up. Note that all characters must be uppercase.

Enter '?' to view the list of serial commands

Enter '?' to view the list of serial commands

HAND TYPE

To select whether the Ada hand is a left or right hand, enter one of the following commands:

  • H1            Set the hand to be RIGHT
  • H2           Set the hand to be LEFT
  • H             View whether the hand is LEFT or RIGHT

GRIP CONTROL

With demo mode disabled, if you enter 'G0' the hand should should close in grip pattern 0 (Fist Grip), if you enter 'G0' again it should toggle the hand open in grip pattern 0.

Try this with 'G#' where # is a number between 0 - 5 to perform a movement in a selected grip pattern, the grip patterns are as follows;

  • G0 Fist Grip
  • G1 Palm Grip (Fist Grip but with thumb extended)
  • G2 Thumbs Up
  • G3 Point
  • G4 Pinch
  • G5 Tripod (Pinch using both index and middle fingers)

For a more detailed explanation on the grip patterns and how to create custom grips, visit this tutorial.

Enter 'G0' to toggle the hand between open and close in 'Fist Grip'

Enter 'G0' to toggle the hand between open and close in 'Fist Grip'

FINGER CONTROL

The fingers can be controlled individually by entering 'F#', where # is a finger number between 0 - 4.

  • F0 Thumb
  • F1 Index
  • F2 Middle
  • F3 Ring
  • F4 Pinky
Enter 'F0' to toggle the thumb between open and close

Enter 'F0' to toggle the thumb between open and close

 

POSITION AND SPEED MODIFIERS

You can also set the fingers to move to a certain position (P0 - P100) for a selected grip or finger, for example if you enter 'G5 P50' the hand will move to the halfway position of the Tripod grip, or with 'F1 P10' the Index finger will be almost fully closed (P0 = fully open, P100 = fully closed).

The speed can be set in a similar manner by entering 'G# S???', where ??? is a number between 0 - 255 (note that due to the PWM frequency, the motors will struggle to move at any value below around 200).

Both the position and speed can be added to a grip (G#) or a finger (F#) command at the same time, e.g. 'F1 P50 S240'

Move the index finger to be 50% closed at a speed of 240

Move the index finger to be 50% closed at a speed of 240

ADVANCED SETTINGS

Using an advanced command 'A#' allows different modes and settings to be configured, a full list of these settings can be seen by entering the '?' command.


Muscle Control & extras

For details on the different control methods available within Artichoke V1.2, visit out Control Methods Guide.

IMPORTANT NOTE ABOUT I2C

The 2 data lines passed through the 3.5mm 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);

Artichoke V1.1 Control Methods


OVERVIEW

In this guide you'll learn about the various methods for controlling the Ada robotic hand.

With the release of Artichoke V1.2, the Ada hand can now be controlled using number of different methods. It also includes a several modes geared towards use in a research environment. This guide will detail the various options for controlling the hand, as well as the different types of data outputs which can be used for simulation, analysis or control.

This tutorial is for:

You will need:


control methods

The Ada hand can be controlled by a number of different control methods.

We have written guides and tutorials regarding the following control inputs:

  • Basic serial control - control the Ada hand via basic serial instructions
  • Low latency serial control - control of the Ada hand optimised for speed
  • EMG control - control the Ada hand via muscle and surface electrodes
  • Joystick control - control the Ada hand using the joystick of a Wii Nunchuck

The Ada hand can also be controlled using the following:

The above lists will be constantly updated as new control methods are developed.


Serial Control

For most applications, the most suitable control method will be to connect the Ada hand to a computer and to control it via a serial connection. All of these serial control methods require a 'Carriage Return' as the line ending.

BASIC MODE

This mode is the default control mode of the Ada hand, as it is very user friendly and slightly resembles the Gcode format. This control method is explained in detail in the Artichoke V1.2 Firmware User Guide.

LOW LATENCY MODE 

Low latency mode allows the position of each finger to be controlled at a faster rate than basic mode, and is very suited to interfacing with desktop applications (e.g. Matlab, Python). This mode receives the target position for each finger, and outputs the current position of each finger in the Comma Separated Value (CSV) format.

To enter into this mode (aka 'Research mode 0, finger position control') enter the serial command 'A10'. This setting changes the default hand control mode, meaning that on power up the hand will remain in 'Research mode 0'. To disable this mode, enter the command 'A10.

The format for the CSV string for both the setting the target position and reading the current position of each finger is detailed below.

Finger0_Pos, Finger1_Pos, Finger2_Pos, Finger3_Pos, Finger4_Pos
  • Finger0_Pos       position of the thumb (0 - 1023)
  • Finger1_Pos        position of the index finger (0 - 1023)
  • Finger2_Pos       position of the middle finger (0 - 1023)
  • Finger3_Pos       position of the ring finger (0 - 1023)
  • Finger4_Pos       position of the pinky (0 - 1023)

Where position 0 is a fully extended finger (open), and position 1023 is a fully contracted finger (closed).

WARNING, WE STRONGLY ADVISE THAT YOU ONLY USE A VALUE BETWEEN 50 - 973 TO PREVENT THE MOTORS FROM HITTING THEIR ENDSTOPS.

In Basic Mode, the position value 0 - 100 is mapped to 50 - 973, meaning there is no chance of the motors hitting their endstops in Basic Mode.

For example, sending the following string will move all of the fingers to the mid-position.

500,500,500,500,500

The target position of each finger is stored until it is overwritten by the latest target position CSV string, but the current position of each finger is printed over serial constantly. Therefore you can send a single target position command, and only send the next target position command until you read that the current position has reached the previous target position.

e.g. Pseudo code

targetPos_CSV= 50,50,973,973,50        // (this would move the fingers to perform the 'spiderman' grip gesture)
send targetPos_CSV to hand
while not (positionReached):
    read currentPos_CSV from hand
    if currentPos_CSV is equal to targetPos_CSV:
        positionReached is true
targetPos_CSV= 50,50,50,50,50        // (this would move the fingers to the open position)
send targetPos_CSV to hand

EMG control

The Artichoke firmware and the Almond board are configured so as to allow the Ada hand to be controlled via Electromyography (EMG) sensors. These sensors attach to surface electrodes placed on the forearm, and detect when the muscle is active. For a complete tutorial on this control method, visit our Muscle Control Tutorial.


JOYSTICK CONTROL

Any release after Artichoke V1.1 allows the Ada hand to be controlled via a Wii Nunchuck. This control method is called the 'HANDle', and is the most intuitive control method. This control method most suited to tasks that require grasping motions. For a complete tutorial on the HANDle, visit this tutorial


MATLAB INTEGRATION 

HAND CONTROL

The Ada hand is very suited to being integrated into projects using Matlab. With the hand in low latency mode (Research Mode 0), Matlab can be used to receive the current finger position data as a CSV string, which can then be split into it's individual components and logged. 

A simple Matlab UI could also be implemented to control the position of each finger using sliders, where the slider value for each finger is concatenated into a CSV string, which is then sent to the Ada hand.

Adding extra sensors

The Ada hand has been designed as a research platform. We fully encourage the addition of extra sensors for force feedback or other metrics. There are two main options for adding extra sensors to the hand, detailed below.

OPTION 1 - Add Ons

The Almond board datasheet details the unused Atmega2560 pins which have been broken out to the edge of the board. These can be used to communicate with external sensors, detailed below.

  • 2 x Analogue Pins
  • 8 x Digital IO (max)
  • 3 x 5V
  • 3 x GND
  • SPI
  • UART

Various sensors, such as Force Sensitive Resistors (FSR), can be soldered to the Almond board directly. The Artichoke firmware would then need to be modified to read the added sensors and print them over the serial port to the computer.

One advantage of using this option is that it requires only a single serial connection (Hand - Computer), resulting in a relatively compact and portable system.

The disadvantages of this option are that a maximum of 2 analogue pins are available. Furthermore, the sample rate of the sensor over the serial port may be slow, as the Artichoke firmware still needs to perform the various hand control functions.

OPTION 2 - extra arduino

A simpler option is to buy a small arduino (ArduinoNano) and connect the sensors to this extra arduino. The software running on the extra arduino can be incredibly simple, thus increasing the sample rate. It would also allow many more analogue inputs.

The disadvantages of this option are that the setup would require 2 serial connections (Hand - Computer, Extra arduino - Computer).


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().


Artichoke V1.1 Firmware User Guide


THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

OVERVIEW

In this tutorial you'll learn how to download and install the Artichoke V1.1 firmware for the Ada robotic hand. Artichoke is the version of hand control firmware designed for the Ada hand, running on the Almond board.

This tutorial is for:

You will need:


Getting Artichoke

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

Artichoke includes full serial control of individual fingers and grip patterns, muscle control through EMG sensors and provides a framework for adding extra functionality to the hand (nunchuck/joystick control). As with all of Open Bionics developer materials, this firmware is completely free to download and use, and we strongly encourage you to incorporate this into your projects, to improve it and build upon it.

Downloading and installing FINGERlib.h

Before downloading Artichoke, you need to download and install FingerLib.h, a custom finger control library. FingerLib.h is designed to run on a number of different Arduino compatible microcontrollers, and manages all of the low level motor control and handling of timers, it also includes various example sketches for simple finger control applications.

You will first need to download and install Arduino, next we will install FingerLib.h

  1. Navigate to our GitHub www.github.com/Open-Bionics/FingerLib
  2. Download FingerLib as a ZIP
  3. Extract FingerLib-master.zip and rename it to 'FingerLib' instead of 'FingerLib-master'
  4. Move the FingerLib folder to your Arduino libraries folder (usually My Documents\Arduino\libraries)
  5. Restart Arduino by closing it and opening it again
Download and install Arduino

Download and install Arduino

Download FingerLib from GitHub

Download FingerLib from GitHub

DOWNLOADING and installing ARTICHOKE

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

After FingerLib.h has been downloaded, we now need to download Artichoke and upload it to the Almond board.

  1. Navigate to www.github.com/Open-Bionics/Artichoke
  2. Download OpenBionics_Artichoke as a ZIP
  3. Extract Artichoke-master.zip
  4. Open the file OpenBionics_Artichoke.ino in the Arduino IDE
  5. Power up and connect the Ada hand to your computer
  6. Select the Arduino board (Arduino Mega 2560 or equivalent)
  7. Select the appropriate COM port (Instructions for Mac or PC)
  8. Upload the Artichoke firmware to the hand (if it is a right hand, the thumb may twitch when uploading)
  9. Once uploaded for the first time, the hand may be in demo mode
  10. Whilst in demo mode, the hand cycles through all of the various grips and finger movements
  11. See the next chapter to exit demo mode
Download Artichoke from GitHub

Download Artichoke from GitHub

Open OpenBionics_Artichoke.ino in Arduino (note, the other files within the folder may differ from this image as the firmware is updated)

Open OpenBionics_Artichoke.ino in Arduino (note, the other files within the folder may differ from this image as the firmware is updated)


Using Artichoke

Initial Config

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

Once uploaded to the Ada hand, connect to the hand via the Serial Monitor (baud 38400).

You should first be greeted with a printout of the firmware version number and board name, followed by a list of possible serial commands. The demo mode should then start, and can be disabled by entering 'A0', without the apostrophes. Entering 'A0' toggles whether demo mode will run on start up (default enabled), and entering 'D' will run demo mode once.

At any time, if you enter '?' the hand will print the list of serial commands, and entering 'A1' will toggle whether the serial commands display on start up. Note that all characters must be uppercase.

Enter '?' to view the list of serial command

Enter '?' to view the list of serial command

HAND TYPE

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

To select whether the Ada hand is a left or right hand, enter one of the following commands:

  • H1            Set the hand to be RIGHT
  • H2           Set the hand to be LEFT
  • H             View whether the hand is LEFT or RIGHT

Grip Control

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

With demo mode disabled, if you enter 'G0' the hand should should close in grip pattern 0 (Fist Grip), if you enter 'G0' again it should toggle the hand open in grip pattern 0.

Try this with 'G#' where # is a number between 0 - 5 to perform a movement in a selected grip pattern, the grip patterns are as follows;

  • G0 Fist Grip
  • G1 Palm Grip (Fist Grip but with thumb extended)
  • G2 Thumbs Up
  • G3 Point
  • G4 Pinch
  • G5 Tripod (Pinch using both index and middle fingers)

For a more detailed explanation on the grip patterns and how to create custom grips, visit this tutorial.

Enter 'G0' to toggle the hand between open and close in 'Fist Grip'

Enter 'G0' to toggle the hand between open and close in 'Fist Grip'

Finger Control

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

The fingers can be controlled individually by entering 'F#', where # is a finger number between 0 - 4.

  • F0 Thumb
  • F1 Index
  • F2 Middle
  • F3 Ring
  • F4 Pinky
Enter 'F0' to toggle the thumb between open and close

Enter 'F0' to toggle the thumb between open and close

Position and speed modifiers

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

You can also set the fingers to move to a certain position (P0 - P100) for a selected grip or finger, for example if you enter 'G5 P50' the hand will move to the halfway position of the Tripod grip, or with 'F1 P10' the Index finger will be almost fully closed (P0 = fully open, P100 = fully closed).

The speed can be set in a similar manner by entering 'G# S???', where ??? is a number between 0 - 255 (note that due to the PWM frequency, the motors will struggle to move at any value below around 200).

Both the position and speed can be added to a grip (G#) or a finger (F#) command at the same time, e.g. 'F1 P50 S240'

Move the index finger to be 50% closed at a speed of 24

Move the index finger to be 50% closed at a speed of 24

Advanced settings

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

Using an advanced command 'A#' allows different modes and settings to be configured, a full list of these settings can be seen by entering the '?' command.


EXTRAS

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

For details on the different control methods available within Artichoke V1.1, visit out Control Methods Guide.

IMPORTANT NOTE ABOUT I2C

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE

The 2 data lines passed through the 3.5mm 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 TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY ARTICHOKE V1.2 FIRMWARE USER GUIDE