Irrigation control

I’ve built an ESP8266 based device which I am going to use to auto-water my greenhouse plants based upon data from it’s ‘soil humidity’ & ‘Temperature’ sensors.

The device regularly sends data via MQTT to node-red, and node-red then determines if, when & how much water to administer. Node-red then sends a MQTT message to the device, telling it how long to switch on the irrigation pump.
For example; greenhouse/control 65
…would activate the pump on for 65 seconds.

All good, installed & working so far as a POC…

However I need to work some more on the calculation used by node-red to determine the pump timing as there are 3 influencing factors;

  1. Time of Day - I want watering to be reduced during the night
  2. Soil Humidity - more water to be available if soil humidity is low
  3. Temperature - as the temperature rises, I can be more generous with water

I realise that the actual timings will need to be tweaked by trial & error, but has anyone any ideas what would be the best way to perform a three way calculation such as this?

Hi, I have a working irrigation, 4 station system, with 5 solonoids, one for borehole pump, connected to an esp8266, RPi tuen determines watering, sends mqtt msg, which switches on and off. I also have a Dashboard interface to do manual on off, and override auto timers.

I do not yet have temp and hum, but all ready for that now.

On your qyestion, you should not water at night time, my knowledge of plants tells me, thus you should rather move starting times with morning times, that is easy, their are nodes for that. Re the other 2, next post I will share my thoughts…

@IoTPlay
Could you share your project, please? (just in case it is not commercial)
Many people are interested these days in automated watering and many projects rise.
I think it’s better to re-use ready solution rather than make the same mistakes in person.

I will gladly share both my ESP sketch and my node-red flow, but need to finish it first, and iron out a few minor glitches.

Paul

Since you have asked... I am putting my designs on Github for you. Only starting now, but enough eye-candy to look at already. Will give you some ideas on what I am doing. Will also publish flows when done.

IoTPlay sprinkler System

2 Likes

Hi Paul,
I'm new to Node-Red and am trying to do something similar to what you've done in your greenhouse. Mine will be in a Root Pouch garden. Would you mind sharing your flow?
Thanks,
RB

The problem is that my flow is deeply embedded into the ESP code and would only serve to confuse you.

Briefly, the ESP is programmed to update node-RED at regular intervals with the soil humidity and temperature. Node-RED then uses the node-red-contrib-pid node to calculate how much water to administer (or should I say 'how long to run the irrigation pump) and sends this command back to the ESP, again by MQTT.
The ESP carries out that task, and then without further contact from node-RED shuts off the irrigation pump.
The process then repeats at set intervals.

I've built it that way so that if node-RED crashes (which it never does), or the network/MQTT fails (which it does!), then the ESP will work autonomously, and shut the pump off.

I have built other functions into the ESP, such as, if communications with node-RED fail, then the ESP will resort to a independent mode, to provide sufficient water for the plants to at least survive.

So as you can see, a lot of the functionality is split between node-RED and the ESP, and just posting the flow would not help. Sorry.

2 Likes

@Paul-Reed - Hey Paul,
Actually I think a lot of us would like to see it...well I would. I have a number of ESP's already reporting temperature and soil humidity. I'd love to take a peek at your ESP code too - which one are you using?

From another Paul :blush:

In case it is of interest I have ported the pid algorithm across to the Tasmotta ESP S/W so the whole control loop can now be run in the ESP if necessary. This makes the system even more resilient as it doesn't need the network to keep the loop running. As it is the same algorithm as node-red-contrib-pid it can be initially setup running the algorithm in node-red, which makes it easier to tune, then moved into the ESP device when it is all running ok. I have a couple of loops running using the Sonoff TH10 which can have a temperature sensor plugged in and has a relay ouput, which gives a complete temperature control system for under £10 if prepared to wait for delivery from China.

3 Likes

The easiest to use! - Wemos D1 mini.

As for sharing... the flow would need a bit of work, as it's part of a bigger flow, and would need detaching. However.... the ESP code is CodePile | Easily Share Piles of Code

1 Like

Hi there

I'm on similar stage now, but with a garden irrigation controller. I have used a very simple watering controller, which had a fixed timing regardless of weather/seasonal conditions, so would like to change it now. Since I have a home automation made on Node-RED, which controls pretty everything in my house, I have a lot of data/sensors available.

I have assembled a simple water valve consisting of 230/24V transformer, Z-Wave relay and Hunter 24V solenoid. All is in waterproof IP66 box for outside installation. So far so good.

Now question about determining the necessary timing - e.g. how much time the valve should be on every day.

In principle I see following dependencies:

  • Seasonal - in summer the duration should be longer, in spring and autumn - less. For this I could use calender or measure outside temperature - what is better?
  • Rain. If it was raining the duration should be logically reduced. For this I have a rain sensor (but it just says if there was a rain or not, not quantity) and also get rain prognose from weather node.
  • Sun shining - I feel this is important. If it is cloudy the duration can be reduced. I can take this value out of weather node.

Now the question is - how can this altogether be used as a scaling factor for irrigation duration. Does anyone know the magic formula?

Update: I have found this from popular irrigation controller producer Evaporation-based irrigation scheduling | Agriculture and Food
They talk about evapotranspiration as the main factor for definition of watering duration. And I can get this directly from DWDWeather node. So this is good.

How you water i.e. do you run drip lines for each plant or area sprayers, will be a factor in how much watering you have to do.

How much mulch you use will also need to be calculated in because it will help prevent the water under the mulch from evaporating too quickly.

Type of plants you are growing. All plants want/need different watering amounts. If you put all the plants under the same watering constraint you will probably ofer water some, under water some and water some just the right amount.

So my take is you are not going to find a 'magic' formula, the best you might get is an 'ok' guess :wink:

Thanks for your reply

In order to not over/underwater individual plants, each sprinkler must be adjusted to specified water consumption in L/H, so this is not a problem. By balancing of the sprinklers one can get the system which will correctly water the whole garden by opening the valve for specified duration. Off-course this is going to be plus/minus, but OK.

The only question I have right now is how to specify this duration, depending on weather conditions - mostly rain and temperature. Modern irrigation systems are doing this automatically, but I don't know their algorithms.

I'm currently monitoring Evapotranspiration parameter, as well as precipitation with DWDWeather node in my region to see how those will correlate with my weather observations and hope will come with some formula soon.

As (the other) Paul has said, there isn't a magic formula, because there are too many variables - soil composition, soil moisture retention, windspeed, temperature, plus many others.
I think that the way forward for you is to make you 'best guess' and then tweek the formula until you get it right.
My current calculation, is simply to assign a weighting factor to each variable, such as;

Temperature
Below 20C = 0.8
20C - 24C = 1
25C - 28C = 1.2
Above 28C = 1.4

...and then use that and other weight factors to determine the sprinkler time.

Sprinkler time = 10 * temperature * windspeed * time of day * etc, etc.

1 Like

Yes, this is exactly what I'm looking for. What other factors you use and how? Do you consider precipitation in last 24H or so, or you have a greenhouse?

My use is for my greenhouse, so my requirements are very different to yours.