The Control Problem
Reverse osmosis is well understood as a process: pressurize feed water through a semi-permeable membrane, collect the permeate, discharge the brine. The hydraulics are simple. The control problem is not.
Off-the-shelf RO controllers handle small, fixed installations — a few float switches, a TDS alarm, and a pump relay. For a custom skid with higher flows, multiple tanks, 4–20 mA instrumentation, and a requirement for remote monitoring, those controllers become a ceiling rather than a foundation. They cannot accept continuous pressure transmitters, cannot integrate motor winding temperature, and offer no path to remote data access.
This application note describes how the EQSP32 was used to automate a full-scale RO skid, integrating the complete sensor suite, implementing a safe operating sequence with interlock logic, and streaming live telemetry over MQTT for remote supervision.
I/O Inventory
All signals were mapped before any logic was written. The EQSP32 consolidates a sensor suite that would normally require multiple separate modules on a conventional PLC rack:
| Signal | Type | Notes |
|---|---|---|
| RO high-pressure pump | Relay out | Main pump enable |
| Well tank inlet valve | Relay out | Solenoid, normally closed |
| Flush valve | Relay out | Low-pressure membrane rinse, normally closed |
| Pump inlet pressure | Analog in (4–20 mA) | Pre-membrane pressure transmitter |
| Pump outlet pressure | Analog in (4–20 mA) | Post-pump pressure transmitter |
| Well tank level | Analog in (4–20 mA) | Hydrostatic depth transmitter |
| Clean water tank level | Analog in (4–20 mA) | Hydrostatic depth transmitter |
| Feed TDS | Analog in (0–5 V) | Conductivity probe, feed line |
| Permeate TDS | Analog in (0–5 V) | Conductivity probe, permeate line |
| Feed flow meter | Digital in | Hall-effect pulse, feed line |
| Permeate flow meter | Digital in | Hall-effect pulse, permeate line |
| Motor winding temperature | Temp (NTC) | Embedded thermistor in pump motor |
| Water temperature | Temp (NTC) | Feed water temperature |
No external modules required. 4–20 mA current inputs, 0–5 V analog inputs, NTC thermistor channels, and pulse-counting digital inputs are all native to the EQSP32. A conventional PLC would require separate analog expansion cards for this sensor mix, adding panel space, wiring complexity, and cost.
Hydraulic Flow Path
Water is drawn from the well tank, passes through a pre-filtration stage (sediment and carbon cartridges), and is pressurized by the high-pressure pump before reaching the RO membrane. The membrane splits the flow: permeate collects in the clean water tank, brine discharges through a flow restrictor back toward the well tank.
The well water in this installation is regularly replenished from the source and is used for other purposes in parallel, so brine return does not meaningfully concentrate the feed water over time. Feed TDS is monitored continuously and would trigger an alert if it rose outside the expected range.
Wiring and Electrical Integration
The EQSP32 is mounted on DIN rail and powered from a 24 V DC supply fed by the panel mains. All sensor and actuator wiring terminates at the controller terminals. The 4–20 mA transmitters are loop-powered from the 24 V rail; the TDS probes use the EQSP32's 5 V output for excitation; the NTC thermistors connect directly to the dedicated temperature input channels.
Operating Sequence
The firmware implements a structured state machine. Each state has defined entry conditions and exit conditions. No transition executes unless all prerequisites are satisfied.
| State | Outputs | Exit condition |
|---|---|---|
| Idle | All off | Scheduled start time reached AND well level above minimum AND clean tank below full |
| Pre-fill | Inlet valve open | Inlet pressure rises above pre-charge threshold within timeout; fault if not |
| Run | Inlet valve open, pump on | Clean tank reaches full level OR scheduled duration elapsed OR any interlock trips |
| Flush | Pump off, inlet valve open, flush valve open | Flush timer complete (configurable, typically 5 min) |
| Shutdown | All valves closed, pump off | Automatic; returns to Idle |
| Fault | All outputs off, alarm published via MQTT | Manual reset required after fault condition cleared |
Flush sequence
At the end of every production run, before the pump stops, the flush valve opens. With the pump off and the inlet valve still open, low-pressure water flows across the membrane surface, sweeping accumulated salt and scale deposits toward the brine discharge. Running this flush at low pressure rather than high pressure reduces the risk of forcing deposits deeper into the membrane structure. Duration is configurable in firmware; the default is five minutes.
Why flush matters. Skipping the post-cycle flush allows salt concentration at the membrane surface to crystallize during the idle period. Over time this reduces membrane permeability and recovery ratio, and can cause irreversible fouling. The automated flush adds no manual steps for the operator.
Safety Interlocks
Three independent interlock conditions will immediately stop the pump and transition the system to Fault state, logging the event and publishing an MQTT alert:
- Well tank low level: if the well depth transmitter reads below the configured minimum, the pump stops to prevent dry-running. The inlet valve also closes. The system will not restart automatically until the well level recovers above the minimum threshold.
- Motor winding overtemperature: if the NTC thermistor in the pump motor winding exceeds 85 °C, the pump is stopped immediately. This protects the motor insulation against thermal damage caused by sustained overload or failed cooling. The fault requires manual reset to prevent unattended restart into a damaged motor.
- No pressure after startup: if the pump starts but pressure does not build to the expected level within a configurable startup window (typically 10–15 seconds), the pump is stopped. This catches a blocked inlet, a failed pump impeller, or a closed upstream valve before they cause extended dry-running.
All interlocks log to MQTT. Each fault event is timestamped and published with the fault condition and the sensor reading that triggered it. Remote operators can diagnose the cause before dispatching a technician.
Flow Monitoring and Recovery Ratio
Hall-effect flow meters on both the feed line and the permeate line give the controller real-time data on water throughput. The EQSP32 measures pulse frequency on each meter and converts it to volumetric flow rate using each meter's calibration constant.
From these two values the firmware calculates the recovery ratio continuously:
Recovery = Permeate flow / Feed flow × 100%
A significant drop in recovery ratio at constant operating pressure indicates membrane fouling or a feed-side restriction. A rise above the design point may indicate a membrane integrity issue. Both conditions are flagged as alerts and visible in the remote dashboard. Daily and lifetime permeate production totals are accumulated and published for reporting.
TDS Monitoring and Water Quality
Inline conductivity probes on both the feed and permeate lines provide continuous TDS readings as 0–5 V analog signals. The controller reads both channels, converts the voltages to TDS values using sensor-specific calibration factors, and publishes them over MQTT.
The rejection ratio — the percentage of dissolved solids blocked by the membrane — is calculated from the two readings and tracked over time. A declining rejection ratio is an early indicator of membrane degradation and gives the operator lead time to schedule maintenance before water quality is compromised. Noisy sensor readings are smoothed using a rolling average in firmware before display or alarm evaluation.
Scheduling and Remote Operation
The EQSP32 synchronizes its real-time clock with an NTP server at startup. Production cycles run on a programmed schedule — start time, maximum duration, and days of the week are all configurable without reflashing firmware. The clean tank full condition overrides the timer: if the tank fills before the scheduled duration elapses, the system moves to the flush sequence and shuts down early. If the tank is already full at the scheduled start time, the cycle is skipped entirely.
In addition to scheduled automatic mode, the operator can trigger a manual production run or a standalone flush via the remote dashboard, useful for maintenance and commissioning.
MQTT Telemetry and Remote Dashboard
The EQSP32 publishes the full sensor dataset to an MQTT broker at a configurable interval. All key process values are available as individual topics:
- Inlet and outlet pressure (bar)
- Well and clean tank levels (cm / %)
- Feed and permeate flow rates and daily totals (L/h, L/day)
- Feed and permeate TDS (ppm)
- Recovery ratio (%)
- Motor winding temperature and water temperature (°C)
- System state (Idle, Run, Flush, Fault) and active alarm flags
- Uptime and Wi-Fi signal strength
Broker options: the EQSP32 connects to any standards-compliant MQTT broker. Managed cloud brokers (HiveMQ Cloud, EMQX Cloud, AWS IoT Core) provide TLS-secured access with no infrastructure to maintain. For installations where data must remain on-premises, a local Mosquitto broker on a small Linux server or NUC is equally supported. The firmware configuration is identical in either case.
Why EQSP32 for This Application
Native 4–20 mA inputs
Pressure transmitters and depth transmitters connect directly without external analog input modules or signal converters.
NTC thermistor channels
Motor winding temperature connects directly to a dedicated temperature input. No transmitter or signal conditioner required.
Dual hardware pulse counters
Feed and permeate flow meters each connect to a dedicated hardware pulse counter peripheral, capturing signals accurately from a few Hz to several hundred Hz regardless of firmware execution timing. No missed pulses, no external counter hardware.
Native MQTT client
Built-in MQTT stack with TLS support connects to any standards-compliant broker without external libraries or gateways.
Programmable logic
Flush timing, interlock thresholds, scheduling parameters, and alert limits are all configurable in firmware, not in hardware jumpers.
Single DIN-rail device
Replaces separate relay boards, analog input modules, data loggers, and communication modules. All functions in one compact housing.
Ready to design your RO control system?
EQSP32 datasheet, I/O reference, MQTT integration guide, and application source code available.
View the EQSP32