💧 Water Tank Chamber & Pump Physics
LEVEL: NORMAL (65%)
Water Tank Probe (GP26 / ADC0)
Depth: 65.0 %
100% (FULL)
75%
50%
25% (LOW)
0% (EMPTY)
Automated Refill System
PUMP RELAY: IDLE (OFF)
LOW
OK
FULL
🔊 BUZZER: SILENT
ADC Raw:
42597
42597
Voltage:
2.145 V
2.145 V
Relay (GP16):
LOW (0)
LOW (0)
🎛️ Interactive Tank Controls
65%
🐍 MicroPython Code Inspector
import machine, time
adc_sensor = machine.ADC(machine.Pin(26))
relay_pump = machine.Pin(16, machine.Pin.OUT)
buzzer = machine.Pin(17, machine.Pin.OUT)
LOW_THRESH = 25.0; FULL_THRESH = 85.0
pump_active = False
while True:
level = (adc_sensor.read_u16()/65535)*100
if level <= LOW_THRESH and not pump_active:
relay_pump.value(1); buzzer.value(1)
pump_active = True
elif level >= FULL_THRESH and pump_active:
relay_pump.value(0) # Pump OFF
pump_active = False
🔌 Circuit Schematic Notes
- Water Level Sensor: VCC → 3.3V, GND → GND, Signal → RP2040 GP26 (ADC0).
- Relay Module: VCC → 5V, GND → GND, IN → RP2040 GP16.
- Refill Pump Motor: Wired through Relay NO (Normally Open) contact terminal.
- Piezo Buzzer: Connected to GP17 to emit a rhythmic low-water alert pulse during pump execution.
💡 Quick Concept Check
1 Question
Which terminal configuration on an optocoupled relay ensures a water refill pump motor remains safely DE-ENERGIZED (OFF) if power to the microcontroller fails?