Main Content

IoT Garden Watering With Arduino ESP32 & Openweathermap

I have a small garden irrigation system of sprayers and drippers that was being controlled with rain and temperature sensors to water the garden as required, year round with time from an RTC. The rain sensors kept failing so I upgraded to this system taking weather info from openweathermap and date and time from NTP.
It waters every other day in spring and autumn and every day in summer but ONLY on days that it hasn’t rained. In winter we have some fern trees that like to be watered all year so it waters those with drippers set under the frost protection material, but only if the temperature is above freezing to avoid trying to water through frozen pipes.
The NTP server time toggles automatically between GMT and BST.
Rain is logged by simply setting an LED to HIGH when openweathermap records rain. At 6pm the loop checks to see if the LED is LOW or HIGH. If LOW, it runs the correct watering programme depending on the date. If HIGH, the LED is reset to LOW, ready for the next 24 hour period.
The L298N module includes a very handy 5v step-down jumper so you can input 12v for the solenoid but also output 5v to run the ESP32.
We also have a problem with the neighbourhood cats hiding in the bushes to ambush birds coming for food and water so a CatFlush function was added. We can turn on the system from the kitchen and flush cats out of the borders.


- ESP32
- L298N
- 12v input
- 128x64 OLED
- Toggle switch
- LED x 3 colours + resistors
- Solenoid Valve”

Link to article