Hello,
This is my first post in this community, so please forgive me in case I do something wrong here. ![]()
As introduction: I consider myself quite a beginner in the electronic field although I already worked on some small DYI projects at home using Arduino. Nevertheless, I have programming backgrounds and therefore the programming part is easier for me to manage.
Coming back to the topic of this post. I started a DYI project for an automatic irrigation system, but I am currently experiencing some issues with the soil moisture sensor. I try to put as much details as possible below.
The soil moisture sensor I'm currently using is the capacitive moisture sensor v1.2 (that I purchased as part of this package: https://www.amazon.it/gp/product/B0814HXWVV/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1 ). The sensor is connected to a NodeMCU v2 (Amica) in the following way:
Sensor VCC --> 3.3V in NodeMCU
Sensor GND --> GND in NodeMCU
Sensor analog output --> A0 in NodeMCU
The NodeMCU is currently powered through a MB102-like board, where I connected its +5V and GND respectively to the VIN and GND pin of the NodeMCU. The MB-102 board is powered through an USB cable directly connected to the wall wart, and before starting the test I correctly verified the voltage on the VIN pin (it is approx. 5 volts indeed). Nothing else is connected to the NodeMCU or to the MB102.
The program uploaded on the NodeMCU is a standard Blynk client with no additional features, and I added a widget on the related application in my smartphone to monitor the values coming from pin A0 (that is connected to the sensor). The widget checks the value of the sensor every 1 second when the application is running.
I then started the NodeMCU and everything worked correctly. I also calibrated the sensor by putting it in the air and in the water, measuring respectively values of 860 and 450. So far so good, but here comes the problem. ![]()
I inserted the moisture sensor in the soil of one of the plants I have (it is a cyclamen) just after I watered it, and I kept it monitored for a few days. I was expecting the values from the sensor to increase (i.e. going from wet to dry), but I noticed that the values did not increase too much (maybe 20-30 points). Sometimes they even decrease below the value that I recorded when I put the sensor in the soil for the first time (when the soil was just watered). I did not water the plant anymore during this test.
I then decided to run another test. I waited the soil to become dry (I verified it with manually by hand), then I placed the sensor in different places in the soil 10 times to check which value I was getting. I got different values each time I put the sensor in a different place. Below I report the different values I got from the sensor in these 10 tests:
590 - 605 - 590 - 604 - 607 - 595 - 607 - 608 - 618 - 595
During each test I made sure the sensor was inserted in the soil at the same level (more or less where the "v" of "v1.2" is printed on the sensor), and I also waited a few seconds before recording these values to let the sensor assess itself.
I then removed the sensor from the soil, watered the plant, and repeated the test above 10 times again with the same depth. These are the values that I got after this test:
528 - 555 - 477 - 569 - 570 - 537 - 545 - 542 - 600 - 555
First consideration: I expected the values between the two tests to fall in ranges quite far from each other. Instead, I observed that the values recorded in these two tests are falling in ranges very close to each other. In one case the value recorded when the plant was just watered was even higher than the value obtained when the soil was dry, resulting in having overlapping ranges.
After these tests I placed the sensor in the soil, at the same depth used in the previous tests. The initial recorded value was 535.
After one day I checked the values in the app: sometimes I got steady values around 545, and sometimes (after a couple of hours) I got steady values around 520-525, so even lower than the value I collected when the plant was just watered (535). Even if the plant is placed outside, there were no conditions that may have affected the soil moisture during the testing time (the weather was sunny-cloudy, no rain or water).
As conclusion of these tests, I don't think that this sensor is reliable enough to determine whether the soil needs to be watered or not. For this reason I cannot even use the values retrieved from the sensor to drive a water pump in a future project.
I also tried the following alternative approaches to check if there was an issue on other parts except for the sensor:
- Power the NodeMCU through its micro USB
- Power the sensor at 5 volts (from the MB-102 or from the VIN)
- Upload a simple program to read analog values through analogRead() function every 1 second
In all cases above I was getting the same values from the sensor, so I don't think the problem can be related to the Blynk app or to the power supply.
I also discovered that some capacitive sensors are faulty because there is a missing resistor in the sensor schematic (see this video: How to fix faulty Capacitive soil moisture humidity sensor v1.2 - YouTube ), but it should not be the case for my sensor since every time I put the sensor in the air or in the water the related value was updated immediately without any problems.
Do you know if I am doing something wrong, or if there is something wrong with my setup? If not, do you know if there is any soil moisture sensor that is really reliable? Or alternatively, what I should do to have a reliable soil moisture value?
According to what I read around the web and in this forum it seems that there are no reliable soil moisture sensors that can be used with the Arduino...
Thanks a lot in advance for your help!
Stefano