Overview
This guide walks through building a 4-channel liquid fertilizer dosing system using peristaltic pumps, an ESP32, and a 4-channel D4184 MOSFET board. Each pump is controlled via a switch in Home Assistant, powered by ESPHome.
This system is ideal for precision nutrient dosing in hydroponics or gardening, with a total cost-effective, automated setup.
Components
Electronics
- 1x ESP32 development board
- 1x D4184 4-channel MOSFET module (AOD4184 or LR7843-based)
- 4x Peristaltic dosing pumps (12V, max 5W each)
- 1x 12V DC power supply (min. 2A recommended)
- 4x Diodes (optional, for added protection if not onboard)
- Jumper wires (male-male, female-male)
- Breadboard (e.g. MB-102)
- 24 AWG stranded wire (for each pump if only one runs at a time)
- 4x Check valves (optional, recommended to prevent backflow)
Tubing
- Inner diameter: Match pump connectors (commonly 2.5mm)
- Material: Silicone is easiest to work with
Wiring Diagram Summary
- ESP32 GPIOs control each MOSFET channel:
- GPIO16 -> Pump 1
- GPIO17 -> Pump 2
- GPIO18 -> Pump 3
- GPIO19 -> Pump 4
- MOSFET Source pins must be connected to 12V PSU GND
- Pump positive wires go to 12V PSU +
- Pump negative wires go to each MOSFET Drain/”Load” output
- ESP32 GND is connected to the 12V PSU GND
ESPHome Configuration
output:
- platform: gpio
pin: GPIO16
id: pump1_output
- platform: gpio
pin: GPIO17
id: pump2_output
- platform: gpio
pin: GPIO18
id: pump3_output
- platform: gpio
pin: GPIO19
id: pump4_output
switch:
- platform: output
name: "Pump 1"
output: pump1_output
- platform: output
name: "Pump 2"
output: pump2_output
- platform: output
name: "Pump 3"
output: pump3_output
- platform: output
name: "Pump 4"
output: pump4_output
Tips for Reliable Operation
- Use check valves to prevent line siphoning or backflow
- Keep tubing lengths equal if dosing simultaneously
- Use ESPHome delays or automation to ensure only one pump runs at a time (if sharing thin wires)
- Secure tubing tightly on pump connectors to prevent leaks
- Add a button or automation for manual priming if needed
Optional Enhancements
- Add momentary buttons to dose specific pumps
- Add flow sensors for verification
- Use PWM control to vary pump speed if your pump supports it
- Create a 3D printed case or mount for the electronics
Safety Note
Always double-check polarity, and never power the system unattended until fully tested. If modifying the D4184 board to bypass the optocoupler, ensure proper gate resistors and shared GND are used.
System tested successfully with ESP32 + 4x peristaltic pumps and 24 AWG wiring for single-pump-at-a-time operation.