Fork this with Git

Gieß-o-mat

Published at March 29, 2021.
Last updated at May 02, 2021.

Since moving into my own flat in 2019 I started growing quite a bunch of plants. It started with carnivorous plants and some decorative stuff on the balcony (also good for the insects!). Last year some herbs like basil were added. And this year I also have quite a selection of different Paprika/Chili strains growing, as well as some Tobacco.

So it seemed natural to build a machine that can help me with watering the plants and mixing in some fertilizer solution into the water once in a while.

Demo Video
Front of the UI unit
Side view of the machine

Overview

The machine consists of a 5l watertank. A solenoid valve controls the mains-water-line inlet to the tank. Small amounts of fertilizer mixture can be added to the tank using peristaltic pumps. The whole system is mounted high-up on the top of my plant shelf. That way, gravity is feeding the water from the tank to the outlets, controlled by more solenoid valves. Of course, the outlet valves can also be replaced by pumps, so everything can be mounted level, or the machine below the plants.

Even though the software uses float-switches to measure the fill-height in the tank, maximum safety timeouts are implemented for every action, so the chances of flooding the house are minimized. Still, I always manually close the mains-water-inlet with a proper hand-controlled valve after using the machine and open it only when needed, just in case!

(I'm a software developer by trade, so I'm relatively confident the software works, but I don't trust my plumbing skills too much...) 😊

Screenshot of the web interface

The web interface is using JS and Websockets to dynamically update the page, showing the same output that is visible on the physical display. Keypad button presses can be executed that way as well. Also, the debug logs that are normally provided on the serial port are also sent out to clients connected via the web interface.

Implementation

The machine is using two microcontrollers, an Arduino Nano clone and an ESP32.

The Arduino provides the user interface, using a 20x4 LCD from a now-obsolete Sparkfun project called SerialLCD. It is connected to the Arduino via serial. Input is done using a cheap 3x4 Keymatrix directly conencted to the Arduino GPIOs. I also added a power switch and some voltmeters for the different voltage regulators and a main power switch. All this is mounted in a simple 3D-printed frontpanel.

Back of the UI unit
Front of UI PCB
Back of UI PCB

The actual control is done on an ESP32 which is connected to two 4-channel relais boards. Using these, it controls five valves (one inlet and four outlets) as well as three pumps for the fertilizers. For the outlet valves I'm using cheap small chinese solenoid valves. For the inlet, I'm using a more expensive metal solenoid valve from Germany that is able to resist the mains-water-pressure (up to 8bar) that I still had from my cocktail machine experiments. Two float switches are used to tell the fill-height of the water tank. The ESP32 also provides a simple web interface to allow the same controls as from the user interface.

Top view of the machine
Front of controller PCB
Back of controller PCB

Both UI and controller are connected to each other using I2C. All relevant signals are transmitted with a simple DB-9 cable.

All this is mounted on an old piece of shelf-board, using some custom designed 3D printed parts. The water tank is realized using a generic 5l liquid tank, with two holes drilled for the fill switches. The holders for the fertilizer bottles, as well as the bottlecaps, are specifically designed to fit my 1l fertilizer bottles.

I designed all the 3D printed parts with OpenSCAD. You can find the files on my Gitea.

User Interface
Bottlecap for Fertilizer
Fertilizer bottle mount
Watertank holder
Hose sieve/filter
Hose fix for pumps
Light-proofing for hose hole
Large valve mount
Small valve mount

Most of the parts I had lying around in the workshop. I only had to buy the outlet valves after realizing one of the big valves I still had was no longer working. Also the pumps, hoses and hose-adapters had to be bought.

Front of switch PCB
Back of switch PCB
Front of valve PCB
Back of valve PCB
Float switch and valve used
Front of pump
Back of pump

The software can easily be configured to run with more or less fertilizers and outlets, as much as the ESP32 GPIOs can provide. Alternatively, you can also use an Arduino for the controller instead of the ESP, losing the web interface. Or you can also compile the software to run both UI and control on one Arduino, as long as it has enough GPIOs for your needs (or an ESP, but I haven't tested that). You can of course also just leave out the UI and use solely the web interface on the ESP. See the README.md of the project for more details.

Doing some programming, it would also be possible to use some kind of port-extender or run also the UI on an ESP. And of course also the now-obsolete SerialLCD could be replaced with something different without too much work.

Interconnect PCB and debug power switch, front side
Interconnect PCB and debug power switch, back side

These are the circuit diagrams for the controller and user interface. Everything is powered by a 12V power supply. I am using two 5V regulators, one for powering the ESP32 and one for powering the relais coils. This was my quick-and-dirty way of getting the power rails clean enough that the ESP is not resetting when toggling a relais. The valves are directly fed 12V and another regulator produces 6V for the peristaltic pumps.

Giess-o-mat Controller Schematic

             -------|USB|-------                        -----------
            |       |___|       |             +12V <---|x IN  OUT x|---> +5V_ESP
            |  P06         +5V x|---> +5V_ESP          |  5V Buck  |
            |  P07         CMD  |              GND <---|x GND GND x|
            |  P08         P10  |                       -----------
     R5 <---|x P15         P09  |
     R6 <---|x P02         P13 x|                       -----------
     R7 <---|x P00         GND x|---> GND     +12V <---|x IN  OUT x|---> +5V_R
     R8 <---|x P04    E    P12 x|                      |  5V Buck  |
            |  P16    S    P14 x|---> R2       GND <---|x GND GND x|
            |  P17    P    P27 x|---> R1                -----------
     R3 <---|x P05    -    P26 x|---> SW_B
     R4 <---|x P18    3    P25 x|---> SW_T              -----------
            |x P19    2    P33 x|             +12V <---|x IN  OUT x|---> +6V
    GND <---|x GND         P32 x|                      |  6V Buck  |
ESP_SDA <---|x P21         P35  |              GND <---|x GND GND x|
            |  P03         P34  |                       -----------
            |  P01          SN  |
ESP_SCL <---|x P22          SP  |                        -------
            |x P23          EN  |              +12V <---|x +12V |
    GND <---|x GND        +3V3 x|---> +3V3  ESP_SDA <---|x SDA  | UI
            |                   |           ESP_SCL <---|x SCL  | Conn.
             -------------------                GND <---|x GND  |
                                                         -------

           ---------------------                       ---------------------
          |        Relais       |                     |        Relais       |
  GND <---|x GND    ----   NC1 x|             GND <---|x GND    ----   NC1 x|
   R1 <---|x R1    |    | COM1 x|---> +12V     R5 <---|x R1    |    | COM1 x|---> +12V
   R2 <---|x R2     ----   NO1 x|---> V1       R6 <---|x R2     ----   NO1 x|---> V5
   R3 <---|x R3     ----   NC2 x|              R7 <---|x R3     ----   NC2 x|
   R4 <---|x R4    |    | COM2 x|---> +12V     R8 <---|x R4    |    | COM2 x|---> +6V
 +3V3 <---|x VCC    ----   NO2 x|---> V2     +3V3 <---|x VCC    ----   NO2 x|---> P1
          |         ----   NC3 x|                     |         ----   NC3 x|
          |        |    | COM3 x|---> +12V            |        |    | COM3 x|---> +6V
          |         ----   NO3 x|---> V3              |         ----   NO3 x|---> P2
          |         ----   NC4 x|                     |         ----   NC4 x|
          |        |    | COM4 x|---> +12V            |        |    | COM4 x|---> +6V
          |         ----   NO4 x|---> V4              |         ----   NO4 x|---> P3
          |x VCC                |                     |x VCC                |
+5V_R <---|x JC-VCC             |           +5V_R <---|x JC-VCC             |
           ---------------------                       ---------------------

  GND <--------------> Float Switch 1 COM     GND <--------------> Float Switch 1 COM
 SW_B <--------------> Float Switch 1 NO     SW_B <--------------> Float Switch 1 NO
          |      |                                    |      |
         ---     |                                   ---     |
     LED / \-->  |                               LED / \-->  |
         ---     |                                   ---     |
          |      |                                    |      |
         ---    ---                                  ---    ---
        |   |  |   |                                |   |  |   |
     1k |   |  |   | 1k                          1k |   |  |   | 1k
        |   |  |   |                                |   |  |   |
         ---    ---                                  ---    ---
          |      |                                    |      |
        +3.3V ---                                   +3.3V ---

As you can see, the schematic is relatively simple, not doing much more than connecting some modules with each other. I did not (have to) add any kind of filtering or other passive circuitry.

On the schematic above, only the four required connections between controller and user interface are shown. I have used a DB-9 connector, running the power switch as well as the other voltages generated on the controller over it. This is so the machine can be turned on and off at the UI. I also placed some cheap little voltmeter modules on the UI, showing the other voltages.

Future Extensions

I have now been running capacitive ground moisture level sensors in a couple of my plants for around a year, logging the data using my ESP-Env project to an InfluxDB instance running on my NAS, with a Grafana UI running on there as well. I used the cheap chinese models up to now, and they have not proven very useful. They of course don't corrode as fast as the resistive-measurement-based sensors, but they still age because of the permanent water contact. I tried to work-around that by using Plastik70 in liberal amounts with multiple coatings on the sensor, but even with that they show quite considerable drift over a couple of months. The data is good enough to see when I watered the plants, but it is difficult to determine a value where automatic watering should occur. Because of that, I have not yet added completely automated watering into the system. It still has to be started manually via the user interface.

Data of new sensors
Data after about half a year

If you look closely you can also see some glitches in the data where my ESP had problems and did not store new values. Also consider that in the timeframes seen in the graph above, I always watered the plants manually as soon as the soil felt dry about 3cm deep.

But recently I got a different sensor from a colleague of mine, which is from another project called Giesomat. The similar name was totally incidental, I only heard of it after naming my own project like this. I will test it and report the results here sometime in the future.

Also, it would of course be possible to design a custom PCB for the hardware. But to be quite honest, I don't see the appeal in that currently. It would lose the ability to use a different number of pumps and valves, as needed by the specific application. And building all this up on perf-boards is really not much work.

Links

You can find all the source code for the device itself (both the UI and the Controller) as well as the OpenSCAD design files for the 3D printed parts on my Gitea instance. The project is also mirrored on GitHub.

License

Giess-o-mat is licensed under the GNU General Public License.

Copyright (c) 2021 Thomas Buck <thomas@xythobuz.de>

Giess-o-mat is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Giess-o-mat is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Giess-o-mat.  If not, see <https://www.gnu.org/licenses/>.