Arduino GSR

Galvanic skin response with only two external parts.

x-axis: time, 10px/s; y-axis: conductance, no units

Schematics

Adjustable current (~5μA) is passed through the subject and the voltage drop is read with AtMega ADC (as we have not found any other ADC). The ADC reference level is set by the second potentiometer.

Adding capacitors to AREF and ADC (A0) improves stability. We recommend something like 47 μF to AREF and 2.2 μF to ADC.

Electrodes

Electrodes are placed on two fingers of the same hand.

Using pieces of PCB (or other metal) as electrodes is really prone to motion and galvanic artifacts. Using 4x4cm TENS gel electrodes gives clean signal with no motion artifacts. The electrode is rolled around the finger and secured by rubber band.

Usage

  1. Set OFFSET to maximum resistance
  2. Connect electrodes
  3. Adjust REF to get the signal approximately to the middle of the scope
  4. If this is impossible or the signal is very noisy, decrease resistance of REF

Source

int sensorPin = A0;
int sensorValue = 0;
 
void setup() {
  Serial.begin(9600);
  analogReference(EXTERNAL);
}
 
void loop() {
  sensorValue = analogRead(sensorPin);    
  Serial.println(sensorValue,DEC);
  delay(100);
}
#!/usr/bin/python3
import pygame
import random
import time
import serial
import sys
 
SCREENSIZE = XSIZE, YSIZE = (1350, 514)
 
screen = pygame.display.set_mode(SCREENSIZE)
x = 4
 
# background color
bg = (200,200,200)
 
# line color
fg = (0,0,0)
screen.fill(bg)
 
ser = serial.Serial(port="/dev/ttyUSB0", baudrate=9600, timeout=1)
 
yprev=0
 
# grid color
gc = (150, 150, 150)
 
def grid(x):
  ''' Draw horizontal grid '''
  for i in range(1,500,50):
    pygame.draw.line(screen, gc, (x, i), (x,i))
 
from datetime import datetime
from time import gmtime, strftime
 
wow=datetime.now().strftime("%Y-%m-%d-%H%M%S")
l=open("./gsr-%s.txt"%(wow), "a")
 
 
while True:
  line = ser.readline()
  sys.stdout.write(line.decode("utf-8"))
  l.write(line.decode("utf-8"))
  x = (x+1)%(XSIZE-2)
  try:
    y = int(line)/2
  except:
    y=0
 
  # remove previous data
  pygame.draw.line(screen, bg, (x, 0), (x,YSIZE))
  # draw red line
  pygame.draw.line(screen, (255,0,0), (x+1, 0), (x+1,YSIZE))
  # draw grid
  grid(x)
  # draw data
  pygame.draw.line(screen, fg, (x, y), (x,yprev))
  yprev=y
  pygame.display.update()