0
\$\begingroup\$

So I have this soil humidity sensor placed in a pot. It's about half way in soil, cause that's how deep the pot is.

enter image description here

I'm trying to get a pump to trigger once the soil dries out below 20%, but something strange is happening. I can see the soil physically drying out, but the sensor value is constantly rising.

enter image description here

Any ideas what could be causing this?

\$\endgroup\$
1
  • \$\begingroup\$ Bad sensor. Soil moisture not doing what you think it is. Incorrect application of sensor. Incorrect measurement of sensor output. Impossible to say more without a datasheet for the sensor, picture of how it's applied. \$\endgroup\$
    – John D
    Nov 14 '20 at 20:12
0
\$\begingroup\$

So yeah, if you're getting a high dry and low wet reading (29 - 71 %)...

I think you multiply the voltage reading by 2.38 (which is 100%/(71%-29%)) and subtract whatever constant gives you 29% before it goes to the graphing routine, then flipping the axis so 0 % - 100% is bottom to top.

The voltage from the sensor comes into the app as just a number, and it's not really important what the voltage is, just how to use that number. If it reports 800 dry and 500 wet, take any reading in between (z) and the percentage of the range from those two end points will be (z-500)/(800-500)*100%

\$\endgroup\$
1
\$\begingroup\$

The datasheet says when the probe gets drier, the analog output voltage goes up, and conversely goes lower when wet. Is your graph scale upside down, or you need to divide into 1 somewhere? I think maybe your logic says graph go higher when voltage goes up, but for a Y scale that is wetter at top drier at bottom, this logic is inverted.

What measures do you get when you dry it off and hold it in air, versus putting it in a glass of tap water?

\$\endgroup\$
4
  • \$\begingroup\$ Pulled it out, dried it and it reported 71%. It's now submerged in a glass of water and it says 29%? So it's inverted then? \$\endgroup\$
    – R0b0tn1k
    Nov 14 '20 at 22:14
  • 1
    \$\begingroup\$ Well, not if you rename it a Soil Dryness Sensor. Yep, flip on X-axis OR adjust range so that the voltage now at 71% is really zero, and voltage now at 29% will show as 100% \$\endgroup\$ Nov 14 '20 at 22:40
  • 1
    \$\begingroup\$ I think you multiply the voltage reading by 2.38 (which is 100%/(71%-29%)) and subtract whatever constant gives you 29% before it goes to the graphing routine, then flipping the axis so 0 % - 100% is bottom to top. Not sure if I'm saying this right, but you'll figure it out! \$\endgroup\$ Nov 14 '20 at 22:52
  • \$\begingroup\$ Well weasel, if you're willing to put your answer in the answer field instead of a comment, I'm willing to give you the points. Thank you sir! \$\endgroup\$
    – R0b0tn1k
    Nov 14 '20 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.