I'm working on a prototype for a automated irrigation system, which includes a capacitive moisture sensor v 2.0 (as many already tried).
I know that many sensor had production issues, i ensured that mine works ok.
Issues that i have resolved:
1- since i used a tm-1637 display to show percent values, i had to filter the power line with a 100uf. The display is too noisy. This capacitor filtered the line, which improved.
2- when the moisture is under a X percent selected by user (potentiometer), a water pump is activated via relay. But the relay use too much current and because of that, modifies the readings from the sensor in a bad way, so i fixed it using a Mosfet instead of a relay. Worked.
3- i added a average of 60 for the sensor readings when it's "listen", and 30 (more "faster") when is filling water to make the water pump to stop more quickly. Worked ok.
And other fine calibrations, like using a "compensation" constant that i add to the sensor readings, when leds are on....
The only thing, that i can't understand is this: if the testing pot with the soil and sensor is on the workbench or elevated from the ground in a table, the readings are stable. But if i put the pot on the ground, start receiving readings with fluctuations in a periodic-lineal way.... Very noticiable: on top, no oscilations. On the floor, mooving up and down.
I beleive this is a electrical /electro-magnetic situation.... I would like to fix it too.
There is anything that i can do?
Any ideas?
The 555 chip and the voltage regulator are ok. I also inserted a 1 Mega resistor between ground and AUOT to improve performance. I used serial plotter to check the transitions from 100 % wet to air, and the response was very good. I mention this FYI.
Sadly this is only to be expected. It is the fundamental property of capactive sensing. What happens is that the capacitance to ground is swamping the capactive effect caused by the moisture in the soil.
It looks like this sensor uses a free running oscillator and the moisture in the soil is being measured by measuring the frequency this oscillator runs at. With such a high capacitance to ground then it is actually stopping the oscillator from working. This is only to be expected on a free running oscillator.
The solution would appear to be not to push the probe down so far in the pots, or use higher pots so the end of the probe is not so close to the ground. Or indeed, as you have found, to raise the pots off the ground.
What re the lead lengths between the sensors and the controller?
What model Arduino controller are you using?
This appears to be the schematic of the V1.2 sensor.
Im using arduino pro mini 5v 16 Mhz.
The lenght of the cable from the sensor to the pro mini is about 1.5 meters long (stereo cable)
Regarding to the 1M resistor (factory missing) i fixed,
I did new testings at home, and this sensor is quite sensitive to electric fields / ground. For instance, a pot filled with water, when its 50 cm up from the floor it reads a solid 95 %, but when i put it down, the readings are crazy, which is a problem because i need solid readings to react to concrete events on soil (watering).
Aa grumpy_mike said, perhaps it seems the nature of the sensor to work on this way.
Hi,
The sensor uses C2 as the sense capacitance, that is a very small capacitance, just inter track capacitance or close metal objects can influence it, even your hand.
Any signals/currents in the earth would also upset any readings almost making the sensor act like an aerial to EM noise.