XStore

NORVI X-R8 ESP32 Pump Control with Run-Dry Interlock

Introduction #

Switching a pump on and off is easy. Protecting it is the harder part. A pump that runs dry loses its cooling and lubrication, and its seals and bearings can fail within minutes. A good controller therefore does more than close a relay: it watches the pump while it runs, stops it when something goes wrong, and keeps a record of how long it has worked.

This tutorial builds an ESP32 pump controller on the NORVI X-CPU-ESPS3-X1 with the NORVI X-R8 relay module. Relay 1 of the X-R8 switches the 230 V AC coil of a small motor contactor, and relay 2 switches a motor-ON indicator lamp that follows it. An RS485 pressure transmitter on the pump discharge pipe is read over Modbus RTU. If the pressure stays below an adjustable limit for 2 seconds while the motor is running, the pump is stopped and locked in a fault state until an operator resets it.

What you will need #

  • NORVI X-CPU-ESPS3-X1 controller and NORVI X-R8 relay module
  • 24 V DC supply (1 A or higher)
  • Motor contactor for the pump with a 230 V AC coil, an RC snubber or varistor for the coil, a small fuse or breaker for the coil circuit, and an indicator lamp
  • RS485 Modbus pressure transmitter (QDW90A-YK-1 RS485 version, gauge pressure) and a 24 V supply for it
  • Shielded twisted-pair cable for RS485, a multimeter, and a reference pressure gauge for commissioning
  • USB cable and the Arduino IDE with ESP32 board support

System Architecture #

The system is a short chain from the pressure sensor to the pump motor, with the controller in the middle making the decisions.

Signal path of the ESP32 pump controller
Figure 1: Signal path of the ESP32 pump controller

Signal flow #

Sensing. The transmitter on the discharge pipe measures gauge pressure and answers Modbus RTU requests over RS485.

Processing. The ESP32-S3 polls the sensor every 500 ms, scales and smooths the reading, and runs the state machine: STOPPED, RUNNING and FAULT.

Switching. The X1 writes to the PCA9538 I/O expander on the X-R8 over I²C (address 0x73). Relay 1 closes the contactor coil circuit and relay 2 lights the motor-ON lamp at the same moment.

Hardware and Wiring #

  1. Power off the system.
  2. Mount the X-R8 on the DIN rail beside the X-CPU and seat it on the expansion port.
  3. Set DIP 1 OFF and DIP 2 OFF for address 0x73.
  4. Wire the coil supply through COM1 and NO1 of relay 1 to coil terminal A1, and the neutral to A2.
  5. Wire the indicator lamp supply through COM2 and NO2 of relay 2.
  6. Wire the pressure transmitter: 24 V supply to its power pins, and RS485 A and B to the X1 RS485 terminals.
  7. Connect the 24 V DC supply to the X-CPU power terminals, then power up.
Wiring the 230 V AC contactor coil on relay 1, the lamp on relay 2 and the RS485 pressure transmitter
Figure 2: Wiring the 230 V AC contactor coil on relay 1, the lamp on relay 2 and the RS485 pressure transmitter

Switching a Contactor and a Lamp with Relay Outputs #

The relay switches only the low-current coil of a contactor, and the contactor’s heavy contacts carry the motor current. The motor current must not be switched directly through an X-R8 relay.

The 230 V AC coil circuit: relay 1 switches the contactor coil, the RC snubber sits across A1-A2 and relay 2 switches the lamp
Figure 3: The 230 V AC coil circuit: relay 1 switches the contactor coil, the RC snubber sits across A1/A2 and relay 2 switches the lamp

Run-Dry Protection #

While the pump runs and moves water, the discharge pressure sits at a normal value. If the water supply fails, the pressure collapses. The controller compares the filtered pressure with RUN_DRY_PRESSURE and stops the pump if the pressure stays below it.

Pump states and the events that move between them
Figure 4: Pump states and the events that move between them
#define PRESSURE_UNIT   "bar"
static const float RUN_DRY_PRESSURE = 0.50f;   // trip limit, in PRESSURE_UNIT

Arduino Code for the Pump Controller #

The full sketch (sketch.ino) is in the pump-control project, together with its README.

NORVI X-CPU-ESPS3-X1 – GitHub Resources

Explore technical files and available resources.

View on GitHub ↗
The NORVI X1 display with the pump running (pressure shown is an example reading)
Figure 5: The NORVI X1 display with the pump running (pressure shown is an example reading)

Troubleshooting #

Safety. Disconnect all power before wiring and let a qualified electrician install the system. This controller is an equipment-protection interlock and is not a safety function. Do not exceed the relay contact rating, including for the lamp.

Conclusion #

You now have a pump controller that switches a contactor through a relay on the X-R8, reads a Modbus pressure transmitter, and stops the pump with a latched fault when the pressure collapses while the motor runs. It lights a motor-ON lamp on relay 2 that always matches the contactor and the display.