I have a hard time keeping herbs alive in my windowsill and as a software engineer I have a deep felt love for automation. And I like designing and building stuff. So I would like to build an automated plant monitoring and watering machine for my kitchen windowsill.

Hardware Requirements

These are the requirements I setup for the hardware of the machine:

  • Controlled by Raspberry Pi Zero – as I had one already
  • Moisture sensors to monitor individual plants
  • Valves to control watering of individual plants
  • Water tank to minimize potential flooding and for ability to add fertilizer
  • Float switch to alert about empty water tank
  • Sensors for each plant to detect flooding
  • Light, Temperature, and humidity sensors
  • Relays to enable control of 12V components
  • ADC to allow analog sensors
  • RC filters to prevent noise from long wires for analog sensors
  • Timer chip (555) to prevent pump from keep pumping even if SW crashes
  • Optional: LED growlight

Software Requirements

These are the requirements I setup for the software of the machine – being a software engineer this is somewhat over-designed:

  • To be implemented in Python 3
  • Object Oriented approach
  • Modular design to isolate implementation of different components and to allow putting subparts in production as they are completed
  • Event driven system based on mails between the different components
  • Database backend for data collection
  • Web interface to monitor sensors, watering schedule, and water consumption
  • Optional: Command line interface to control machine manually

Temperature and Humidity Sensor

For the sake of data collection and comparison to environment changes I like to include a temperature and humidity sensor into the setup. I set my heart on the DHT22 sensor. There are loads of examples on how to use this sensor so I just picked one:

It was easy to follow and the code was quite simple:

Moisture Sensor

Originally, I planned to use pretty standard moisture sensors and have bought a bunch of the type shown.

However, after receiving the sensors I stumbled upon this article Sensing Soil Moisture: You’re Doing it Wrong. I decided to setup an isolated test to verify the claim. My setup was a Raspberry Pi Zero connecting the sensor placed in the soil of a plant to a LED. So continuous monitoring and thus continuous power to the sensor. Below is the chocking result after just one week of operation.

Completely oxidized – I was chocked! This could probably be mitigated or delayed significantly by only powering on the sensor when sensing is needed. But the oxidizing will still happen at some point and the uncertainly of when is undesired in the system. I followed the suggestion from the article and built sensors from pencils but my experience is that these have lower sensitivity and thus difficult to get good results from.

Instead I opted for capacitive soil moisture sensors. I am yet to test these and the results will be added here.