Automated Irrigation System

Automated Irrigation System

In order to make it easier to water the plants on my balcony, I built a small irrigation system. The basis of this system consists of a 50-liter barrel, a 12V high pressure pump and a lot of thin PVC tube with attached sprinklers.

Controlling the pump

The high pressure pump is connected to a relay, which is controlled by one of my Raspberry Pi Zeros. If the relay is closed, the pump receives power from a 12V power supply unit and starts pumping water from the barrel into the tubes.

Depending on the type of plant, I installed sprinklers with different throughput. This was necessary to ensure that plants with a high demand for water such as cucumbers would receive enough water, while at the same time other plants with a lower demand are not flooded. During high summer, the system runs up to 15 minutes each day. The barrel needs to be refilled every few days.

Chat bot integration

Like most of my smart home projects, I wanted to be able to control my irrigation system through a chat bot. Logging into the Pi and manually starting the irrigation system would be way to much work. I could have created a static cronjob to be run each day, however this would not have taken into account the current weather conditions and therefore the amount of water could not have been adjusted accordingly without logging in via the console each time.

I therefore created a simple telegram chat bot using python and the telepot library. This allows me to manually start and stop irrigation as well as create a schedule.

The schedule can be set by sending a time of day, plus an amount of minutes which the pump should run. The python script then creates cronjobs to run the irrigation system at the specified times for the specified duration.

Each time the scheduled irrigation is run, a notification is sent by the chat bot. A message is displayed which updates the number of seconds the system has been running in real time.

The following image shows an excerpt of the python script, which describes the function called when a user wants to adjust the irrigation schedule. If a new schedule is received in the correct format, the schedule is dumped to a file (a database was not used for the sake of simplicity), the crontab is updated and the user is notified of the changes.

All in all, the automated irrigation system has proven to be highly valuable, especially during periods of absence from home.

Comments are closed.