• 1
    Step 1

    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.

  • 2
    Step 2

    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!

  • 3
    Step 3

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