Sunteți pe pagina 1din 4

EMG Robotic Hand

Introduction
 The goal of the project was to create a robotic hand that is controlled by sensing the
muscular contractions in the arm of the user and to replicate the movements on the robotic
hand.
 Electrodes will be placed on multiple areas on the arm of the user, and will sense the voltage
differences of the muscles as they contract. The signal will be fed into a circuit which
amplifies and filters the signal. The resulting signal will then be sent into the
Arduino(ATMEGA mic) which will analyze the readings. An algorithm then decides which
fingers should be moved and uses servos attached to each finger of the hand to move the
fingers.

Logical Structure & Setup Approach

To read the muscle contractions in the arm, surface electromyography (EMG) techniques was
used. Electrodes were placed on two areas on the underside of the arm to read the electrical
signals. These places were chosen by empirical estimates, as they produced the greatest
muscle contractions when the fingers were pressed. Since the electrodes are placed on the
surface of the skin, the signal strength is very weak (~2mV at best) and noisy.

To improve the signal, the signal was fed into an instrumentation amplifier, followed by a
high pass filter, a differential amplifier, and finally a low pass filter. The amplified and
filtered signals were then fed into Analog to Digital Converters on the Arduino(ATMEGA
mic) If certain conditions were met, a finger was determined to be pressed, and servos would
pull a string attached to a finger of the robotic hand to contract it.

Hardware

Since neurons generally fire between 0-500 Hz, a sampling speed of 500 Hz was used for the
ADC. This meant that new signal readings were coming in once every 1/500 of a second and
the software would need to process and be ready for a new value within that time. Since 500
Hz is a relatively small sampling speed, both hardware and software components were able to
process successfully within that time.

To optimize the project even more, we tried to balance the hardware and software sides. To
do so, we added a sliding moving averager within software that basically acts like a crude
low pass filter since it smoothes out the signal and cuts out higher frequencies. This produced
a more consistent and steady signal reading instead of the rapidly oscillating signal coming in
directly into the ADC from the electrodes. We also made a design tradeoff by using a cutoff
for the high pass filter to be around 72 Hz, so that we had a better elimination of the 60 Hz
line noise, at the expense of losing some signal data at these frequencies.

We also made a design tradeoff by using a cutoff for the high pass filter to be around 72 Hz,
so that we had a better elimination of the 60 Hz line noise, at the expense of losing some
signal data at these frequencies.
SOFTWARE DESIGN
ADC

The ADC has two functions: sampling & conversion. The sampling rate for the ADC is set by
using a clock divider and changing sample hold time for the ADC. All this is controlled in the
initial configuration of the ADC. The ADC is configured to auto sample and convert. We also
scan two analog input values (AN2 and AN3), from two different electrodes. The conversion
results are placed in ADC buffer 0 and buffer 1. The ADC clock is around 588 kHz.

However, we do not get samples at 588 kHz, as most EMG signals have a frequency range of
5-150 Hz. So we use Timer2 ISR to read ADC buffer values at a predetermined sample rate.
We experimented with different sampling rates and found that 500 Hz was good enough for
the signal to not have any aliasing. In order to do this, we set the prescaler to 16, and loaded
the timer with a value of 50,000. Most of the filtering is done in the ISR.

Region Detection (Thresholding)

We use two electrodes to detect 5 fingers. Each electrode input has an ADC range of 0-1024.
So we can represent the total input space as a 2D square space of size 1024x1024. We then
empirically measure the block regions that each finger can correspond to. Even though the
relative strengths of different fingers remain the same across different people or
environments, the magnitudes themselves were people and environment dependent.

Noise plays a role in determining the regions in the 2D space for different fingers. In order to
minimize the noise, we made sure the wires were twisted together tightly; there was no direct
power supply from an AC power socket; and we were in an environment of low light away
from the 120Hz frequency influence of the above fluorescent bulbs. Even though we were not
able to completely eliminate noise, we tried to minimize it as much as we could. We then did
empirical estimates for different finger regions by looking at ADC read values in PuTTy.
We did addition checking for consistency in these threshold regions to activate a finger
movement. We created an array variable called changes which keeps track of the number of
times the ADC inputs have been encountered in any of the finger regions. We also created an
array variable called finger_state, which is set to 1 if a particular finger is pressed. In our
current program, we constrain it such that only one finger can be pressed at a time, as
multiple finger detection would require more electrodes and more complexity.

If this number of changes crosses an upper threshold for the finger, we mark that finger as
being pressed. Similarly, to measure if a particular finger is released, we decremented the
changes variable for a finger if it was outside the finger’s region. If this value goes below a
lower threshold, we identify the finger as being released. This is seen just an implementation
of hysteresis for the finger input, so that the finger does not rapidly fluctuate up and down
due to random noise fluctuations.

We chose to move only one finger at a time. This is done by using constraining only one
finger’s state to be pressed at any given time. This is done so that the complexity of our
project is reduced. If many finger movement is to be implemented, we would have to use
more electrodes and find move innovative ways to isolate regions for combination of fingers.

Servo Movement

To control the fingers on the robotic hand, servos attached to string manually pull the fingers
down when the servos swing 180 degrees. To control the servos, PWM waves sent to the
servo determine which angle the servo points to. For example, when the signal is high for
0.54 ms, the servo is at 0 degrees. When the signal is high for 2.5 ms, the servo points to 180
degrees.

Since operating servos requires a 50 Hz PWM wave and the PIC32 clock cycle is at 40 MHz,
or 4010^6 ticks per second, 4010^6 / 50 = 800,000 ticks per period. Since 800,000 overloads
the timer, a prescaler of 16 was used. Therefore, 800,000/16 = 50,000 ticks/period with a
prescaler of 16. It was found that to get the servos to point to 0 degrees, 1,350 of the 50,000
ticks need to be high. For the servos to point to 180 degrees, 6,250 ticks would need to high
out of the total 50,000. Loading the PWM function of the PIC32 with the number of ticks that
need to be high during one period allowed us to successfully output PWM waves and control
the angle which the servos were pointing at.
Servo Lock

Each servo has a finite time to rotate by 180 degrees. We empirically estimated this value to
be 600 ms. We had to make sure that no other servo moved when another finger servo was
moving, and make sure not to change the state of a particular finger unless 600 ms has
passed. Both of these conditions were met by implementing a variable called lock_motor.
Initially lock_motor is set to 0 when no finger servo is moving. If there is a change of state
and if no other servo is moving, we set lock_motor to the current finger digit and make sure
that no other finger moves unless this finger servo resets the lock_motor value back to 0. This
is not done for at least 600 ms. Thus, by introducing this variable, we ensure that two finger
servos do not move at the same time.

S-ar putea să vă placă și