Skip to content
OnlyProjects
B.Tech / B.E. · Instrumentation & ControlFor educational purposes only
Code included

Coupled-Tank PID Level-Control Trainer with Logged Step Response

Two acrylic tanks, one pump and a tuned PID loop — build the classic level-control problem on a bench and log every step response

Mapped to your syllabusVTU 2022 Scheme (OBE/CBCS) · BXX685 (BEI685 / BME685 / BCV685) Major Project Phase-I · Semester 6

Overview

1 min read

Coupled-Tank PID Level-Control Trainer is a benchtop process-control rig that reproduces the classic liquid-level problem every instrumentation and control engineer meets in industry: keep the level in a tank at its setpoint while the outflow keeps changing. Two clear acrylic tanks are coupled in series — a 12 V booster pump fills the upper tank, water gravity-feeds through a manually adjustable valve into the lower tank, and an ultrasonic sensor measures the lower-tank level. An ESP32 runs a discrete PID loop at 1 Hz, drives the pump through a MOSFET with PWM, and streams time-stamped level and duty readings over serial.

The hardware is only half the project. A companion Python toolchain logs every run to CSV, fits a first-order-plus-dead-time (FOPDT) model from open-loop step tests, and compares Ziegler-Nichols settings against a manually tuned loop using rise time, overshoot, settling time and integral absolute error. A small Flask dashboard shows the live loop so demonstrations do not need a serial terminal.

Commercial level-control trainers used in control labs cost ₹60,000–₹1,50,000, which is why most students only ever see this problem inside a simulator. This rig recreates the same learning — sensor calibration, process lag, valve-induced disturbances, integral windup, tuning trade-offs — with real sensor noise and real hydraulics, for under ₹4,000. It is a viva-defensible Instrumentation & Control project: every design decision, from sampling rate to anti-windup clamping, can be justified from logged data.

Relevant for
Karnataka
Level
Intermediate · 14 weeks · team of 4
Common at
Visvesvaraya Technological University, Anna University, Chennai, Jawaharlal Nehru Technological University Hyderabad
Updated
Nov 2026

Syllabus alignment

VTU · 2022 Scheme (OBE/CBCS)

BXX685 (BEI685 / BME685 / BCV685) · Major Project Phase-I · Semester 6 · 2 credits · CIE 100

Subjects this project applies
  • C programming and Arduino framework — ESP32 closed-loop firmware and logging protocol
  • MATLAB / Scilab — process model identification and PID simulation
  • Python (NumPy, Matplotlib) — step-response analysis and tuning-metric plots
  • Control Systems — discrete PID, anti-windup and closed-loop stability
  • Sensors & Transducers — ultrasonic level measurement and calibration
How it is evaluated

Team: individual or group ≤ 4, single- or multi-disciplinary

report : presentation : Q&A = 50 : 25 : 25; same report marks for all batch-mates

Also fits: Anna University Regulation 2021, JNTUH R22.

What's in the box

11 parts · 5 free · 2 previewed · 4 unlock for ₹2,000

Problem & synopsis

5 min read

Problem statement

Loop tuning is the core skill of an instrumentation engineer, but students almost never practise it on real hardware: commercial coupled-tank trainers are too expensive for a college to give every batch repeated tuning time, and simulators hide the measurement noise, actuator non-linearity and dead time that make industrial loops hard. As a result, Ziegler-Nichols formulas are memorised without evidence, and the trade-off between overshoot and settling time is never actually observed.

There is a need for an affordable, open coupled-tank level-control rig with logged data that a four-member student team can build for under ₹4,000, calibrate against a steel-rule reference, and use to (a) identify a first-order-plus-dead-time model from step tests, (b) implement a discrete PID loop with anti-windup, and (c) compare tuning rules with quantitative closed-loop metrics — producing a repeatable lab trainer and a data-backed report instead of a guesswork demo.

Synopsis

Abstract

Level loops are the workhorse of process industries — boiler drum level, distillation column sumps, storage tanks and effluent plants all depend on them. Yet loop tuning is usually taught from slides or pure simulation, because commercial coupled-tank trainers are too expensive for a student budget. This project builds a low-cost coupled-tank trainer and uses it to run a proper tuning study: open-loop identification, PID design, closed-loop verification, all backed by logged data.

Introduction

In a series coupled-tank system the pump drives the upper tank, whose outflow is the inflow of the lower tank — so the process is second-order with interaction, exactly like scaled-down versions of plant level cascades. The controller must hold the lower-tank level at setpoint while the manual valve (the load) changes. This is the benchmark problem used in textbooks such as Åström and Hägglund's PID Controllers: Theory, Design, and Tuning, and it exercises every part of an instrumentation syllabus: transducers, signal conditioning, actuators, digital control and data recording.

Existing System

  • Commercial trainers (two-tank and three-tank rigs) cost from ₹60,000 upward, beyond individual student budgets.
  • Pure simulations (Simulink / Scilab Xcos models) hide real effects: ultrasonic echo noise, pump non-linearity at low duty, dead time from the pipe run, quantisation and drop-outs.
  • College labs often let students observe a tuned loop but rarely let them tune one repeatedly and compare tuning rules on the same plant.
  • Limitations of current practice: no ownership of the loop, no logged evidence, tuning learned as formulas rather than measured trade-offs.

Proposed System

  • A ₹3,500–₹4,000 benchtop rig: two 1.5 L acrylic tanks, 12 V booster pump, MOSFET PWM drive, manual load valve, HC-SR04 ultrasonic level sensor in a stilling tube, ESP32 controller.
  • Discrete PID firmware in C at 1 Hz sampling (tank time constants are in minutes, so 1 s is comfortably fast), with derivative-on-measurement and integral clamping.
  • Logging protocol: every second the ESP32 prints timestamp, setpoint, filtered level and pump duty; a Python script captures sessions to CSV.
  • Identification and tuning study: open-loop step tests at three pump duties → FOPDT model fit in Scilab → Ziegler-Nichols vs manual tuning → closed-loop metrics (overshoot, settling time, IAE) compared in plots and tables.
  • A Flask dashboard for live display and a documented test matrix so the study is repeatable by next year's batch.

Feasibility Study

  • Technical: all parts are hobby-grade and documented; the control mathematics is second-year material; risks (echo scatter, siphoning) are handled with a stilling tube and a break-slot between tanks.
  • Economic: the BOM is ₹3,500–₹4,000 including the pump, PSU and acrylic; no licence costs — Arduino IDE, Python and Scilab are free.
  • Operational: the rig runs on a single 12 V 2 A adapter with water only — safe for a hostel-table demo; a 15-minute calibration sheet makes it usable by non-builders.

Objectives

  1. 01Design and build a two-tank coupled liquid-level process rig with pump, PWM drive, load valve and ultrasonic level sensing for under ₹4,000.
  2. 02Calibrate the ultrasonic sensor against a steel-ruler scale and characterise its error and repeatability across the working range.
  3. 03Implement a 1 Hz discrete PID controller in C on ESP32 with derivative-on-measurement and integral anti-windup clamping.
  4. 04Log setpoint, filtered level and pump duty at 1 Hz to CSV through a documented serial protocol.
  5. 05Identify a first-order-plus-dead-time model (K, τ, θ) from open-loop step tests at three pump duties.
  6. 06Compare Ziegler-Nichols and manually tuned settings on rise time, overshoot, settling time and IAE, and recommend a final setting.
  7. 07Validate the loop with setpoint-tracking and load-disturbance tests and package the rig as a documented lab trainer.

Scope

In scope

  • Series coupled two-tank system, one control loop (lower-tank level), one manipulated variable (pump PWM duty).
  • Ultrasonic level sensing with stilling tube; software median filtering.
  • Discrete PID firmware (1 Hz), serial logging, CSV analysis, FOPDT identification, Ziegler-Nichols vs manual tuning comparison, Flask live dashboard.
  • Setpoint-tracking and load-disturbance validation tests.

Out of scope

  • Industrial 4–20 mA transmitters and intrinsic-safety design (a current-loop output stage is listed in future scope).
  • Cascade (level–flow) and multi-loop MIMO control; PLC/SCADA integration.
  • Temperature, density or conductivity control; heated or pressurised vessels.
  • Long-term reliability study (weeks of continuous operation).

Methodology

The project follows an iterative build-and-test methodology — each phase ends with a measured result that the next phase consumes, which suits a control rig where nothing can be tuned before the plant exists and is calibrated.

PhaseWeeksActivitiesDeliverable
1. Requirements & hydraulic design1–2Tank sizing from pump curve, stilling-tube design, electrical schematic, BOM costingDesign document + Phase-I synopsis
2. Rig build & calibration3–4Fabricate tanks and mounts, wire pump/MOSFET/sensor, 10-point sensor calibration against steel rule, error budgetCalibration sheet and curves
3. Open-loop identification5–6Step tests at 3 duties, data cleaning, FOPDT fit (two-point method) in Scilab, model validationModel (K, τ, θ) with R²
4. Controller firmware7–81 Hz PID task, derivative-on-measurement, anti-windup clamp, serial protocol, watchdogFirmware v1.0 + unit checks
5. Tuning study9–11Ziegler-Nichols (open-loop rules) vs manual tuning; repeated runs for repeatabilityTuning comparison tables and plots
6. Validation & documentation12–14Setpoint tracking (±20 % steps), load disturbance (valve change), Flask dashboard, report and demo scriptFinal report, demo, lab-manual sheet

Testing approach: calibration is checked by re-running the 10-point scale twice (repeatability ≤ 2 mm); the FOPDT model must predict an independent step test within ±10 %; every closed-loop configuration is run three times and reported as mean ± spread; safety checks (leak test, MOSFET temperature after 30 min) are logged in the test matrix.

Architecture & tech stack

1 diagram · 4 technologies · 2 min read

  • C (Arduino framework on ESP32) — PID loop firmware, PWM pump drive and serial logging
  • Python (NumPy, pandas, Matplotlib) — step-response analysis and tuning comparisons
  • MATLAB / Scilab — first-order-plus-dead-time model fitting and loop simulation
  • Flask — lightweight loop-monitor dashboard (industry-standard extra)

The system is a classic single-loop feedback architecture with a digital controller and a serial data path.

  1. Process — two series tanks; the pump is the manipulated variable, the manual valve is the load, the lower-tank level is the controlled variable.
  2. Controller (ESP32, C) — a timer-driven 1 Hz task reads the HC-SR04 echo (median of 5 pings for noise rejection), computes the PID term with derivative-on-measurement, clamps the integral when the PWM output saturates, and outputs a 0–100 % duty at ~1 kHz PWM through a logic-level MOSFET.
  3. Data path — each cycle the ESP32 emits one CSV line (millis, setpoint, level_cm, duty) over USB serial; a Python logger captures sessions to disk for the analysis toolchain.
  4. Analysis tier (PC, Python/Scilab) — offline scripts clean the logs, fit the FOPDT model, compute tuning rules and closed-loop metrics, and render the comparison plots used in the report.
  5. Dashboard tier (Flask) — reads the live serial stream and renders level vs setpoint in the browser for demos.
flowchart LR
  SP["Setpoint: lower-tank level (cm)"] -->|"error e(k)"| PID["PID task on ESP32<br/>Kp, Ki, Kd + anti-windup"]
  PID -->|"PWM duty 0-100 %"| DRV["Logic-level MOSFET driver"]
  DRV --> PMP["12 V booster pump"]
  PMP --> T1["Upper acrylic tank"]
  T1 -->|"gravity outflow"| VL["Manual load valve (disturbance)"]
  VL --> T2["Lower acrylic tank"]
  T2 --> US["HC-SR04 in stilling tube"]
  US -->|"echo time"| FILT["Median-of-5 filter"]
  FILT --> PID
  FILT -->|"CSV at 1 Hz"| LOG["Python serial logger"]
  LOG --> ANA["Scilab FOPDT fit + Matplotlib metrics"]
  LOG --> DASH["Flask live dashboard"]

The sampling choice is deliberate: identified tank time constants are 2–6 minutes, so a 1 Hz loop is about 100× faster than the process, keeping the discrete PID essentially equivalent to its continuous form while leaving USB bandwidth free for logging. All actuator authority sits on the pump side, so the valve stays purely as a disturbance generator — this keeps the loop single-input single-output and the study clean.

Modules

5 modules

  1. Module 01

    Process Rig & Hydraulics

    Designs and fabricates the two 1.5 L acrylic tanks with inter-tank coupling, stilling tube, base plate and splash guard; selects the pump from its flow-head curve; installs the manual load valve and break-slot to prevent siphoning; leak-tests and dimensionally verifies the rig before any electronics are connected.

  2. Module 02

    Level Sensing & Calibration

    Mounts the HC-SR04 over the lower tank, designs the stilling tube to kill surface waves and foam echoes, and runs a 10-point calibration against a steel ruler; reports offset, gain, non-linearity and repeatability, implements the median-of-5 software filter and quantifies residual noise in the measurement.

  3. Module 03

    PID Firmware & Logging Protocol

    Implements the 1 Hz discrete PID task in C on ESP32 with derivative-on-measurement, integral clamping on PWM saturation and a watchdog; defines the one-line CSV serial protocol (millis, setpoint, level_cm, duty), adds live setpoint entry over serial, and unit-checks the controller against a simulated plant before water is run.

  4. Module 04

    Identification & Tuning Study

    Runs open-loop step tests at three pump duties, cleans the logs, fits the first-order-plus-dead-time model using the two-point method in Scilab, computes Ziegler-Nichols settings, executes the closed-loop test matrix (three repetitions per configuration) and compares rise time, overshoot, settling time and IAE in the final recommendation.

  5. Module 05

    Dashboard, Validation & Documentation

    Builds the Flask dashboard that plots level vs setpoint live, executes the setpoint-tracking and load-disturbance validation tests, compiles the test-case matrix with pass/fail evidence, writes the calibration and operating sheets that turn the rig into a reusable lab trainer, and assembles the Phase-II report chapter.

Slides

11 slides · titles free · bullets, notes and the .pptx unlock

  1. Slide 1

    Coupled-Tank PID Level-Control Trainer

  2. Slide 2

    Why Level Control?

  3. Slide 3

    Problem Statement

  4. Slide 4

    Objectives

  5. Slide 5

    System Architecture

  6. Slide 6

    Hardware Build

  7. Slide 7

    Sensing & Calibration

  8. Slide 8

    Identification & Firmware

  9. Slide 9

    Tuning Study & Results

  10. Slide 10

    Testing & Validation

  11. Slide 11

    Conclusion & Future Scope

Bullets, speaker notes and the .pptx · ₹2,000

The titles above are the real outline. The rest is what you present from.

Unlock for ₹2,000

Viva questions & answers

3 of 15 answered free · 12 unlock

Read each answer, close it, and say it in your own words. Your viva will ask. Now you'll know.

  1. 01Concept

    Why does a coupled-tank system behave differently from a single-tank level process?

    In a single tank the level responds roughly first-order to pump flow, but in our series coupled tanks the outflow of the first tank is the inflow of the second, so the process is interacting and second-order. The time constant of the second tank depends on the first tank's dynamics, which produces slower response and more phase lag — exactly why it is a good benchmark for studying controller tuning.

  2. 02Concept

    Why did you choose a 1 Hz sampling rate for the PID loop?

    Our identified tank time constants were between two and six minutes, so a 1 Hz loop is more than a hundred times faster than the process. At that ratio the discrete PID is essentially equivalent to the continuous controller, yet it leaves plenty of serial bandwidth for logging, and it keeps CPU load trivial on the ESP32.

  3. 03Concept

    What is integral windup and how did you handle it?

    When the pump saturates at 100 percent duty during a large level error, the integral term keeps accumulating an error it cannot act on, so when the level finally reaches setpoint the controller overshoots badly. We clamp the integral whenever the PWM output is saturated and the error would push it further, which is the standard conditional-integration anti-windup approach.

+12 more questions, with answers

Try the free ones out loud first. Your examiner will not accept “it's in the PPT”.

Source code & how to run

7 steps · complete source code · unlocks with the project

Unlocks with the project · ₹2,000

7 steps · source code zip

Prerequisites, install, seed data and tests, written for demo day. Plus the complete source.

Unlock for ₹2,000

READMEFIRST

268 words · unlocks with the project

What to change before it goes anywhere near a submission. Skipping it is how the demo fails live.

Unlocks with the project · ₹2,000

268 words · ~1 min read

The checklist of things to rename, re-seed and re-think so the project reads as yours.

Unlock for ₹2,000

Instructions

343 words · unlocks with the project

How to study it, adapt it and walk your examiner through it, step by step.

Unlocks with the project · ₹2,000

343 words · ~2 min read

Report structure, formatting rules and the submission checklist your department will grade.

Unlock for ₹2,000

References

6 sources

  1. K. J. Åström and T. Hägglund, PID Controllers: Theory, Design, and Tuning, 2nd ed., ISA — The Instrumentation, Systems, and Automation Society
  2. Gene F. Franklin, J. David Powell and Abbas Emami-Naeini, Feedback Control of Dynamic Systems, 8th ed., Pearson
  3. Control Tutorials for MATLAB and Simulink — Introduction: PID Controller Design (University of Michigan)
  4. Espressif — Arduino Core for ESP32 Documentation
  5. Arduino Playground — PID Library (Brett Beauregard)
  6. NumPy and Matplotlib — Python scientific computing documentation

Cite this bundle

OnlyProjects. (2026). Coupled-Tank PID Level-Control Trainer with Logged Step Response: B.Tech / B.E. Instrumentation & Control project bundle [Educational resource]. https://onlyprojects.online/projects/btech-ic-coupled-tank-pid-level-control-trainer

Future scope

1 min read

  • 4–20 mA current-loop output stage (XTR-style transmitter) so the rig can drive or mimic industrial transmitters and be read by a real SCADA client.
  • Relay (Åström-Hägglund) auto-tuning as a firmware mode, comparing its settings against the manual study.
  • Cascade level–flow control by adding a flow sensor and a second valve, moving from SISO to the cascade structure used on boiler drums.
  • MQTT and SCADA-lite — publish readings to a broker and add historical trends and alarms.
  • Second pump as an independent disturbance generator for cleaner load-step experiments.
  • A printed lab-manual sheet so junior batches can run the tuning exercise in one 3-hour session.

Keep browsing

Same degree, same syllabus slot, different idea. Pick the one your guide will actually approve.

B.Tech / B.E.Code included

Aerospace / Aeronautical

Low-Speed Open-Circuit Wind Tunnel with Force Balance for Aerofoil Lift-Drag Measurement

Build a subsonic test tunnel on a student budget, then trace lift and drag on a 3D-printed NACA 0012 against theory

  • C / Arduino Uno (industry-standard extra) — HX711 load-cell and serial logging firmware
  • Python (NumPy, Matplotlib) — calibration, force coefficients and plots
  • MATLAB / Scilab — thin-airfoil theory overlay and regression
  • +4

intermediate14 wk4 students