Hi, I use a capacitive moisture sensor to read the moisture levels of a plant. I want to use it to automatically water the plant when needed. The "dry" value seems to be around 400, while the "wet" value is anywhere below 350, but typically around 320.
However, as can be seen in the attachment, at one point the value makes a discrete, very sudden jump from around 375 to 500. At this point the Arduino was reset. The second jump from 475 to 375 was after another reset.
So it seems that the ADC of the Arduino (I use a pro mini 5v 16Mhz) seems to have a random offset.
Any idea how to prevent such a jump from occurring, or perhaps an explanation why this is happening?
Hi, I use a capacitive moisture sensor to read the moisture levels of a plant. I want to use it to automatically water the plant when needed. The "dry" value seems to be around 400, while the "wet" value is anywhere below 350, but typically around 320.
To recapture that: the difference between dry and wet is about 40mV.
However, as can be seen in the attachment, at one point the value makes a discrete, very sudden jump from around 375 to 500. At this point the Arduino was reset. The second jump from 475 to 375 was after another reset.
So it seems that the ADC of the Arduino (I use a pro mini 5v 16Mhz) seems to have a random offset.
Using standard sketches (you didn't post your code) such offsets are explained easily: A change in the supply voltage which affects also the ADC reading.
As you didn't post a link to the sensor used, nor a wiring diagram of your setup, my conclusion is even much easier: it's either a hardware or a software problem as we haven't seen any of it.
If you browse through this and other forums, you will find that your experience is typical. Most people who experiment with cheap soil moisture sensors give up after a while.
If I read correctly, you are experiencing a spike after a reset, sort of like an instability on the first few readings. You can pick a count, and ignore the readings whiles the number of readings is under a preset count. You can, also, delay the time from restart to when the first readings are taken. You can also take the readings and average them which would allow the readings to ramp up and to be a bit smoother on the transitions.
Though, jremington, is correct about most people giving up on the cheap sensors, after a while.
Thanks for posting the plot. I wouldn't say it's worthless. The small spikes can easily be filtered with a low-pass filter, or even a running average. From 2019-03-21 to 2019-04-05 there is a clear pattern: 1) plant gets water, the value drops steeply; 2) the value has a plateau (wet phase); 3) the value starts to increase, corresponding to drying out over a period of two weeks. But the jump to 500 is what worries me. There is no way you can easily set a threshold that indicates a dry plant if there are so large jumps.
The rest of the graph is consistent again. At 2019-04-11 I gave the plant way too much water, which is why the value drops very fast (I had a rounding error in my watering time :), I use a pump to give water when needed).
You get a good drying out curve. You can figure out the rate of drying out of the soil, confirm it with readings, and ignore readings over 400, staying with the predicated drying curve instead as a solution till the issue is found out.
You could also use another sensor to confirm the readings of the first sensor. Using the sensor that gives the readings nearest to the predicated curve.
You could add a 2nd sensor, like a humidity sensor, near the plant and use humidity as a secondary confirmation sensor.