Field Installed (1 Site)Personal Engineering Project · 2026

SmartFlow: Automated Controller for a Residential Deep-Well Pump

A two-node embedded automation and telemetry system preventing dry-run motor burnout, handling power fluctuations, and enabling remote control over 40 meters of noisy industrial wiring.

View Repository·Leon, Iloilo, Philippines
RoleSolo Developer & Hardware
TimelineMar – Sep 2026 (91 commits)
Target Motor1.5 HP Inductive (220V AC)
Core StackESP32 · C++ · RS-485 · Kotlin
SmartFlow conceptual product presentation showing the outdoor automated pump control cabinetCONCEPTUAL PRODUCT PRESENTATION
Figure 1: Conceptual product vision for an outdoor weatherproof pump controller enclosure.(Rendered concept — actual field prototype shown below in Section 05)

01The Problem in Leon, Iloilo

In our household in Leon, Iloilo, our daily water supply relies on a 1.5 horsepower deep-well pump that draws ground water into a 660-liter elevated storage tank. Deep-well pumps of this size are sensitive, high-current inductive equipment:

  • Dry-Run Cavitation: If the groundwater table drops during the dry season or the suction pipe draws air, the impeller spins without water lubrication. Running dry for even 2–3 minutes overheats the motor bearings and permanently burns out the windings.
  • Manual Inconvenience: Family members had to climb to check tank levels visually, manually flip breakers, and estimate when the tank was full. Forgetting to turn the pump off led to tank overflows and wasted power.
  • Off-the-shelf Switch Failures: Standard consumer Wi-Fi smart plugs use low-grade mechanical relays. Inductive arcing from switching a 1.5 HP motor welds relay contacts closed in weeks, leaving the pump continuously energized.

02Physical & Environmental Constraints

Engineering a reliable solution required addressing practical physical obstacles on the ground:

40-Meter Separation

The overhead water tank is located 40 meters away from the pump motor shed, separated by concrete exterior walls and trees. Direct 2.4 GHz Wi-Fi between the nodes was unstable, particularly during heavy tropical rainstorms and typhoon seasons.

Severe Electrical Noise (EMI)

When a 1.5 HP single-phase motor starts and stops, massive inductive voltage spikes and electromagnetic noise are generated along adjacent conduit runs. Single-ended signaling wires instantly picked up false triggers.

03System Architecture & Data Flow

To solve the distance and electrical noise challenges, I divided the system into two distinct computing nodes communicating over a physical differential bus:

SmartFlow system architecture diagram showing Tank Node, RS-485 bus, Master ESP32, switchgear protection, and Android app
Figure 2: End-to-end data flow from sensor node to master controller, contactor, and Android app.Verified System Topology

Interactive Hardware Topology Diagram

Click any subsystem node to inspect its hardware components, wiring, and safety rules.

RS-485 Differential Bus
RS-485 CAT6~40 MetersOpto Trigger220V ACBLE / Wi-FiTank Node• ESP8266 MCU• JSN-SR04T Sensor• MAX485 DriverMaster Node• ESP32 Dual Core• Flow Meter (YF-G1)• Dry-Run TimerSwitchgear• CJX2 Contactor• Thermal Overload• Optocoupler1.5 HP Pump MotorDeep-Well InductiveAndroid AppKotlin / Compose

Master Controller Node (ESP32)

Master Controller
Technical Specifications
  • ›Microcontroller: ESP32 (dual-core 240 MHz)
  • ›Telemetry input: Hardware Serial2 with MAX485 transceiver
  • ›Flow sensor: YF-G1 1-inch Hall-effect turbine meter on the discharge line
  • ›Safety inputs: Normally closed hardware emergency stop button
  • ›Actuation output: GPIO trigger to optoisolated relay driver
Fail-Safe & Safety Function

The brain of the system. Enforces local safety rules: 30-second dry-run lockout if flow meter stays under 1.0 L/min, 120-minute continuous run ceiling, and automatic sensor jitter filtering.

Engineering Rationale

Dual cores allow dedicated execution: Core 0 handles Wi-Fi, BLE, and cloud telemetry, while Core 1 handles real-time interrupt pulse counting and emergency contactor control without timing jitter.

04Hardware Components & Bill of Materials

Every component was selected to withstand the environmental humidity of an elevated water tank and the inductive inrush current of motor switching:

SmartFlow hardware components bill of materials
Figure 3: Detailed hardware specifications across controllers, sensing, switchgear, and enclosures.Component Specification

05From Prototype to Field Installation

Below is the physical control enclosure deployed at my family's residence in Leon, Iloilo. The electrical layout separates high-voltage motor switching from sensitive 3.3V/5V logic:

SmartFlow field-installed controller enclosure in Leon, Iloilo
Figure 4: Operating Field Cabinet in Leon, IloiloField Evidence

• Koten K63N C16 MCB: 2-pole 16A breaker dedicated to the low-voltage auxiliary and controller power supplies.

• CNC YC87-63N C20 MCB: 2-pole 20A main breaker isolating the 220V AC motor circuit.

• CJX2-2510 Magnetic Contactor: 25A inductive contactor preventing relay contact welding under motor start inrush.

• LR2-D13 Thermal Overload Relay: Mechanical overcurrent trip protecting motor windings against locked-rotor conditions.

• Lower Logic Tray: ESP32 DevKit V1 with optoisolated relay module, MAX485 transceiver, and RC snubber network.

06Safety Gates & Firmware Fail-Safes

The core principle of SmartFlow is that safety decisions must always happen locally in firmware, regardless of whether the home internet or cloud connection is alive:

30-Second Dry-Run Lockout

Upon starting the pump, the ESP32 samples pulses from the YF-G1 1-inch flow meter. If flow remains below 1.0 L/min for 30 consecutive seconds (DRY_RUN_TIMEOUT_MS = 30000), firmware immediately de-energizes the contactor, enters an error state, and logs a dry-run event.

5-Second RS-485 Link Loss Fail-Safe

The master controller polls the tank node over RS-485 every 1 second. If the link fails to receive valid CRC16 packets for 5 seconds (REMOTE_SENSOR_OFFLINE_MS = 5000), the pump triggers an automatic safety halt to avoid unmonitored overflow.

120-Minute Maximum Continuous Runtime

Configured as a hard ceiling (MAX_PUMP_RUNTIME_MIN = 120), this watchdog cuts motor power to protect against broken downstream pipes or stuck sensor readings.

05Current Status & Known Boundaries

Operating at One Residential Site

SmartFlow is installed inside an IP65 enclosure at my home in Leon, Iloilo. It has been operating daily under owner supervision.

• Not independently certified by third-party regulatory bodies.

• Not tested across diverse commercial installations or multi-phase power grids.

• Ultrasonic sensor readings experience minor jitter (±2 cm) during severe tropical condensation inside the tank lid.

06Lessons Learned & Future Improvements

Building SmartFlow taught me the stark difference between a clean breadboard demo on a workbench and a physical deployment that has to survive high voltages and tropical weather:

  • Secondary Mechanical Interlock: Relying exclusively on an ultrasonic sensor means condensation can occasionally cause reflection false alarms. If rebuilding today, I would wire a mechanical float switch directly in series with the contactor coil circuit as a fail-safe cutoff.
  • Custom PCB Over Protoboards: Hand-soldering point-to-point protoboard wiring inside an IP65 box took dozens of hours and increased maintenance effort. Designing a two-layer PCB with dedicated screw terminals and TVS surge diodes would significantly improve build robustness.