Products > SoilWatch 10

sometimes 6 percent difference in pure water

(1/1)

elbarto:
Hello,
is it normal, that i have sometimes a difference of 6 percent in pure water?
Using esp32 with 1.1v sensor. (Meassured also 1.1v pin of the esp)
Burried inside earth the difference is up to 10 percent and more. :(
I attached a list of my values.

pinolec:
Hi,

I have just answered your email but for future generations  ;)
Espressif explains how to deal with the noisy ADC here: https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/adc.html

Here is the quote from Espressif:

--- Quote ---The ESP32 ADC can be sensitive to noise leading to large discrepancies in ADC readings. To minimize noise, users may connect a 0.1uF capacitor to the ADC input pad in use. Multisampling may also be used to further mitigate the effects of noise.
--- End quote ---

regards,
Piotr

elbarto:
Still the same problem with capacitor between analog input and sensor cable. Trying esp8266 board now.
...
With the esp8266 the values are stable now. But i see that the A0 pin has only 3.3V and the sensor 1.1v...i hope that this does not damage the sensor.
 

pinolec:
To get decent repeatability out of ESP32 ADC use code below as the starting point. The capacitor is also a must.


--- Code: ---/*  Analog read for ESP32
    To minimize the noise connect 100nF capacitor between ADC pin and GND as per https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/adc.html#minimizing-noise
    Code below multisample ADC on sensPin and average the results.
    The result is printed on Serial port
*/

const int sensPin = 34;
int sensValue = 0;


void setup() {
  Serial.begin(115200);
  delay(1000);
  analogReadResolution(10); //set ADC resolution to 10bits
}

void loop() {
  // Reading sensor value
  sensValue = AvgAnalogRead(sensPin, 1024); //Average 1024 reads to make good readings
  Serial.print((sensValue*3.3)/1024);//convert to Volts
  Serial.print("V ADC:");
  Serial.println(sensValue);
  delay(500);
}

int AvgAnalogRead(int adcToRead, int samples){

  long x=0;
  int i = samples;

  while(i){
    x+= analogRead(adcToRead);
    i--;
  }
  return (x/samples);
}

--- End code ---

Navigation

[0] Message Index

Go to full version