Hi, I bought Olimex Shield EKG-EMG. does anyone know how to configure it to read EMG signals? Does anyone even have a sketch to operate a servomotor with EMG signals as input?
>does anyone know how to configure it to read EMG signals?
Parts: Arduino UNO, Olimex EKG/EMG shield, Servo (Towerpro MG92B)
Configuration for Olimex:
AIN SEL A5 Jumper across pins 10,11
D4
Ref E closed
5 v
Servo leads connect to D9, 5v, GND on Olimex shield.
Three electrodes (adhesive): 2 left mid-forearm, one lateral (black), one medial (red). Other electrode (white) posteriorly above elbow (distal humerus).
>Does anyone even have a sketch to operate a servomotor with EMG signals as input?
Basic Arduino code which should get you started:
#include <Servo.h>
Servo servo;
int servoPin = 9; // D9
int angle = 0; // servo position in degrees
//AIN SEL jumpers across 10,11
const int analogInPin = A5;
int sensorValue = 0;
void setup()
{
Serial.begin(9600);
servo.attach(servoPin);
}
void loop()
{
sensorValue = analogRead(analogInPin);
sensorValue = sensorValue >> 2;
Serial.println(sensorValue);
// Controls the sensitivity
if (sensorValue > 135) {
Serial.println(sensorValue);
for(angle = 0; angle < 180; angle+=4) {
//for(angle = 180; angle > 0; angle-=4) {
servo.write(angle);
delay(15);
}
}
}
After code has been uploaded and run in Arduino IDE, select Tools/Serial Plotter to view EMG trace.
Image of setup is here:
https://www.dropbox.com/s/93x6j2p4siuhr9p/emg.jpg?dl=0 (https://www.dropbox.com/s/93x6j2p4siuhr9p/emg.jpg?dl=0)