Interfacing GSR sensor to ESP32

Hello! I'm working on a project using Grove GSR sensor interfaced to ESP32. Initially, I interfaced and tested the sensor using Arduino Uno and it worked fine. However, when I interfaced the sensor to ESP32, the readings were not similar to those of the Arduino Uno and while adjusting the potentiometer, there were no displayed changes in the serial monitor. I've been working on it for days now but I have no progress at all. I would greatly appreciate any help from anyone who have worked on a similar project before.

Here is the code that I'm using for the ESP32 to read data from the GSR sensor.

//#include <LiquidCrystal_I2C.h>

//LiquidCrystal_I2C lcd(0x27,16,2);


const int GSR= 32; //ESP 32 analog pins 32-39 
int sensorValue;
float Resistance;
float Conductivity;
int gsr_average;
float reference_res=100;
void setup()
{
  Serial.begin(9600);
  //lcd.begin(16,2);        
  //lcd.backlight();      // Make sure backlight is on
}

void loop()
{
  //lcd.clear(); 
  long sum=0;
  for(int i=0;i<10;i++)           //Get the mean of 10 measurements to remove the glitch
    {  
      sensorValue=analogRead(GSR); //output is analog voltage
      sum += sensorValue;
      delay(5);
    }
  gsr_average = sum/10;
  Serial.println(gsr_average);
  Resistance = ((1024+(2*gsr_average))/(512-gsr_average))*reference_res; 
  //formula: Resistance = (2^10+(2sensorValue)/sensorValue)*referenceResistor
  //2^10 = 1024, We measure the signal by voltage and print to COM port as (0~1023).
  Conductivity = 1/(Resistance*0.001);
  Serial.println(Resistance);
  Serial.println(Conductivity,9);
  //lcd.setCursor(0,0);   //Set cursor to character 0 on line 0
  //lcd.print("GSR in uS: ");
  //lcd.setCursor(0,1); //Set cursor to character 0 on line 1
  //lcd.print(Conductivity,9);
  delay(1000);
}

???? Sorry but no potentiometer is visable in Your post, no chematics, no datasheet link to the sensor.....

Thanks for posting formatted code in code tags!

Know that the UNO is a 5 volt logics device. I suspect the ESP32 is a 3.3 volt device. That opens up for mistakes and difficulties.

First of all, thank you for replying to my query.

This was all that I could find for the GSR sensor, sir.
Seeed文档模板 (mouser.com)

Yes sir, the ESP32 is a 3.3 V device and the sensor can also operate in 3.3 V.

Various instructions for connection and operation are here:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.