How to Build a Self Watering Garden

This article describes an automated irrigation system for home gardens and small farms. It uses soil moisture levels and other telemetry data to drive watering schedules vs traditional time based scheduals. This project is Open Source and easy to program.

Garden Diagram


Why Build this Thing

The typical small irrigation systems today are based on time schedules, where sections of the garden (zones) are watered based on days of the week, a start time and a duration. In otherwords, your garden is watered according to a set schedule regardless of environmental changes.

In reality, the amount of water should be increased during long hot dry days and decreased as the days shorten and get colder. For example, if it rains you probably need to turn your sprinklers completely off and remember to turn them on again when it stops raining.

Water Levels not Time

The Organic Gardner (OG) waters your garden when the the ground becomes too dry for plant and stops watering it when the ground has reached the right moisture level.

Plants Get the Perfect Amount of Water

Different plants require a different amount of water, for example, roses require quite a bit of water to produce beautiful healthy flowers, but that same amount of water will destroy most varieties of succulents.

Plants that produce food also require specific amounts of water. Peppers and watermelon would not survive or flourish if they are each given the same amount of water.

OG Control stations can be configured to start and stop watering according to the amount of water a given type of plant requires.

OG Conserve’s Precious Water

In many parts of the world, including the South Western US and Southern California where I live, are in a decade long drought with water levels at all-time lows.

Saving water is a major goal of this project and one that will hopefully help others convserve this scarce and precious resource.

How Does Organic Gardner Work?

The primary goal of Organic Gardner is to build a smart irrigation system that will provide watering zones with the perfect amount of water based on the plant or crop being watered and not a drop extra.

The Collection Station

Soil Moisture and other telemetry (temperature, humidity, light levels) are collected by a collection station diagrammed below. The moisture sensor is placed in the soil near the plant(s) that need to be watered.

Collection Station

The collector gathers and publishes the soil moisture level periodically over a wireless network. The smart hub will then process the data to determine when to send a start water command to the control station in the respective watering zone.

The Smart Hub

The Smart Hub also known as the IoTe gateway, is the “brains” of the system. IoTe processes moisture data sent from collection stations to determine when to send start watering and stop watering commands to the appropriate control station.

The Control Station

The control station is connected to a sprinkler or drip system that can be turned on or off as a result of receiving the corresponding message from IoTe.

The control station may optionally be connected to other accessories such as a lighting or heating systems.

Control Station

As the plant is being watered, moisture levels are transmitted back to the Hub when the soil has hit the appropriate moisture level. The Smart Hub will then send a control message back to the controller to stop the watering.

The Dashboard

The Hub has a built in Dashboard that can be accessed from any browser (Chrome, Firefox, Safari, etc) with screens that allow a user to observe the telemetry data from the collection stations. The Dashboard also allows a user to manually activate sprinklers and configure moisture thresholds that determine when sprinklers are activated and de-activated.

Todo a Screenshot of the Dashboard

Essentially the dashboard gives humans the ability to monitor, configure and control the irrigation system.

The Cloud

No IoT project would be complete without adding the Cloud to the project (the ‘I’ in IoT). The IoTe (hub) can be connected to the Internet when available, providing users access to the Dashboard from anywhere in the world as long as they have an Internet Connection.

Your garden can be monitored, controlled and configured from your phone anywhere in the world!

Todo Picture of a Phone and Dashboard

The history of data collected in the cloud as well as watering times can be plugged into a Machine Learning (ML) or Data Science framework if desired. We will talk a bit more about ML in a future article.

The Project

As I mentioned earlier this project is a Proof Of Concept (PoC) with a few distinct components that must all work together. These components include, but are not limited to:

  • The collection and control station. These two components are actually the same piece of software.

  • The smart Hub or IoTe Gateway

  • The Dashboard, which is served up by the IoTe gateway

  • The cloud component includes a version of the IoTe gateway and a timeseries database

If you are interested in this project either as a user or a developer, I encourage you to follow along or better yet drop me a line and get involved!

About the Software Components

The IoT Hub is the center piece of the IoT project as gathers data, runs application logic. Provides an HTTP Server to serve up a Web App, REST API and Web sockets. This project is a Micro service written in Go, and is perfect for systems hackers, backend devs and full-stackers.

January 13, 2022
The Collection Stations are small battery powered wireless devices outfitted with environmental sensors. They collect and publish the data to the Hub for processing. This project is built with the esp32 micro-controller, C++ and embedded realtime operating system.

January 13, 2022
This is the second milestone of the Organic Gardner IoT project. The first milestones we implemented MQTT subscriptions to gather sensor data. This milestone we are going to add HTTP RESTful API to provide access to that data. The same HTTP library will later serve up our IoT dashboard.

March 30, 2022
The primary function of an IoT Gateway is moving data from one input source (often sensor data) to another output destination (like a control algorithm) with some data conversion and storage in between. Our first milestone building the IoT Gateway is reading data from MQTT then holding it in RAM for the upcoming REST API we will build for Milestone 2.

March 29, 2022