Problem with converting moisture sensor data to capacitance farad unit

Question : 1 I use esp32 and capacitive moisture sensor V1.2 and it give suppose 1355 from the sensor in blynk app and then i took the sample and found water content manually which is 12.39% . What is the unit of the value 1355 and how to convert this value into capacitance farad unit . Please suggest me solution of this problem . I put a code here . It is given below .

Question :2 I have an issue that the sensor gave me values between 0-4095
images - 2023-10-14T122020.989
but in the case of using aurdino it gives 0-500 values . Is these value analog data / sensor data . If it is then how to convert them into Capacitance Value ( unit in farad ). Please suggest me that .

 BLYNK_TEMPLATE_NAME"water content" 
#define BLYNK_AUTH_TOKEN "xml8b1r_6b3IwTiXLiUN7l3G45p5UDaV" 
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h> 
char auth[] = BLYNK_AUTH_TOKEN;
 // Your WiFi credentials. // Set password to "" for open networks. 
char ssid[] = "virus"; char pass[] = “ABCD##rose1234"; 
BlynkTimer timer; 
#define AOUT_PIN 34 // ESP32 pin GPIO34 (ADC0) that connects to AOUT pin of moisture sensor 
void setup() { Serial.begin(115200); Blynk.begin(auth, ssid, pass); 
 void loop() {;; int value = analogRead(AOUT_PIN); 
// read the analog value from sensor Serial.
print("Moisture value: "); Serial.println(value); Blynk.virtualWrite(V0,value ); delay(1000);

Although these sensors detect moisture using a capacitive method, they don’t give you a value in farads. They simply give a higher output voltage on the data pin, depending on the moisture content of the soil.

The Arduino has a 10-bit Analog to Digital Converter (ADC) and the maximum value you can hold in 10 bits is 1023. This means that the Arduino will measure the input voltage on its Analog pins and return a result of between 0 and 1023.
The Arduino most likely provides this over a range of 0-5v, but You’d need to check that.
If it does then an analog input of 2.5 volts would return a digital value of 512 (half the maximum of 1023, because the input is half of 5v)

The ESP32 uses a 12-bit ADC, which gives output values of 0-4095, so is more precise because it it uses more steps to represent the input voltage.
The ESP32 also provides it’s maximum ADC output (4095) when 3.3 v is applies to the analog input, because the board operates on 3.3v.

So, an ESP32 ADC output of 1355 means that it’s receiving an input voltage on the analog pin 1.09v (3.3/4095 x 1355).

How did you arrive at that figure?

If you can accurately correlate the moisture level to output voltage of tehs sensor (and therefore the ADC output value) then you can probably use the map function in C++ to convert your results into moisture percentage - assuming that the capacitive sensor gives a linear output.


1 Like

For convert I do simple test

  • put sond out of soil and dry it. Read value and this is my 0 %humidity
  • put sond in glas of water. Read value and this is my 100% humidity.
    Then use simple “map” command for arduino