Galvanic Skin Response (GSR) Reader using Arduino

I have implemented a simple GSR module using Arduino in order to use for my research. I thought of sharing it with you.

What is GSR ?

When people are anxious, they tend to sweat due to the activity of Sympathetic Nervous System. This is different from the typical sweating and it’s highly reflected at palms and foot. Because of this sweating, it causes a difference in conductivity of the skin, by reducing the resistance. Hence, it is used as a measurement of anxiety, which in turns can be used in lie detection. But it should be noted that the accuracy of this is very low, since the same conditions may rise due to other countermeasures, such as emotions.

Arduino code.

void setup(){
  Serial.begin(9600);
}
void loop(){
  int a = analogRead(A0);
  // Sleep for 50ms, which provides the recommended sample rate (20Hz)
  delay(50);
  Serial.println(a);
}

What this code does is reading the data from the Analog 0 and write it to the Serial. It can be read through the USB port using a simple RS232 reader.

If you’re familiar with Arduino, you know how to write it to the Arduino. If not, don’t worry, here is a simple guide how to do it.

First, we have to write this to an Arduino module. For that, we need Arduino IDE and it can be freely downloaded from their website. When you install the software, you will get the drivers for the Arduino modules as well (please note that you need these drivers, not just to program, but also to connect an Arduino and read data).

Open the Arduino IDE and write the above code (or simple Copy & Paste). In order to write to the Arduino, you need to know the type of the Arduino (either it’s Uno, Leonardo, LilyPad etc.) and select it from the Tools -> Borad.

And also we need to know which COM port the Arduino is connected to. You can see it from the Ports in Device Manager window (Right click My Computer (This PC) -> Manage -> Select Device Manager from the left side, if you’re using Windows). Then check the corresponding COM Port which connects the Arduino and we need to select it in the Arduino IDE, from Tools -> Serial Port.

Then write the code to the Arduino module by clicking burn . If it is successful, it will print “Upload Successful” message in the console.

Circuit Setup

Even though above program pushes the reading to the Serial Port, in this case USB port, we need to set it up to read skin conductivity. For that, we need to create a simple circuit which gives the comparative value of the conductivity of two fingers. The circuit is as follows.

GSR_Circuit
Circuit Diagram for GSR
  1. Connect the 5V, GRND, A0 to the 5V, GRN and A0 pins in the Arduino respectively.
  2. Connect the ARef to the ARef pin in the Arduino, which gives the reference for the Analog readings.
  3. Use Copper or Silver plates to the finger 1 & 2. You may use a velco cloth to make it steadily connects with fingers.
  4. Use C = 0.1 µF, R = 2KΩ to 300KΩ (I have used 240KΩ).
  5. You may apply a little amount of Conductive Gel on two fingers, in order to increase the strength of the readings.

The final setup would be like this.

GSR using Arduino
GSR using Arduino

Now everything is ready..!!

Reading Serial Data

Now you can use any programming language to write a simple program to read the corresponding COM Port. Please note, that you have to face lots of problems when you’re using C/C++ for this task (See this if you’re still interested). Then I tried to use Java to read the Serial port, and it worked (See this). Then I tried to plot the data, but it was SLOW as expected. But after reading the data, we can do WHATEVER we want with it. 🙂

Then it hit me, why can’t I use already available serial port reading programs :P. I tried, RS232 Data Logger by Eltima Software, and I simply could select the COM Port and write it to a file.

For offline usage, you can use a plotting to make a graph. If you’re using MATLAB, you can use smoothing alorithms to smooth the signal.

GSR_Readings
Plotted GSR Values

In here, the drastic changes in the readings shows the anxiety of the person (But it does NOT mean that he is lying in a lie detection test).

18 comments on “Galvanic Skin Response (GSR) Reader using Arduino

  • Gluce , Direct link to comment

    Hi, thank you for your post. This looks great. However, could you post a picture of the Arduino with all the connections? I don’t know how to read the scheme. Also, it looks like in the scheme you didn’t connect the ARef, right? If I understand what you said, I would have to connect finger 1 to both ARef and 5 volt?

    • Gluce , Direct link to comment

      Sry, one more question, you use the ARef as reference. But, in the Arduino code you are not telling the arduino that you are using the ARef.
      As I understand, you should use something like:
      analogReference(EXTERNAL);
      If you don’t write this, isn’t the ARef useless? I would really like to know because I want to use this in Matlab, but in Matlab I would not have the function analogReference(EXTERNAL). So, I would not know what to do to tell the arduino what I am doing.

      • Praneeth Peiris , Direct link to comment

        I’m so sorry that I have missed this reply. It’s been quite a while since I made this circuit. The idea of this circuit (and all the GSRs) is to measure the resistance between two fingers. It’s measured by detecting the voltage difference between the two electrodes. If the person is anxious, there will be a small amount of sweat which cannot be detected by a human eye, but will change the resistance between the electrodes. So, we use one finger as a direct input to compare it with 5V. I’m not sure of using `analogReference(EXTERNAL)` though.

  • Gluce , Direct link to comment

    Sorry, but I have one final question: if I understand, basically all you are doing is reading the value of the analog pin. Doesn’t that give you a value between 0 and 1024? How do you convert that value in Microsiemens? Or at least in voltage?

    • Praneeth Peiris , Direct link to comment

      Yes, true! We will only get a value in between 0-1023. There is no direct way of converting it into Siemens. That’s why the accuracy can be low in this kind of circuits.

  • Praneeth Nilanga Peiris , Direct link to comment

    Hi,
    Thanks for your interest in my simple project. However, I did this years ago and don’t have a photo of the circuit. I will post one if I can find one. And I will get back with more answers for your questions after refreshing my memory about this. Moreover, you can read about my complete research from the below link.

    https://gnomezgrave.wordpress.com/2015/01/26/towards-an-automated-deception-detection-based-on-neurofeedback-and-computational-techniques/

  • Gluce , Direct link to comment

    Thank you for your reply.
    I am looking forward to hear more from you if anything more comes to your mind.

    Cheers

    • Alexandre , Direct link to comment

      Hi!
      I’m also interesting in knowing how you make the conversion to microsiemens.

      Cheers,
      Alex

  • Jillian , Direct link to comment

    Hi I was doing this project, but when I start the serial port monitor, nothing comes up. I know it’s connected to the COM port because it could sense the code being uploaded, so what am I doing wrong? Is there something wrong with my wiring? Thank you in advance.

    • Praneeth Nilanga Peiris , Direct link to comment

      It may be because you’re listening to a wrong port? Please note that you should use the correct COM port name in the code. And please give me your setup and then I can comment.

      • Jillian , Direct link to comment

        Nevermind, I realized that I made the embarrassing error of not clicking “Open” when I ran my session. Thank you, though!

  • Sol , Direct link to comment

    I just built a quick version of your circuit on a breadboard and using the built in serial plotter option of the arduino ide for graphing. It’s a lot of fun. Thank you.

  • Alashri Deshmukh , Direct link to comment

    How we can measure a person is stressed or normal based on reading of GSR..

    • Praneeth Peiris , Direct link to comment

      Well, there is no direct way of knowing that just using GSR. You may have to process the signals using a different algorithm to determine that.

    • Praneeth Peiris , Direct link to comment

      If I remember correctly, it’s to remove noise and smoothen the signal.

  • Mr Jonathan Bray , Direct link to comment

    Just to say a big thank-you – I’m wanting a low-profile GSR circuit for a health app (turns out a lot of people with diabetes sweat when they’re going hypoglycaemic (and are thus not thinking straight) – I’d tried a circuit before which didn’t ground anything (I _thought_ it looked odd) and couldn’t tell between dry and wet fingers. Yours works perfectly (and also works fine on 3.3V)

Leave a Reply