OpenPLC Water Reserve Control
OpenPLC Water Reserve Control
Introduction
This tutorial explains how to implement an automatic water reserve control system using a NEXTuino and OpenPLC. The system monitors water levels in a cistern and an elevated tank, controlling a pump that transfers water between them. Manual pump control via start/stop buttons is also supported.
Prerequisites
- OpenPLC software installed
- A NEXTuino (any model)
- Water level sensors: minimum level for cistern, minimum and maximum levels for the elevated tank
- Two push buttons for manual control (Start and Stop)
- Basic knowledge of ladder logic programming
Step 1: Install and Set Up OpenPLC
- Download OpenPLC from the OpenPLC official website and install it.
- Open the OpenPLC Editor.
- Configure your NEXTuino model in Settings > Device.
- Assign the correct COM port.
OpenPLC examples for NEXTuino: GitHub repository
Step 2: Configure System Inputs and Outputs
| Name | Type | Description | Pin |
|---|---|---|---|
Pool_Low_Level_Sensor | BOOL | Minimum water level in cistern | %IX0.0 |
Tank_High_Level_Sensor | BOOL | Maximum water level in tank | %IX0.1 |
Tank_Low_Level_Sensor | BOOL | Minimum water level in tank | %IX0.2 |
Automatic_Manual_Switch | BOOL | Automatic / manual mode selector | %IX0.3 |
Stop_Button | BOOL | Manual pump stop | %IX0.4 |
Start_Button | BOOL | Manual pump start | %IX0.5 |
Water_Pump | BOOL | Water pump output | %QX0.0 |
Step 3: Program the Ladder Logic
Download the OpenPLC project from GitHub:
water_control
Automatic Mode
The pump (Water_Pump) activates when:
- The cistern is above its minimum level (
Pool_Low_Level_Sensoris active) - The tank is below its minimum level (
Tank_Low_Level_Sensoris active)
The pump deactivates when:
- The tank reaches its maximum level (
Tank_High_Level_Sensoris active) - The cistern falls below its minimum level (
Pool_Low_Level_Sensoris inactive)
Manual Mode
Start_Buttonactivates the pump manuallyStop_Buttondeactivates the pump manuallyAutomatic_Manual_Switchmust be in manual mode to enable button control
Mode Switching
The Automatic_Manual_Switch toggles between automatic and manual modes. In manual mode, sensor readings do not affect pump operation.
Step 4: Connect the Hardware
- Level sensors → respective input pins (
DI0,DI1,DI2) - Mode switch →
DI3 - Stop button →
DI4 - Start button →
DI5 - Water pump →
DO0(%QX0.0)
Step 5: Test the System
- Upload the program to the NEXTuino via OpenPLC Editor.
- Test automatic mode: Ensure cistern is above minimum, lower the tank below minimum, and observe the pump activate and fill the tank to maximum.
- Test manual mode: Switch to manual mode, use the Start and Stop buttons to control the pump.
Troubleshooting
- Verify sensors and buttons are connected to the correct input pins.
- Check that variable names in OpenPLC match the physical connections.
- Use OpenPLC debugging tools to monitor input, output, and signal states.