GSR, standing for galvanic skin response, is a method of measuring the electrical conductance of the skin. Strong emotion can cause stimulus to your sympathetic nervous system, resulting more sweat being secreted by the sweat glands. Grove – GSR allows you to spot such strong emotions by simple attaching two electrodes to two fingers on one hand, an interesting gear to create emotion related projects, like sleep quality monitor.

Dependencies:   mbed

Description

GSR, standing for galvanic skin response, is a method of measuring the electrical conductance of the skin. Strong emotion can cause stimulus to your sympathetic nervous system, resulting more sweat being secreted by the sweat glands. Grove – GSR allows you to spot such strong emotions by simple attaching two electrodes to two fingers on one hand, an interesting gear to create emotion related projects, like sleep quality monitor.

Specifications

  • Input Voltage: 5V/3.3V
  • Sensitivity adjustable via a potentiometer
  • External measuring finger cots

Use

Load code onto mbed, plug GSR into an Analog port and buzzer (optional) into a digital port. Make sure to change to ping mapping in the code to match the pin mapping you select. Put on finger cuffs. Reset the board. The program will take a baseline and then start running. when it detects a change in GSR > 5% the buzzer will go off. The results are also printed to the terminal for debugging / fine tuning.

Further Description

See the Seed Grove GSR Wiki Page

main.cpp

Committer:
mbedAustin
Date:
2014-09-23
Revision:
1:e760cc1fdf24
Parent:
0:8c2f6da73612

File content as of revision 1:e760cc1fdf24:

#include "mbed.h"

AnalogIn gsr(A0);
DigitalOut buzzer(D5);

float gsrValue = 0;
float baseline = 0;
int on = 1, off = 0;

// calculate baseline to compare against
void Get_Baseline(void)
{
    double sum = 0;
    buzzer = off;
    wait(1);
    for(int i=0; i<500; i++) {
        gsrValue = gsr;
        sum += gsrValue;
        wait(0.005);
    }
    baseline = sum/500;
    printf("baseline = %f\n\r", baseline);
}

// main loop, compare against baseline
// sound buzzer if a >5% change happens
int main()
{
    float delta;
    Get_Baseline();
    while(1) {
        gsrValue = gsr;
        printf("gsrValue = %f\n\r",gsrValue);
        delta = baseline - gsrValue;
        if(abs(delta) > 0.05) { // check for > 5% change
            gsrValue = gsr;
            delta = baseline - gsrValue;
            if(abs(delta) > 0.05) { // double check
                buzzer = on;
                printf("YES!\n\r");
                wait(3);
                buzzer = off;
                wait(1);
            }
        }
    }
}