EMG Sensor Problem

Hi Guys

I have a prosthetic arm project that uses 2 Myoware Muscle Sensors and an Arduino Uno. We have problems with the grip --> the servos always glitch or does not work at all.

Also, It does not accurately read the readings from the muscle sensors even though we use electro pads properly. Even though we didn't flex our muscles, the servos are moving...

Here is the Code:

#include <Servo.h>

Servo servo2; //Elbow
Servo servo3; //middle finger
Servo servo4; //Thumb
Servo servo5; //Index finger
Servo servo6; //Ring + pinky finger

void setup()
{
Serial.begin(9600);
servo2.attach(10); //Elbow
servo3.attach(9); //Middle finger
servo4.attach(8); //Thumb
servo5.attach(7); //Index finger
servo6.attach(6); //Ring + pinky finger
}

void loop()
{
Serial.println(analogRead(2)); //read EMG 1(bicep)
if(analogRead(2) > 500) { //if bicep flex... bend elbow
servo2.write(180);
}

else if (analogRead(2) < 500) {
servo2.write(60);

}
Serial.println(analogRead(3)); //read EMG 2(forearm)
if(analogRead(3) > 500) {
//fingers close
servo3.write(180);
servo4.write(180);
servo5.write(180);
servo6.write(180);

}

else if (analogRead(3) < 500) {
//fingers open
servo3.write(0);
servo4.write(0);
servo5.write(0);
servo6.write(0);
}
delay(1000);

}

About 95% of servo problems mentioned on this forum result from inadequate servo power supplies. Always use a separate power supply, budgeting at least 1 Ampere/servo for small servos like the SG90, and at least 2.5 Amperes/servo for the larger ones, like the MG996.

Don't forget to connect all the grounds.

Any circuitry involved with detection of tiny voltages must be carefully isolated from external influences, like overhead lighting, household wiring, power supply fluctuations and the like. The detection circuitry must have a good ground reference connection at the source as well. Avoid ground loops!

I have the Myoware sensor and it can work sometimes, but for me it was not possible to make it work consistent every time.

The sensor works best when there is no path to the mains. With a battery powered Arduino or with a laptop (running on its batteries) there is less noise.
The position of the pads is very important and there must be muscle power, not just moving an arm.

Some use better pads, perhaps you can try to get a few.
I don't know what to do to make it work, I never got there myself :frowning_face: