Converting gsr raw data to skin conductance


Hey, Im trying to convert gsr raw data to skin conductance but never found a satisfying answer
i have attached a image of my readings from serial monitor
would love some help
thank you

Welcome to the forum

Have you got a formula that would allow conversion between the values printed and the values that you want ?

How are you reading the values ?
What type of sensor are you using ?

Please post your full sketch, using code tags when you do



this is my setup and code
GSR sensor im using is v2.0
Im reading the values under serial monitor
and i dont have a formula for conversion

what i have understood till now is that the raw data that i have provided is the voltage i.e change in electrical conductivity of skin

I see that you ignored the advice to post your code using code tags. By doing that you have made it hard to read and impossible to copy for investigation. Do not post pictures of code or error messages

Then it is going to be difficult to provide help on converting the data

const int GSR=A0;
int sensorValue=0;
int gsr_average=0;

void setup(){
  Serial.begin(9600);
}

void loop(){
  long sum=0;
  for(int i=0;i<10;i++)           //Average the 10 measurements to remove the glitch
      {
      sensorValue=analogRead(GSR);
      sum += sensorValue;
      delay(450);
      }
   gsr_average = sum/10;
   Serial.println(gsr_average);
}

Resistance = ((1024+2*serial_port_reading)10000)/(serial_calibration-serial_port_reading)
i found this formula but when i used it i got resistance in negative
my serial_calibration value is 5
for example serial_port_reading = 11
((1024+2
11)*10000)/(5-11) = -1743333

Do you have a link to the specs for the sensor?

OK... 5-11 is negative. Either the formula is wrong, the sensor isn't working, or the resistance is out of its readable range and that's causing an error.

It might be worth trying a known resistor. Skin normally has high resistance, depending on several factors but I'd try a 1M -10M resistor.

And if you've got a multimeter, use it to check/conform your skin resistance. Make sure you're using the same setup with the same skin-contacts at the same location, etc.

(1) The units-of measure are not "volts" but the reading is proportional to voltage. With the default reference the Uno's 10-bit ADC reads 1023 at 5V so you can divide by 204.6 to get voltage.

i dont have the specs actually

Voltage (V) = Raw Value * (V_ref / 1023.0)

  • Raw Value: The digital value read from the Arduino's Analog to Digital Converter (ADC), ranging from 0 to 1023.
  • V_ref: The reference voltage used by the ADC (typically 5V or 3.3V, depending on your setup).
  • 1023.0: The maximum value that the ADC can read.

2. Resistance Calculation:

Resistance (Ω) = (V_ref / Voltage - 1.0) * R_pullup

  • V_ref: The reference voltage (same as above).
  • Voltage: The voltage calculated in the previous step.
  • R_pullup: The resistance of the pull-up resistor in your circuit (in ohms). This is a crucial component in the GSR circuit.

3. Conductance Calculation:

Conductance (S) = 1.0 / Resistance (Ω)

  • Resistance: The resistance calculated in the previous step.
  • The result is in Siemens (S). To convert to microSiemens (µS), multiply by 1,000,000:

Conductance (µS) = Conductance (S) * 1000000.0

4. Conductance Change Calculation:

Conductance Change (%) = (Current Conductance - Baseline Conductance) / Baseline Conductance * 100.0

  • Current Conductance: The conductance (in µS) calculated in the current iteration of the loop.
  • Baseline Conductance: The baseline conductance (in µS), which is typically established at the beginning of the measurement or during a period of rest. This is a reference point to calculate the percentage change.

using this i got skin conductane as 1.19
Explanation raw value = 12
voltage = 0.06
resistance = 842500.00
conductance = 1.19
does this seem right?

~ 800K Ohms seems reasonable. It depends on how close the contacts are (there's more resistance from one hand to the other than between fingers). The size of the contacts (bigger contact area makes lower resistance), and moisture (more moisture makes lower resistance).

Without a multimeter measurement it's hard to know if it's accurate.

But your voltage is rather low (0.6V on a 5V range) which may affect accuracy/resolution. Assuming you have a Voltage Divider, a lower value "pull-up" (the "top" resistor in a voltage divider) will give a higher voltage. But, there appears to be a chip on the sensor board, so it may not simply be a voltage divider....

const int gsrPin = A0;
const float V_ref = 5.0;
const int R_pullup = 10000;

void setup() {
  Serial.begin(9600);
}

void loop() {
  int rawValue = analogRead(gsrPin);

  float voltage = rawValue * (V_ref / 1023.0);
  float resistance = (V_ref / voltage - 1.0) * R_pullup;
  float conductance = 1.0 / resistance;
  float microSiemens = conductance * 1000000.0;

  Serial.print("Raw Value: ");
  Serial.println(rawValue);
  Serial.print("Voltage (V): ");
  Serial.println(voltage);
  Serial.print("Resistance (Ω): ");
  Serial.println(resistance);
  Serial.print("Conductance (µS): ");
  Serial.println(microSiemens);

  delay(5000); // Adjust delay as needed

this is the code i've used

www.sichiray.com is printed on the sensor module but i couldnt find any datasheet in this website

many threads have this issue regarding conversion of raw data to conductance but no thread has got a proper conclusion

Because it is all fake. There is no single-value "calibration" for comparing sweat.

Your amount of sweat and my amount of sweat, under the same condition, will be different. How you interpret that data is up to you. There is no "formula" like you show in Post #8. That mumbojumbo only played with the decimal place, with the "calibration value" only changing the rate of moving the decimal place.

Develop your own "formula" by gathering data external to, but effecting, measuring sweat.

  • current temperature of ambient air
  • current humidity of ambient air
  • current wind velocity (wind = evaporation = cooling)
  • subject body temperature
  • body at rest for vitals to stabilize
  • site of measurement (location on body)
  • health of body (sickness can cause internal temperature change)
  • ethnicity (pore size [cooling ability] varies).
  • [edit] adhering to a strict, pre-test diet because sodium in sweat increases conductor

Now, do that with hundreds (thousands!) of people and interpret a graph of the data.

1 Like

One you have the schematic of your module, it will be simple to determine the formula.

It's an amp that provides a value to A0

How about info supplied with such sensors ?Here

If you connect a series of resistors across the sensor and graph the output , you can then work out an equation linking conductance against A/D output .
Conductance =1/resistance.