EC Meter issue with ESP and or ADS1115

Hi everybody.

I've been successfully reading EC with this code and my arduino UNO & Mega:

But the thing is, when i try with my ESP32 on an ADC port, i get incoherent voltages. Same thing with an arduino + ADS1115.

For example :

Arduino+EC sensor+ 1.55mS calibration solution : Value read : 403 (so 1.96v)

Arduino+EC sensor+ 2.8mS calibration solution : Value read : 277 (so 1.35v)

Arduino without sensor plugged : Value read : 1023 (so 5v)

Arduino+ADS1115@15bits+EC sensor+ 1.55mS calibration solution : Value read : 24560 (so 4.6v)

Arduino+ADS1115@15bits+EC sensor+ 2.8mS calibration solution : Value read : 25520 (so 4.79v)

Arduino+ADS1115@15bits without sensor plugged : Value read : 27000 (so 5v under 15bits)

I'm always using a 1kohms resistor for those tests (between +5v and analog signal).

I don't have the numbers now for the ESP32+sensor@3.3v but it's the same than with the ADS (voltages read higher than on arduino).

Do someone have an idea about what is happening here?

I'm reaching the limit of my basic knowledge here :frowning:

it turns out we can take a very fast DC reading without suffering polarisation. meaning we can make a really cheap EC sensor.

I'm not going to argue with this statement, but let's see what "a very fast" means, and why polarisation effect could be minimize. Obviously, to reduce impact of DC voltage on the ion equilibrium, the measurement timing should be small compare to measurement period. This is the same like PWM with low duty cycles. Look into code from original article:

GetEC();          //Calls Code to Go into GetEC() Loop [Below Main Loop] dont call this more that 1/5 hhz [once every five seconds] or you will polarise the water
PrintReadings();  // Cals Print routine [below main loop]

What they do, is take a measurement, and put a system on hold-on for 5 seconds. Plus 1 or 2 seconds for PrintReadings(). Now we know a period, let's say 6 seconds. Now look into measurement timing:

void GetEC(){
//*********Reading Temperature Of Solution *******************//
sensors.requestTemperatures();// Send the command to get temperatures
Temperature=sensors.getTempCByIndex(0); //Stores Value in Variable
//************Estimates Resistance of Liquid ****************//
raw= analogRead(ECPin);
raw= analogRead(ECPin);// This is not a mistake, First reading will be low beause if charged a capacitor
//***************** Converts to EC **************************//
Vdrop= (Vin*raw)/1024.0;
Rc=Rc-Ra; //acounting for Digital Pin Resitance
EC = 1000/(Rc*K);
//*************Compensating For Temperaure********************//
EC25  =  EC/ (1+ TemperatureCoef*(Temperature-25.0));

Measurement is between two digitalWrite: HIGH - apply voltage and LOW - to remove. analogRead - 120usec x by 2, 240 usec overall, +- 4 usec for digitalWrite.
So , duty cycles is very low: 244 usec/ 6 sec = 0.000040667.
If you are using ads1115 it takes 100 milliseconds per analogRead ( !!! 1000 times more ), and my guess is too much. I have no clue how long ESP spends for same analogRead, but you could verify it in the data sheet.

It shoudn’t take 100 ms for an analogRead() on the ADS1115 as it can do 960 SPS. That’s just over 1 ms.

No matter, the ADS1115 is too slow for this technique.

To measure the EC you need short pulse - where short (“very fast”) means pulses of <1 ms, preferably <0.3 ms. Also for proper measurements you have to give a pulse of the same length in the opposite direction, or your measurements will still go off as ions are still pushed in just one direction. The lower limit of these pulses is at about 1 us, by the way.

Based on a different technique I’ve developed a well working EC sensor, that doesn’t need any slow analog reads, and works over about 3 orders of magnitude. I’ve planned a kickstarter campaign which I hope to launch this September. OTOH it’s maybe cheap enough to bootstrap. I’m also working on a 555 timer based measurement technique that can do 0.01-100 mS/cm. Prototypes are very promising.

What is your EC sensor, can you post a picture of it please?
What materials is it made of?

If you replace the EC with a potential divider arrangement, are your readings unstable?
Trying to establish where the instability is.
Have you got a bypass capacitor, like a 0.1uF capacitor across the EC leads at the EC probes?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile: