![](/media/cache/group/Logo-slogen.png.50x50_q85.png)
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
Diff: main.cpp
- Revision:
- 0:8c2f6da73612
- Child:
- 1:e760cc1fdf24
diff -r 000000000000 -r 8c2f6da73612 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 23 21:10:56 2014 +0000 @@ -0,0 +1,45 @@ +#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); + } + } + } +}