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:31:04 2014 +0000
Revision:
1:e760cc1fdf24
Parent:
0:8c2f6da73612
Ran Code Cleanup Magic Wizard

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 1:e760cc1fdf24 11 void Get_Baseline(void)
mbedAustin 1:e760cc1fdf24 12 {
mbedAustin 0:8c2f6da73612 13 double sum = 0;
mbedAustin 0:8c2f6da73612 14 buzzer = off;
mbedAustin 0:8c2f6da73612 15 wait(1);
mbedAustin 1:e760cc1fdf24 16 for(int i=0; i<500; i++) {
mbedAustin 0:8c2f6da73612 17 gsrValue = gsr;
mbedAustin 0:8c2f6da73612 18 sum += gsrValue;
mbedAustin 1:e760cc1fdf24 19 wait(0.005);
mbedAustin 0:8c2f6da73612 20 }
mbedAustin 0:8c2f6da73612 21 baseline = sum/500;
mbedAustin 0:8c2f6da73612 22 printf("baseline = %f\n\r", baseline);
mbedAustin 0:8c2f6da73612 23 }
mbedAustin 0:8c2f6da73612 24
mbedAustin 0:8c2f6da73612 25 // main loop, compare against baseline
mbedAustin 0:8c2f6da73612 26 // sound buzzer if a >5% change happens
mbedAustin 1:e760cc1fdf24 27 int main()
mbedAustin 1:e760cc1fdf24 28 {
mbedAustin 0:8c2f6da73612 29 float delta;
mbedAustin 0:8c2f6da73612 30 Get_Baseline();
mbedAustin 1:e760cc1fdf24 31 while(1) {
mbedAustin 0:8c2f6da73612 32 gsrValue = gsr;
mbedAustin 0:8c2f6da73612 33 printf("gsrValue = %f\n\r",gsrValue);
mbedAustin 0:8c2f6da73612 34 delta = baseline - gsrValue;
mbedAustin 1:e760cc1fdf24 35 if(abs(delta) > 0.05) { // check for > 5% change
mbedAustin 0:8c2f6da73612 36 gsrValue = gsr;
mbedAustin 0:8c2f6da73612 37 delta = baseline - gsrValue;
mbedAustin 1:e760cc1fdf24 38 if(abs(delta) > 0.05) { // double check
mbedAustin 0:8c2f6da73612 39 buzzer = on;
mbedAustin 0:8c2f6da73612 40 printf("YES!\n\r");
mbedAustin 0:8c2f6da73612 41 wait(3);
mbedAustin 0:8c2f6da73612 42 buzzer = off;
mbedAustin 0:8c2f6da73612 43 wait(1);
mbedAustin 0:8c2f6da73612 44 }
mbedAustin 0:8c2f6da73612 45 }
mbedAustin 0:8c2f6da73612 46 }
mbedAustin 0:8c2f6da73612 47 }