1

I'm using this ESP32 model (picture) with Expressif's DOIT ESP32 Dev 1 library for esp32. And I was trying to use Gravity TDS sensor with DFRobot Gravity library. I set my Analog pin from A1 (Arduino) to pin 32. Used this settings

gravityTds.setPin(32);
gravityTds.setAref(3.3);
gravityTds.setAdcRange(4096);

Connected plus to 3.3 and minus to ground. But I was getting a inf in source code for Voltage variable because of zero division so I could not callibrate the sensor. I tried to search for it and found that AnalogRead(pin, INPUT) returning 0, or 0.00 if float.

Im not sure why. I tried to get a value by myself from a simple AnalogRead code, but it was same. I have the Analog cable connected to D32 pin. Am I doing something wrong? Is 32 not good pin? I tried same pin with Analog Temp read by Gravity also. I was getting a value normalyenter image description here

3
  • Are you able to find a multimeter/voltmeter to read the voltage and see if it is actually 3.3 ? Maybe the input is left "floating" and the gravity library cant read it ! (Pun intended) Sep 22 at 16:39
  • I connected multimeter to + and - of the sensor and i shows 3.34. When I connect it to Analog input and - it shows 0 Sep 22 at 22:49
  • man got it! Problem was that my water was too clean 😅 I added salt and it worked Sep 22 at 23:53
1

I had to add a salt to water to make it eletric-conductive to be able to measure a value. Long story short: my water was too clean, lol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.