title: Gieß-o-mat description: DIY fertilizer mixer and plant watering machine parent: projects position: 6 github: https://git.xythobuz.de/thomas/giess-o-mat date: 2021-03-29 update: 2021-10-24 --- This project [was featured on Hackaday](https://hackaday.com/2021/05/14/automated-watering-machine-has-what-plants-crave-fertilizer/)! 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. ## 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...) 😊 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](https://amzn.to/3sQ4Otl) and an [ESP32](https://amzn.to/3xmDh6k). The Arduino provides the user interface, using a 20x4 LCD from a now-obsolete Sparkfun project called [SerialLCD](https://www.sparkfun.com/products/retired/9568). 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. The actual control is done on an ESP32 which is connected to two [4-channel relais boards](https://amzn.to/2QW0Sty). 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. 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](https://git.xythobuz.de/thomas/3d-print-designs/src/branch/master/giessomat) on my Gitea. 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. 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](https://git.xythobuz.de/thomas/giess-o-mat/src/branch/master/README.md) 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. 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 ---
Giess-o-mat User Interface Schematic -------|USB|------- | |___| | |x D13 D12 x| Level Conv. |x 3V3 A D11 x| ----------- |x REF R D10 x|---> LCD_TX +5V_UI <---|x 5V 3V x| |x A0 D D9 x| GND <---|x GND GND x| |x A1 U D8 x|---> KP_R4 SDA_UI <---|x D5 D3 x|---> ESP_SDA |x A2 I D7 x|---> KP_R3 SCL_UI <---|x C5 C3 x|---> ESP_SCL |x A3 N D6 x|---> KP_R2 ----------- SDA_UI <---|x A4 O D5 x|---> KP_R1 SCL_UI <---|x A5 D4 x|---> KP_C3 Connector |x A6 D3 x|---> KP_C2 ------- |x A7 N D2 x|---> KP_C1 +12V <---|x +12V | +5V_UI <---|x 5V A GND x|---> GND ESP_SDA <---|x SDA | |x RST N RST x| ESP_SCL <---|x SCL | GND <---|x GND O RX x| GND <---|x GND | +12V <---|x VIN TX x| ------- | | ------------------- ---------- ESP_SDA <---| 2.2k |--- KP_C1 KP_C2 KP_C3 ---------- |--> 3.3V | | | ESP_SCL <---| 2.2k |--- ------------------- ---------- | --- --- --- | KP_R1 <---| | 1 | | 2 | | 3 | | -------------------------- | --- --- --- | +5V_UI <---|x VCC | | --- --- --- | LCD_TX <---|x RX | KP_R2 <---| | 4 | | 5 | | 6 | | GND <---|x GND | | --- --- --- | | -------------------- | | --- --- --- | | | | | KP_R3 <---| | 7 | | 8 | | 9 | | | | LCD | | | --- --- --- | | | 20x4 | | | --- --- --- | | | | | KP_R4 <---| | * | | 0 | | # | | | -------------------- | | --- --- --- | | | ------------------- --------------------------