Capacitive soil moisture sensor v1.2

Hello team,

I am having issues trying to calibrate this moist sensor:

I have tried this tutorial

https://wiki.dfrobot.com/Capacitive_Soil_Moisture_Sensor_SKU_SEN0193

Which suggests me to calibrate it with this code

void setup() {
  Serial.begin(9600); // open serial port, set the baud rate as 9600 bps
}
void loop() {
  int val;
  val = analogRead(0); //connect sensor to Analog 0
  Serial.println(val); //print the value to serial port
  delay(100);
}

The only information I get from the serial monitor, after setting it to 9600, is 1023.

It does not display any different information when I dip it in water.

The connections are exactly the same as mentioned in the tutorial.

Other topics in the forum could not help me, for example:

What am I doing wrong? Could you please assist? Thank you.

Water may be too clean.

Need electrolyte (salt).

Never read about it, added two spoons of salt but it did not work out.

The code makes sense for me, the sensor is brand new, checked the connections several times.

Also tried to connect it to 3.3v as it was indicated in its Operating Voltage: 3.3 ~ 5.5 VDC.

It still displays 1023 on the serial monitor while out of water, and in water, with and without salt.

What could it possibly be wrong?

since A0 is an analog input and the unit should not read more than 600 in air,
there is something odd.
check wiring,
lift the
AOUT off the sensor and leave A0 connected on your Arduino
there is always the possibility of a bad sensor, funny, but does it pass the smell test ?

Hi,
Do you have a DMM to measure the output voltage of the sensor?

Tom.. :slight_smile:

Hey there,

although I do not have exactly the same setup as in the tutorial you mentioned, I did stumble across that one as well while trying to get my sensor to work.

I use a NodeMCU, the capacitive soil moisture sensor v1.2 and uPyCraft IDE (MicroPython).

At first, uPyCraft set the baud rate to 9600 by default (and as suggested in the tutorial). Unfortunately, the serial output was an underwhelming "3". When I swapped to a baud rate of 115200, I got values ranging from 833 (dry in air) to 520 (wet in water). Bytesize = 8, stopbits = 1 and parity = NONE are other values displayed by the IDE.

Maybe this information can help you.

Cheers.

Hi,

The Arduino analog input voltage is max. 1V and the output voltage of the capacitive sensor is about 3V (if you use it from 3.3V power supply).
So you have to use a voltage divider at the output of the sensor.

I have the exact same issue.

zweistein002:
Hi,

The Arduino analog input voltage is max. 1V and the output voltage of the capacitive sensor is about 3V (if you use it from 3.3V power supply).
So you have to use a voltage divider at the output of the sensor.

This might be true, but even tested with a multimeter the output only changes when using a arduinoUNO
NodeMCU and Wemos D1 Mini seem to work sporadically. The weird result is a value of 0 - 7 on A0. To fix this, I temporarily ground the VIN pin of the sensor which causes it to function normally for a few seconds until it reverts to a faulty state.

The only way I can get this sensor working reliably is with an arduino UNO with VIN connected to 5v. Otherwise the Aout pin outputs absolutely no voltage.

Hi,

I received a couple of capacitive sensor (same as topic starter) last week, and no matter what I do I do not get a valid result. I am hoping some of you guys have a tip.

I Followed the same tutorial (Capacitive_Soil_Moisture_Sensor_SKU_SEN0193-DFRobot) but the output of the analog output remains 0.

Maybe it was the connector so I soldered new cables to the board, but that did not help. When I touch the resistors with my finger the value jump up, but then slowly goes to zero again.

Maybe the board is faulty, but I ordered 5 of them, will all 5 be broken?

Has somebody a tip for me which I can try, or that I can check that the board(s) are not broken.

thijsb:
Has somebody a tip for me which I can try, or that I can check that the board(s) are not broken.

Perhaps stump up the money and (if you are in the USA.) get a better product?

Are you measuring from the right pin? Try using A0 as the pin address

void setup() {
  Serial.begin(9600); // open serial port, set the baud rate as 9600 bps
}
void loop() {
  int val;
  val = analogRead(A0); //connect sensor to Analog 0
  Serial.println(val); //print the value to serial port
  delay(100);
}

@Paul__B Thanks, I think I will buy those sensors then, Now I just have to find a webshop which has those sensors (Adafruit STEMMA Soil Sensor - I2C Capacitive Moisture Sensor : ID 4026 : $7.50 : Adafruit Industries, Unique & fun DIY electronics and kits) on stock.

@TimMJN Yes, I double checked, with multiple Arduino's and used different analog ports

thijsb:
@TimMJN Yes, I double checked, with multiple Arduino's and used different analog ports

Have you tried replacing your sensor with a potentiometer? Are you able to get a decent reading out of that?

thijsb:
Hi,

I received a couple of capacitive sensor (same as topic starter) last week, and no matter what I do I do not get a valid result. I am hoping some of you guys have a tip.

I Followed the same tutorial (Capacitive_Soil_Moisture_Sensor_SKU_SEN0193-DFRobot) but the output of the analog output remains 0.

Maybe it was the connector so I soldered new cables to the board, but that did not help. When I touch the resistors with my finger the value jump up, but then slowly goes to zero again.

Maybe the board is faulty, but I ordered 5 of them, will all 5 be broken?

Has somebody a tip for me which I can try, or that I can check that the board(s) are not broken.

What Arduino board are you using?
What voltage are you applying to the sensor?
Thanks... Tom..... :slight_smile:

Paul__B:
Water may be too clean.

Need electrolyte (salt).

Not for a capacitive probe.

Hello,
i´ve the same issue. I connected the sensor to a uno and a nodemcu. On both units i receive a value of around 330. But it does not raise or unraise when soil becomes wet or dry.
It toogles around 330 to 350, but not more.
I also changed power from 3.3 to 5v but nothing changed. I tried two sensors, both the same result.
Did anyone make them work?

Regards
Olli

Hi,

TimMJN:
Have you tried replacing your sensor with a potentiometer? Are you able to get a decent reading out of that?

Yes I tried that and that worked.

TomGeorge:
What Arduino board are you using?
What voltage are you applying to the sensor?
Thanks... Tom..... :slight_smile:

I tried multiple Arduino uno boards, and tried both 5v and 3.3v.

Paul__B:
Perhaps stump up the money and (if you are in the USA.) get a better product?

Not many webshops have those sensors in stock. It did take some time but finally my order came in today. I received a couple of adafruit 4026 like you mentioned, and they work out of the box, Thanks!

But.. I found a youtube video with the title "How to fix faulty Capacitive soil moisture humidity sensor v1.2" (How to fix faulty Capacitive soil moisture humidity sensor v1.2 - YouTube) so maybe i am able to fix it.

I was having a similar problem where i thought it was not responding and why i found this thread. A bit more fiddling and i discovered that the output when in water (low) takes a couple of minutes to get to the minimum value. Once pull out into air the response is in seconds going back to the max value.

I also note you can check the output from the sensor with a DMM it ranges around 1.8 v in water to 3 volts in air.

Hi, the analog value from Capacitive Soil Moisture Sensor can be converted to a percentage. Here is a very nice article, how this person has done the percentage calculated using the map function: https://how2electronics.com/interface-capacitive-soil-moisture-sensor-arduino/

Hi Everyone. First post to this forum, so please excuse any etiquette errors.

I have had the same issues as described throughout this thread. The following may help with everyone's sanity.

also a more comprehensive summary on his web page (note is page certs are not up to date so you may get warnings).

https://so-now.com/electronics/capsense.php