Soil Moisture Sensor/Monitor


Soil Moisture Sensor/Monitor instruction sheet
Node-RED flow
Node-RED flow version 2

I've just finished writing-up an instruction sheet for my IoT students on sensing soil moisture in a plant pot.

I've purchased 6-off of the inexpensive resistive moisture sensors. I've been told they are liable to corrosion so the program I have running in the Wemos D1 Mini uses "rules" and an NPN transistor to switch the 3V3 supply to the sensor on for 8 seconds every 15 minutes (which will hopefully reduce the corrosion effect).

Hope you enjoy reading this article as much as I enjoyed writing it.

Cheers from David

I've just updated the flow to version 2.
This version will check and report if the Wemos D1 Mini is off-line or disconnected from a power source.
It will also send a simple message to a Telegram bot saying the plant needs watering.
There is a "test inject point" to check the "needs watering" condition/path. You can obviously remove this.



Nice project thanks for sharing, Im trying to learn node red with a similar project.

sorry to tell you the sensors wont last 3 months if you sample more than 1 x per hour, mine didnt anyway :wink: I then shifted to capacitive sensors but the ic2 cable loop was a constant source of signal failure (my lack of skills) and have now moved to ble capacitive sensors which so far have proven pretty good and reliable. and i finally ended up here with node red :wink:

Your flow is way more concise than my own efforts, could you explain the watchdog function to me tho , if in the document tell me the page perhaps i skimmed over it without realising..
Im using a similar trigger, an injection node set to repeat but have no delays or other checks inline before i attempt sensor data retrieval.



Glad you like the project - and thanks for the update about the "life" of the resistive sensors.

My setup is a WeMos D1 Mini (ESP8266) acting as a slave. It remains idle until it receives an "event trigger" from Node-RED. The WeMos drives a transistor that switches power (3V3) onto the moisture sensor for a few seconds. (Let me know if you need a copy of the rules that live inside the WeMos.)

Here's a brief explanation of the watchdog function.

Node-RED sends an "event trigger" to the WeMos D1 Mini once every 15-minutes. It also sets a varaiable called "basil_watchdog" to the value "expired". It also activates a 10-second delay. When the delay terminates the function node comes into play. During the 10-secs the WeMos D1 mini should have responded by sending the values for "status" and "reading". The "status" is used to set "basil_watchdog" to the value "reset". The function node (mentioned above) checks the state of "basil_watchdog". If it is "expired" then that indicates that no reading has been received. If it is "reset" then that indicates a reading HAS been received. The other function node, labelled "Condition" also check "basil_watchdog" and sets up appropriate text messages for the Dashboard.

Hope this helps.

Cheers from David.



Cheers David, Many thanks for taking the time to explain, the penny can sometimes drop quite slowly this end but that all makes perfect sense, before shifting my logging within node red i was employing a different watchdog to ensure my logging process didnt get hung up attempting handshakes with a sensor running on a low battery. so i was checking for a similar construct but couldnt see it , of course because its a value doh!! the gets n sets should have told me that..

its a subject close to my heart, i have a long south facing wall ideal for catching the sun but its paved so i plant my beans and tomatoes in pots and these plants are thirsty when they get going and i soon grow bored with watering twice a day, this year i kept it up till a few weeks back when it rained and the pots didnt get the water they needed so im picking the last of the fruit off dry brittle vines atm, and my beans have gone to seed early. ho humm,,
BUT NEXT YEAR I will be prepared:)

I appreciate your project is more of a teaching tool than a personal project but the cheap sensors can be upgraded with a good dose of hydrochloric acid flux and a fine torch flame focused on stainless steel micro tubing you can solder the ss tube to the legs such that only SS is embedded in the soil. its a lot easier solder job than it should be.. the ss will still corrode but a quick wipe with sandpaper can revive them as good as new for a week or 2, then repeat the sandpaper treatment.
sandpaper works on the fork sensors too but will also shorten the useful lifespan