Disclaimer: This page is work in progress! Right now, it is more or less a notepad for Martin.
As many others, Martin is quite lazy. Unfortunately, he also likes to have fresh herbs and other plants on his balcony.
Since this combination led to many dead plants, it was pretty clear that there needs to be some automated solution for this.
- 1 Vertical Farming
- 2 Supplying Water
- 3 Soil Moisture Sensor
- 4 System Architecture
- 5 Software
On a normal balcony, space is a very limited resource. Therefore, a solution was needed which allows to make use of vertical space rather than using up a lot of horizontal space.
In addition, it should be possible to build it from standard components which you can get from your local hardware store.
Using jardinieres which are arrenged on top of each other with a self-built rack was the perfect solution for this.
In my case, I am using 4 jardinieres to grow plants in and a 5th one on top which is just being used to store water:
In a first tests of the system, I thought using water pumps would be a good idea. Therefore, I got these 12V pumps and tested them. While they worked, they were pretty loud, so there would need to be logic which prevents the system from watering during night hours. Therefore, a more silent system was needed.
When thinking of how to achieve this, the idea of vertical farming came up, which allows the water storage to be the highest point of the system. With this, I can just use valves and let gravity do the work (isn´t gravity awesome?). I found some random 12V magnetic valves in the internet which I got for my system. Unfortunately, I cannot find them anymore.
Soil Moisture Sensor
In order to control the whole system, sensors are needed which are able to measure the soil moisture in a reliable way. If you want to measure soil moisture, there are in general two ways:
Resistive measurement of soil moisture is a very easy thing. In principle, you put two electrodes into the soil, put power on one of them and measure how much power arrives at the second one.
With this, you have a very basic measurement of the soils resistance. The more power arrives at the second electrode (and thus the lower resistance), the more water is in the soil.
There are very cheap sensors which can measure the moisture this way.
The "controller" board they come with is capable of either providing the analogue value or provide a digital value which indicates the moisture to be above/below a certain threshold (adjustable by a potentiometer).
While these sensors provide you with correct values, they have a big disadvantage which is unfortunately in their underlying priciple: The electrodes need have direct contact to the soil. Applying power to the electrodes leads to corrosion, which leads to the sensor not working anymore. While this would not be super critical (you could just get a new one, since they are so cheap), most of these electrodes consist of cupper. The cupper will make its way into the soil and thus into the plants. Since we are talking about herbs and other plants I am planning to eat, this is pretty bad.
Another possibility of measuring soil moisture is capacitive measurement. Basically you are measuring the capacitance of a capacitor consisting of your sensor and the soil. A more detailed explanation can be found here.
The big benefit of these sensors is that there is no corrosion. Therefore, there is no danger for the plants and the health of the person eating them.
When this project started (in 2014), these sensors were quire expensive. However, in the meantime they got a lot cheaper and are not much more expensive than the resistive ones. I am using these ones, which provide the moisture level as an analogue voltage. Dependent on the microcontroller / computer they get attached to, an analogue-digital-converter (ADC) might be needed in order to read them (the raspberry pi has no ADC, the ESP8266 has 1, but can only handle up to 1V input, the ESP32 has two ADC with multiple channels being able to get 3 volt input (though you cannot use the second ADC when Wifi is on..... )).
As most projects, there are different possibilities in regards of the system architecture. These can mainly be differentiated by the integration with other automation projects and the degree of flexibility. Of course, the different possibilities require different implementation efforts.
Just a microcontroller
- This means the microcontroller has to do everything: read the moisture, decide on when to water
- No Server needed -> no single point of failure
- Code Adjustments needed for each plant
- No History
- No remote control (e.g. water now)
Microcontroller plus central server
- Microcontroller would just read the moisture, send it to the server, "business logic" on the server decides on watering time
- No code adjustments needed
- Logic adjustments could be done centrally
- History available
- Server controls everything --> single point of failure
- Microcontroller would get config from the server, then read the moisture and decide on watering time itself. Server could be used for analytical purposes
- No Server needed for core functionality --> No SPoF
- No code adjustments needed
- History could be available
- Possibility for persistent storage of config needed
Custom Server development
- Custom software which contains the business logic regarding when to water the plant. High level of DIY and flexibility, but also high effort (dev and maintenance)
- Cool project
- Quite some effort
Standard server Software
- Most likely using OpenHab. Less DIY, but more integrated with other automation projects. Are analytical features provided out of the box?
- Less error prone
- Software could be used for home automation in general
- Most likely more resource intense than custom software
- Less cool