Hey there.I have been using myoware sensor for few months and it was working fine till now.when i connect it to arduino it starts normally and gives values only when i flex my muscle but after few minutes it starts giving random high values which without even flexing.i dont know whats wrong with sensor kindly help how i can recify it as this is a great obstacle in my project.Thanx…
Hi,
Could you provide more details about the issue :
]A picture showing your wiring (MCU + MyoWare Sensor)/:m]
]How are you powering the MyoWare ? Did you change the power supply ?/:m]
]Did you try to modify the gain by varying the potentiometer on the MyoWare Sensor ?/:m]
]What is the code you are using ?/:m]
yeah Sure…
1- basic wiring of sensor with mcu is attached below.
2- I have been powering the Sensor from 3.3 volts of arduino directly.i do use 6v nimh battery but that is for powering servo.i did not changed power supply of myoware sensor.i even tried recently to validate this using only led sheild of myoware and observed same problem there.
3- I did tried to modify the gain once but due to unavailability of proper tool could not modify it and may have just moved merely.after that i havent again tried to modify it.
4- i am using a code that moves the servo motor according to flexing of muscle.even using simple analogserial example of arduino is giving me fluctuation which intiates after around 10 - 15 minutes of usage.
This is the code im recently using…it uses smoothing to take average of 20 reading for smoother output and rotates the servo to 170 deg when threshold increases.
#include <Servo.h>
Servo myservo;//myservo1,myservo2;
const int numReadings = 20;
int readings[numReadings]; // the readings from the analog input
int readIndex = 0; // the index of the current reading
int total = 0; // the running total
int average = 0; // the average
int inputPin = A0;
const int threshValue = 150;
// These constants won’t change. They’re used to give names
// to the pins used:
const int analogInPin = A0; // Analog input pin that the myoware is attached to
int sensorValue = 0; // value read from the myoware
void setup() {
// initialize serial communications at 9600 bps:
myservo.attach(9);
// myservo1.attach(10);
//myservo2.attach(11);
Serial.begin(9600);
// read the analog in value:
// initialize all the readings to 0:
for (int thisReading = 0; thisReading < numReadings; thisReading++) {
readings[thisReading] = 0;
}
}
void loop() {
// subtract the last reading:
total = total - readings[readIndex];
// read from the sensor:
readings[readIndex] = analogRead(inputPin);
// add the reading to the total:
total = total + readings[readIndex];
// advance to the next position in the array:
readIndex = readIndex + 1;
// if we’re at the end of the array…
if (readIndex >= numReadings) {
// …wrap around to the beginning:
readIndex = 0;
}
// calculate the average:
average = total / numReadings;
// send it to the computer as ASCII digits
Serial.println(average);
delay(1); // delay in between reads for stability
sensorValue = analogRead(inputPin);
float voltage = sensorValue*(5.0/1023.0);
//Serial.print(millis());
// Serial.print(’,’);
// Serial.println(sensorValue);
if(sensorValue < threshValue)
{
myservo.write(0);
// myservo1.write(0);
// myservo2.write(0);
delay(100);
}
else{
myservo.write(170);
//myservo1.write(170);
// myservo2.write(170);
delay(100);
}
}
Seeing your wiring, you seem to use configuration without isolation as explained in the user manual page 3.
It is indicated that :
You might want to try the recommended configuration (configuration a in page 2)