Firmware for controlling a custom built water pump using an esp32 microcontroller.
Detailed documentation of this project: https://pfusch.zone/regulated-waterpump
- hardware
- read pressure-sensor
- read flow-sensor
- control VFD
- control servo motor
- monitor temperature
- regulate pressure
- motor RPM (VFD)
- bypass valve position (servo)
- dynamic target pressure (e.g. reduce pressure when no flow)
- hardware control interface
- set target pressure poti
- status leds
- 3x 7-segment display
- timeout/powersave mode (turn off VFD, servo, display)
- remote web interface (MQTT)
- connect to wifi
- connect to mqtt broker
- control (subscribe topics)
- set PID parameters
- set target pressure
- turn on/off
- status (publish data)
- pressure
- PID debug data
- flow, volume
The wiring and all components used are described in the document doc/connection-plan.drawio.pdf.
Photos of pump and control cabinet:
Currently using ESP-IDF version v5.2.1
git clone -b v5.2.1 --recursive https://github.com/espressif/esp-idf.git /opt/esp-idf-v5.2.1
/opt/esp-idf-v5.2.1/install.sh
run once per terminal:
. /opt/esp-idf-v5.2.1/export.sh
idf.py build
- connect FTDI programmer to board (VCC to VCC; TX to RX; RX to TX)
- press REST and BOOT button
- release RESET button (keep pressing boot)
- release BOOT button
- run flash command:
idf.py flash monitor
- click RESET button to startup and monitor
In this project I often had trouble flashing the firmware, thus requiring multiple attempts.
Invalid head of packet (0xXX): Possible serial noise or corruption.
- The most significant problem is the VFD causing EMI even in idle -> Turn off VFD (400 V supply) and power the board externally
- Unreliable jumper cables -> use actual 6 pin connector or tighten jumper contacts