Muscle Control V1.1


OVERVIEW

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

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:


Sensors

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

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.

CONSTRUCTIng the sensor

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

EMG sensors are becoming more widely available; this tutorial involves the modification and use of the Muscle Sensor V3 boards from Advancer Technologies, however this tutorial will also briefly cover the use of their new MyoWare boards as well.

Step1.png

The first step is to attach the battery snaps to the Muscle Sensor V3 boards.

1. Solder the negative (black) wire from the first battery snap and the positive (red) wire of the second battery snap, to the GND pad of the Muscle Sensor V3 board


Step2.png

2. Solder the positive (red) wire of the first battery snap to the '+Vs' pad on the Muscle Sensor V3 board

3. Solder the negative (black) wire of the second battery snap to the '-Vs' pad on the Muscle Sensor V3 board

You should now have the first battery snap connected between '+Vs' and GND, and the other battery snap between GND and '-Vs'


Step3.png

4. Solder a 10cm wire between the '+Vs' pad on the first Muscle Sensor V3 board to the '+Vs' pad on the second Muscle Sensor V3 board

5. Solder a 10cm wire between the GND pad on the first Muscle Sensor V3 board to the GND pad on the second Muscle Sensor V3 board

6. Solder a 10cm w ire between the '-Vs' pad on the first Muscle Sensor V3 board to the '-Vs' pad on the second Muscle Sensor V3 board


The next step is to attach the Muscle Sensor V3 boards to the headphone jack.

  1. Solder the GND pad on the second Muscle Sensor V3 board to the GND connection on the headphone jack
  2. Solder a wire from the SIG connection on the first Muscle Sensor V3 board to the first signal pin (SCL/ADC6/RX) of the headphone jack
  3. Solder a wire from the SIG connection on the second Muscle Sensor V3 board to the second signal pin (SDA/ADC7/TX) of the headphone jack
  4. DO NOT CONNECT 5V as this may damage the board

The EMG sensors should now be ready for us to plug into the headphone jack on the Ada hand, but first we need to connect the electrodes.


POSITIONING the electrodes

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

Each sensor board requires three electrodes to attach to the skin; 2 electrodes used for the muscle signal (red + blue) and a 3rd electrode used for a body/ground reference (black). However, when working with 2 channels we are able to discard one of the body/ground reference electrodes (black). The 5 remaining electrodes should be placed on the forearm as seen below.

  1. Press each of the sticky electrode pads into the electrode sensors
  2. Peel off the paper backing of each sticky electrode and apply to the skin in the locations shown in the image below
  3. The muscle signal electrodes (red + blue) for each channel should be placed on the area of the forearm with the greatest muscle mass, with at least 2cm between them
  4. The body/ground reference (black) electrode should be placed on an area of the body without much muscle mass, such as the elbow
Forearm electrode placement

Forearm electrode placement

Note that the sticky electrodes are single use only, and the quality of the signal degrades greatly after they are removed and reapplied. 


Firmware

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

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. Before we dive into each of these control methods, we need to confirm the EMG sensors are working correctly. To do this we need to enable 'Standard Muscle Control' mode by entering 'M1' over serial. The hand may start to move or jitter at this point, you can either leave the hand jittering or you can disable the motors by entering 'A3' (be sure to re-enable the motors again at the end by entering 'A3').

Once  'Standard Muscle Control' mode (M1) is enabled, the hand will take an initial sample of 150 muscle values (takes 200ms), which is used to generate the initial baseline values for each of your muscles, called the noise floor. This noise floor is the default value of your muscles when they are not active (not tensed), and changes depending on a wide range of factors, such as electrode placement, skin contact due to sweat/hairs etc. Once generated, the noise floor is used as the baseline reading of your muscles. This noise floor is updated with each new EMG sample, but only if the muscle is determined to not be active at the time of reading (a noise floor can be generated manually by entering 'N').

A threshold value is used to determine if the muscle is active or inactive. This value is generated by adding a specified sensitivity value to the noise floor. If the current EMG sample is greater than the threshold value, the muscle is determined as activate, else, the muscle is inactive. The sensitivity value can be set via serial by entering the command 'U###', where # is a number between 0 - 1023.

With the hand in 'Standard Muscle Control' mode (M1), enter the command 'M3' to view a real-time dump of the EMG and muscle control data.

Muscle Control Data Dump (M3)

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

'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)

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.

 


Muscle control METHODS

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

Once you have confirmed the EMG sensors are working and wired correctly, you can start to control the hand using your muscles. 

The image on the right shows how the two hand motions you should perform to activate the inside and outside forearm muscles with the least amount of effort.

If you find that the hand is responding to the opposite command (i.e. you perform an open movement and the hand closes) switching the electrode sensor wires between the two Muscle Sensor Boards.

STANDARD MUSCLE CONTROL (M1)

The default control mode is standard muscle control; the hand will either open or close, depending on which of the muscles is tensed. For example, when the outer forearm muscle is tensed, the hand should open, and when the inner forearm muscle is tensed, the hand should close. 

If the hand is open, and you hold the open forearm muscle for > 500ms, the hand should cycle to the next grip pattern, you should then be able to open and close as normal in this grip pattern. 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

To enable this control mode, enter 'M1' over serial, this method will also stay enabled after a power cycle, unless it is disabled by entering 'M0'.

POSITIONAL MUSCLE CONTROL (M2)

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

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 the size of the muscle activation/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. To enable this control mode, enter 'M2' over serial, this method will also stay enabled after a power cycle, unless it is disabled by entering 'M0'. For this mode you may need to decrease the sensitivity 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.


extra

I2C MUSCLE SENSORS

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

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

THIS TUTORIAL HAS BEEN ADDED TO THE ARCHIVES ON 22/08/16 AS IT HAS BEEN REPLACED BY MUSCLE CONTROL V1.2

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