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

Committer:
mbedAustin
Date:
Tue Sep 23 21:10:56 2014 +0000
Revision:
0:8c2f6da73612
Child:
1:e760cc1fdf24
initial commit of repo;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 0:8c2f6da73612 1 #include "mbed.h"
mbedAustin 0:8c2f6da73612 2
mbedAustin 0:8c2f6da73612 3 AnalogIn gsr(A0);
mbedAustin 0:8c2f6da73612 4 DigitalOut buzzer(D5);
mbedAustin 0:8c2f6da73612 5
mbedAustin 0:8c2f6da73612 6 float gsrValue = 0;
mbedAustin 0:8c2f6da73612 7 float baseline = 0;
mbedAustin 0:8c2f6da73612 8 int on = 1, off = 0;
mbedAustin 0:8c2f6da73612 9
mbedAustin 0:8c2f6da73612 10 // calculate baseline to compare against
mbedAustin 0:8c2f6da73612 11 void Get_Baseline(void){
mbedAustin 0:8c2f6da73612 12 double sum = 0;
mbedAustin 0:8c2f6da73612 13 buzzer = off;
mbedAustin 0:8c2f6da73612 14 wait(1);
mbedAustin 0:8c2f6da73612 15 for(int i=0; i<500;i++){
mbedAustin 0:8c2f6da73612 16 gsrValue = gsr;
mbedAustin 0:8c2f6da73612 17 sum += gsrValue;
mbedAustin 0:8c2f6da73612 18 wait(0.005);
mbedAustin 0:8c2f6da73612 19 }
mbedAustin 0:8c2f6da73612 20 baseline = sum/500;
mbedAustin 0:8c2f6da73612 21 printf("baseline = %f\n\r", baseline);
mbedAustin 0:8c2f6da73612 22 }
mbedAustin 0:8c2f6da73612 23
mbedAustin 0:8c2f6da73612 24 // main loop, compare against baseline
mbedAustin 0:8c2f6da73612 25 // sound buzzer if a >5% change happens
mbedAustin 0:8c2f6da73612 26 int main() {
mbedAustin 0:8c2f6da73612 27 float delta;
mbedAustin 0:8c2f6da73612 28 Get_Baseline();
mbedAustin 0:8c2f6da73612 29 while(1){
mbedAustin 0:8c2f6da73612 30 gsrValue = gsr;
mbedAustin 0:8c2f6da73612 31 printf("gsrValue = %f\n\r",gsrValue);
mbedAustin 0:8c2f6da73612 32 delta = baseline - gsrValue;
mbedAustin 0:8c2f6da73612 33 if(abs(delta) > 0.05){ // check for > 5% change
mbedAustin 0:8c2f6da73612 34 gsrValue = gsr;
mbedAustin 0:8c2f6da73612 35 delta = baseline - gsrValue;
mbedAustin 0:8c2f6da73612 36 if(abs(delta) > 0.05){ // double check
mbedAustin 0:8c2f6da73612 37 buzzer = on;
mbedAustin 0:8c2f6da73612 38 printf("YES!\n\r");
mbedAustin 0:8c2f6da73612 39 wait(3);
mbedAustin 0:8c2f6da73612 40 buzzer = off;
mbedAustin 0:8c2f6da73612 41 wait(1);
mbedAustin 0:8c2f6da73612 42 }
mbedAustin 0:8c2f6da73612 43 }
mbedAustin 0:8c2f6da73612 44 }
mbedAustin 0:8c2f6da73612 45 }