Skip to main contentDrew Althage

IoT Irrigation

Not too long ago I purchased my first Raspberry Pi and set off to hack my way to a smarter home. I decided that garden watering was a simple repetitive task with “automation” written all over it. I wanted my smart garden to make sure the plants were getting enough water by using calibrated soil moisture sensors. But I also did not want to double water if it was currently raining, checked via a simple rain sensor or if it was going to rain checked from OpenWeatherMap. In addition to all of that, I also wanted to get notified whenever the valve was opened and closed.


The system runs a Next.js app, which provides a view layer to manually water the plants and get sensor readings in the browser as well as serverside support to run Nodejs scripts that control the hardware. The meat of the software is broken down into three conditions as mentioned above:

  • Check weather. If chance of precipitation greater than 80%, do not water plants.
  • Check soil sensors. If any of the three sensors to not meet moisture requirements, water plants.
  • Poll rain sensor. If currently watering, continuously check rain sensor. If it starts to rain, stop watering plants.


The circuit is based on the one outlined in this guide here but I added a few more female header pins to support the additional soil and rain sensors.


This project could be slimmed down / optimized significantly. I’m using a Raspberry Pi 4b that has a ton of extra stuff we dont need like bluetooth, HDMI, amongst others. If we really wanted to go barebones, we could probably start with a Raspberry Pi Zero and add modules / hats as needed.

I’m also running this with Nodejs. Which is definitely a bit more expensive to use than Python which comes with the Raspberry Pi OS.

Better pictures of the project in the wild coming soon…