Calculating if garden needs watering ...


Staff member
What is the cheapest/easiest way of figuring out if my garden needs watering? I know my weather script pulls down the "daily rain totals" and other stats from AWS, but I am not sure what/how to use this. Since I finally have my garden sprinkler automated, I would like to prevent wasting of water, since I am on a well. Thanks!
take a look at mcsSprinklers plugin. Definately the most robust logic for doing exactly what it seems you are looking for. Of course that comes at an $80 plugin price (gasp!). You can download the plugin and read the HELP guide that comes with it for a thorough explanation of it's logic. I am sure I will be buying the plugin once I need to as I don't have the time or expertise to code all that Michael has baked into that plugin.
I have been looking at that plugin for a while, and while it does look really great and advanced, I just can't justify spending any money on software for this project since it isn't a high priority.
Point a camera at the garden and grab a bitmap image. Run some appropriate filter to count the number of brown and green pixels. When the brown pixels outnumber the green pixels, you need to water it.
lol smee

what about using a soil moisture sensor?

If S.M. < 35% = water garden

I see some problems by just using the AWS data... no enough accuracy, since it may rain in one part of town and not the other...

A weather station would be ideal as you would then no the exact level of water the garden has recieved along with temperatures... evaporation levels.
The easiest way, IMO, would be to use the daily rainfall measurements and determine if there has been enough rainfall for your garden. I do this in a script for my lawn.

I use a local weather station that gives me the rainfall at my house. The data is supplied to a set of log files for the last 5 days via VWS. Since rainfall varies greatly by geographic location here in Florida, with spotty showers based on where the clouds pop up, I can't rely on what the airport down the street gets - they might have an inch while I get nothing.

I total the rainfall for the last three days, and if it is less than 1.5 inches, I schedule the sprinklers to run via an HS device used as a logical on/off for the script. The script runs once a night and sets up a one-time event to run the sprinklers if, after checking the rainfall, there is a watering need. I run the sprinklers three days a week, but the script I originally developed can also be set up to schedule them daily or not based on the total rainfall. In my case, I have a special sprinkler event that runs the sprinklers 6 times with a half-hour delay between each OFF-ON transition, because I have a ratcheting valve system (6 zones, one at a time, that advances to the next zone when the water is shut off).

This is, of course, based on my knowing that my lawn needs about 1.5 inches over the three days, and my sprinklers deliver about an inch per hour. I run each of 6 zones, which all overlap, for a half-hour apiece, giving the lawn about an inch when it needs it.

If you can determine how much water your garden needs on a daily basis, and how much water your sprinkler system delivers per minute or hour, you should be able to use this method to make sure it has enough water based solely on rainfall measurements. Even though this does not use the envirotranspiration rates and other measures, it is a pretty good average and my lawn stays green and growing all year. A better way would be to measure the actual moisture in the ground by the plants and determine how much time to run the sprinklers based on that. I didn't have a system to do that here.

Here's my script, for grins... there's room for improvement, of course. It's commented, but holler if you have questions.


  • sprink_sched.txt
    4.5 KB · Views: 105
The problem is that I want to prevent my sprinklers from run if it is going to rain later that day. Which weather station do you have?
electron said:
The problem is that I want to prevent my sprinklers from run if it is going to rain later that day.
Can this script be modified to place my bets if I will win later that day? lol
If the weather (wo)man can predict very accurately that it is going to rain, why shouldn't it be possible for me to do something similar using internet based weather data ;) I guess I will just look for some keywords in the forecast (such as rain, showers etc).
Why not have it water UNLESS it's raining? A rain indicator shouldn't be that hard to make/buy/interface and shouldn't cost a lot of $$.
Future rain prediction? hehe, ok, you can do that using whatever forecast you want, even Internet, as long as you trust it and find it accurate enough to not kill your plants (either by too little or too much watering). I have an Oregon Scientific WM-918 wired weather station with rain gauge, and using a serial cable and VWS, I can tell if it is raining with each poll of the station, or how much has fallen using the software's determination based on the number and frequency of the rain gauge bucket emptying. But forecasts for me here aren't going to cut it for reasons mentioned in my previous post.

VWS polls the station every ten minutes and logs the data in those files, generates the various graphics and stuff I use and uploads them to my (now offline) web site. The station and VWS also attempt to predict the weather conditions and possible future conditions based on the various factors, but I don't trust that down here. Maybe your weather conditions are much more predictable and stable so the forecast or calculated weather conditions will be more accurate for you. If you wrote a plugin, you could do the polling without VWS, I suppose.

It would be fairly trivial to check the latest files and see whether it was raining within the last ten or twenty minutes before actually running the sprinklers.
The free WeatherXML does daily rain percentage predictions that you could use for watering in conjunction with a cutoff device. The XML file is very easy to parse put the %chance of rain. An easy and cheap cutoff is an aspirin in between a wooden spring loaded clothes hanger that has to screws that touch when the rain comes and melts the aspirin away.

Personally for my garden I simply walk out and check it. If it needs watering I manually turn it on for X number of minutes. The garden needs much less watering than a lawn due to the plants deep roots. I have only had to water my garden once this whole year and the tomato plants are over 10 feet tall and fall over. The stakes I used were only 8 feet and with 2 feet in the ground they are overwhelmed. I just picked 7 tomato's today so knowing when to water will be easy because I ave to now make daily trips to gather the tomato's. I need to plant determinant plants next year. ;)
I switched from a sprinkler to a soaker hose for that reason, and it's working great. For now, I am just paying attention to the color of the soil (does it look dry/wet) and if it's going to rain. I wrote my own weather script which doesn't use XML but hasn't broken once yet in the many years I have been running it, but I will look at that XML feed to see if I can get more useful data from there. If I could get that % number, I would combine that with a max. runtime etc., so it shouldn't cause any flooding (and the garden bed is 8'x8'x2' anyways, so it takes a while to get completely soaked).
This might be a question for another area, but I was just wondering what kind of sprinkler hardware you guys are using? I'm interested in doing something like this, but I need to get my sprinkler system first. Any recommendations?