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