Uses an Arduino and Backyard Brains shield to count the number of times a user opens and closes their hand.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
Attach the SpikerShield to an Arduino
The output of the SpikerShield is an analog value between 0 and 5 volts. It is connected to one of the Arduino's analog inputs. There is a jumper on the shield to determine which one. I keep mine on A0.
Attach the Electrodes to Your Arm and the Shield
The electrodes need to be attached in specific locations. The 2 signal electrodes go on the inside of your forearm. I had one located about 2-finger widths from the bend of my elbow (measuring from the bend to the edge of the electrode). Moving further away from my elbow I placed the next one about 2 finger widths after the first. Those get connected to the red and black cables (it doesn't matter which goes where). You also need a ground. I put that on the outside of the bend in my elbow and connected it is connected to the white cable. Each of those cables should be plugged into the corresponding colored RCA plug on the shield.
With the shield and electrodes connected we can begin measuring stuff!
Determine the Maximum Output Value
First let's see what range our output falls into. The following Arduino code will show the maximum and current value of the measurement from the shield on the serial monitor. Load this in your Arduino IDE, run it and start flexing (don't forget to relax too, ie flex, relax, flex, relax, flex, relax, stare at barrage of numbers, flex, relax):
#define SMOOTHING 1
int values[SMOOTHING];
int index = 0;
const int inputEmg = A0;
int maxReading = 0;
void setup(){
Serial.begin(9600);
Serial.println(' ');
pinMode(inputEmg, INPUT);
for( int i=0; i<SMOOTHING; i+=1 ){
values[i] = 0;
}
}
void loop(){
// Read the current emg signal
int reading = analogRead(inputEmg);
// Update the buffer of last read values, overwriting the oldest
values[index] = reading;
index += 1;
if( index >= SMOOTHING ){
index = 0;
}
// Compute the average of the last values
int average = 0;
for( int i = 0; i<SMOOTHING; i+=1 ){
average += values[i];
}
average /= SMOOTHING;
// if this is a new max, remember it
if( average > maxReading ){
maxReading = average;
}
// Debug info: max, lastReading
Serial.print(maxReading);
Serial.print(", ");
Serial.println(average);
}
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates
Great BYB board application! @NeuroJoe, you should check this out!