Goal: Measure a water column of 0–470 cm with an accuracy of 3 cm
Platform: Raspberry Pi Pico W · MicroPython · 2.9″ e-Paper · MPX2050DP · INA333 · MCP3426
The software side of this project – firmware, calibration, Wi-Fi server and display – is covered in the companion post: Pneumatic Water Level Sensor – Software. The full discussion thread is on mikrocontroller.net. PCB files (KiCad / Gerber) are available on request.
Unterstützen
Wenn Du uns unterstützen möchtest, ist dies hier möglich: ♥
1. Motivation
Water level monitoring is relevant in many scenarios – groundwater wells, rainwater cisterns, storage tanks. Commercial sensors are often expensive or locked into proprietary interfaces. This project shows how to build a precision measurement device from industrial semiconductor components and a microcontroller.
The sensor measures the water column in our garden well (drilled in 2010, described here) up to 4.7 m with a resolution of 2–5 cm. Data is collected automatically every hour, shown on a local e-Paper display and transmitted via Wi-Fi to a Raspberry Pi server.

2. Measurement Principle
The sensor uses the pneumatic bubbling method (also called air-purge or bubble tube method). A brass end piece is submerged at the bottom of a 4 mm PE tube, which runs down into the well alongside the pump cable and pressure hose. Before each measurement, a small 50 kPa air pump purges water from the PE tube for 3–4 seconds. Once the pump shuts off and the overpressure drops, the sensor sees exactly the hydrostatic pressure of the water column above the brass end piece.
The key advantages of this approach:
- No electronics in the well shaft. The sensor and all circuitry sit in the protected housing above ground.
- Fits in a DN150 well pipe. Our well already contains a 1″ pressure hose, a steel cable and a mains cable. There is no line of sight for ultrasonic measurement. A 4 mm PE tube fits easily.
- Long-term reliability. Only a passive tube with a brass end piece is submerged – no active components exposed to moisture.
2.1 Physics
Hydrostatic pressure: p = ρ · g · h. With water (ρ = 1000 kg/m³) and g = 9.807 m/s²: 1 cm H₂O ≈ 0.0981 kPa. A 4.7 m water column corresponds to ~46.1 kPa – within the full-scale range of the chosen sensor (50 kPa).
2.2 Measurement Sequence
Each measurement follows four steps:
- Vent (reference measurement): Valve 1 opens, releasing pressure from the PE tube between sensor and well. Atmospheric pressure reaches the sensor and is recorded as the reference. Valve 1 closes.
- Purge: Valve 2 and the pump activate simultaneously. The pump builds pressure in the PE tube for ~5 seconds, forcing air out through the brass end piece at the bottom of the well. The pump pressure must exceed the hydrostatic pressure of the water column.
- Pump off: Pump stops, Valve 2 closes. The pressure now stabilises at exactly the hydrostatic pressure of the water column above the brass end piece.
- Measurement: Multiple ADC readings are taken (32× averaged). The water level is calculated from the pressure difference between step 4 and the reference pressure from step 1.
Using the atmospheric reference in step 1 eliminates any sensor offset drift between calibrations.
2.3 Valve and Pump Wiring
- „Pump“ output: Pump + Valve 2 wired in parallel. Valve 2 isolates the pump from the sensor/well circuit when idle and during measurement, preventing pressure bleed-back through the pump.
- „Valve“ output: Valve 1 (vent to atmosphere for reference measurement).
3. Signal Chain
The complete analogue signal path consists of four stages:
- MPX2050DP: Wheatstone bridge sensor delivers a 0–40 mV differential signal at Vcc = 10 V (ratiometric). At 8.4 V Vcc this reduces to 0–33.6 mV full scale.
- R4/R5 (100 Ω each): Protection resistors against ESD and capacitive coupling at the INA333 inputs.
- INA333AIDGKR: Zero-drift instrumentation amplifier, Gain G = 38.04 (R6 = 2.7 kΩ). Amplifies the small differential signal to 0–1.28 V. The REF pin is tied to VREF = 2.516 V, so the output sits at 2.516 V at 0 kPa and rises with increasing pressure.
- MCP3426A0: 16-bit delta-sigma ADC, I²C. CH1+ is fed from the INA333 output; CH1− is connected to VREF. The ADC measures differentially – the reference voltage cancels out algebraically, and the full 16-bit range is available for the signal.
4. Critical Design Issue: INA333 Common-Mode Limit
The INA333 contains three internal op-amps. The input pre-amplifiers A1 and A2 compute internally: VA1 = VCM + (G/2) · Vdiff. On a single-supply system (0–5 V), VA1 must not exceed the supply rail (limit: ~4.92 V).
With the original 10 V sensor supply, VCM = 5.0 V – the INA333 input was saturated even at rest. Symptom: the INA333 output did not respond linearly to pressure changes.
Solution applied: A 270 Ω series resistor in the sensor Vcc line. At 6 mA sensor current this drops 1.62 V, giving Vcc_sensor ≈ 8.38 V and VCM ≈ 4.19 V. VA1 at a 4 m water column: 4.82 V – safely below the 4.92 V limit.
Note: the schematic already includes a 10 V LDO. The 270 Ω resistor was added as a retrofit between the LDO output and the sensor. The cleaner long-term fix is a 9 V LDO (R1501J090B) which eliminates the need for the resistor entirely.

5. Hardware Design
5.1 Power Supply Architecture
Special attention was paid to separating analogue and digital grounds. The bottom PCB layer is a solid ground plane. Analogue and digital sections are physically separated and share a single star-point connection at 12 V.
- Digital VBus: 12 V DC input → 5 V digital (LM2576T) → 3.3 V digital (LT1963A)
- Analogue VBus: 10 V analogue (R1501J100B LDO, sensor via 270 Ω) → 5 V analogue (MCP1703A)
- Signal path: Sensor → R4/R5 → INA333 → R7 → MCP3426
- Control: Raspberry Pi Pico W, e-Paper (SPI), pump/valve MOSFETs, push button
5.2 Gain Resistor
R6 = 2.7 kΩ gives G = 1 + 100 kΩ / 2.7 kΩ = 38.04. At Vcc_sensor = 8.38 V this results in an overall sensitivity of ~26.9 mV/kPa at the ADC inputs (99.2% of the theoretical value).
R6 must be a precision resistor: 0.1%, ≤25 ppm/K. Any deviation directly affects the calibration slope.
5.3 Shared Voltage Reference
The REF192 (2.516 V) serves double duty: it sets the INA333 REF pin and provides the ADC CH1− reference simultaneously. Because both inputs see the same source, temperature drift of the reference cancels out of the measurement entirely.
5.4 MOSFETs
Two IRLML2502 MOSFETs (SOT-23) switch pump and valves. Measured total current at 12 V: 0.06 A idle, 0.74 A with both pump and valve active. Power dissipation in each MOSFET: ~25 mW – less than 2.3% of the rated maximum. An external 12 V / 2 A laptop PSU is sufficient.
6. Actuators
The actuators were selected specifically for this project. Key requirements: 12 V DC, max 1–2 A (to keep IRLML2502 MOSFET dissipation low), small form factor, pressure-tight.
- Pump: LP27-12 (12 V, available from Pollin). Note: the pump was disassembled, all joints sealed with Loctite 542 thread sealant. This significantly improved pressure output.
- Valves (×2): Heschen 2V025-08, 12 V DC, G1/4″, 2/2-way normally closed.
- Tubing: 4 mm PE tube down to the brass end piece in the well.
- Power supply: Standard 12 V / 2 A laptop-style PSU.
7. Bill of Materials (BOM)
| Component | Part / Type | Qty | Notes |
|---|---|---|---|
| Microcontroller | Raspberry Pi Pico W | 1× | With Wi-Fi |
| Pressure sensor | MPX2050DP (NXP) | 1× | 0–50 kPa, differential |
| Instrumentation amp | INA333AIDGKR (TI) | 1× | Zero-drift, rail-to-rail |
| ADC | MCP3426A0-E/SN (Microchip) | 1× | 16-bit, I²C, 0x68 |
| Voltage reference | REF192 2.5 V (Analog Devices) | 1× | INA333 REF + ADC CH1− |
| Temperature sensor | MCP9808-E/MS (Microchip) | 1× | ±0.25°C, I²C, 0x18 |
| ⚠ LDO 10 V (sensor) | R1501J100B-T1-FE + 270 Ω | 1× | Sensor supply ~8.4 V |
| LDO 5 V analogue | MCP1703A (Microchip) | 1× | Analogue supply |
| LDO 5 V digital | LM2576T-5 (Texas Instruments) | 1× | Digital supply |
| LDO 3.3 V digital | LT1963AxST (Analog Devices) | 1× | Digital logic |
| Display | Waveshare 2.9″ e-Paper V1 | 1× | 128×296 px, SPI |
| Gain resistor R6 | 2.7 kΩ, 0.1%, ≤25 ppm/K | 1× | INA333 gain = 38 |
| Sensor series resistor | 270 Ω | 1× | Vcc reduction |
| MOSFET (pump/valve) | IRLML2502 (Infineon) | 2× | <400 mA load each |
| Flyback diode | 1N5819WS | 2× | MOSFET protection |
| Pump | LP27-12 (Daypower) | 1× | 12 V, sealed with Loctite 542 |
| Valve (×2) | Heschen 2V025-08, 12 V DC, G1/4″ | 2× | 2/2-way, normally closed |
The full BOM in HTML and CSV format is attached below. KiCad project and Gerber files available on request.
8. Technical Specifications
| Parameter | Value |
|---|---|
| Measurement range | 0–470 cm water column (0–46.1 kPa) |
| Target accuracy | ≤ 5 cm |
| Achieved max error | 2.45 cm |
| ADC resolution | 16-bit / 62.5 µV per LSB |
| Theoretical resolution | 0.03 cm per LSB |
| INA333 gain | 38.04 (R6 = 2.7 kΩ) |
| Sensor supply voltage | ~8.4 V (270 Ω series resistor) |
| INA333 VA1 at 4 m depth | 4.82 V (limit: 4.92 V) |
| ADC utilisation at 4 m | 40.8% of full scale |
| Measurement interval | 1× per hour, manually triggerable |
| Supply (idle) | 12 V / 0.06 A (0.72 W) |
| Supply (pump + valve) | 12 V / 0.74 A (8.88 W) |
9. Lessons Learned
- Check the common-mode range first. On single-supply, VCM must stay well below V+ − 0.1 V. A bridge sensor at Vcc = 10 V delivers VCM = 5 V – instant saturation on a 5 V supply. This is the number one pitfall with Wheatstone bridge sensors and single-supply instrumentation amplifiers.
- The internal pre-amps are the real limit. VA1 = VCM + (G/2) · Vdiff must stay within range across the entire pressure span, not just at zero.
- Floating inputs mislead. An unconnected INA333 input drifts in the mV range. Only with inputs shorted (pin 2 = pin 3) can you measure a clean offset.
- Temperature compensation is built in. The MPX2050DP has on-chip compensation (±1% VFSS over 0–85°C). At a 20°C temperature swing the residual error is under 0.4 cm – no software compensation needed.
- Debug the signal chain systematically. Start from the supply, verify the sensor output, then the amplifier, then the ADC. Each step confirms one defined section.
- Seal the pump. Disassembling the LP27-12 and sealing all joints with Loctite 542 gave a significant improvement in pressure output.
10. Outlook
- Replace 270 Ω + 10 V LDO with a direct 9 V LDO (R1501J090B) in a future PCB revision
- Wi-Fi data transfer to local Raspberry Pi with Flask/SQLite – see the software post
Related Posts
- Pneumatic Water Level Sensor – Software (MicroPython, calibration, Wi-Fi server)
- Garden well build guide
- DN150 stainless steel well head
- HL DSK8 pump controller repair
Unterstützen
Wir sind unabhängig schalten keine Werbung und benutzen keine Affiliation Links. Wenn Du uns unterstützen möchtest, ist dies hier möglich: ♥





