ðą Real-Time Soil Evaporation & 25% Cooldown Hysteresis
When soil moisture drops below $25\%$, the RP2040 relay triggers the $5\text{V}$ pump. Once it re-hydrates to $25\%$, the relay turns OFF and enforces a **10-second lockout delay** to prevent relay jittering[cite: 1]!
ðŠī Soil Bed, Relay Terminals & Submersible DC Motor
âģ COOLDOWN LOCKOUT: 10.0s
Moisture: 30.0% (Soil Adequate)
ðïļ Dynamic Evaporation & 10s Cooldown Controls
30.0 %
0% (Bone Dry / 3.0V)
25% (Trigger & Stop Point)
100% (Saturated / 1.2V)
ð Inverse Capacitive Signal Physics
3.0V = Dry âĒ 1.2V = Wet
Capacitive soil sensors output an INVERSE analog voltage: higher soil water permittivity lowers capacitance impedance, producing a lower output voltage!
1. Sensor Output Voltage ($V_{out}$):
$V_{out} = 3.0\text{V} - (\text{Moisture} \times 1.8\text{V}) =$ 2.46 V
2. RP2040 12-Bit ADC & 16-Bit Register:
ADC_12bit = 3058 | duty_u16 = 48935
3. Relay Contact & Cooldown Status:
Relay = OPEN | DC Motor = IDLE
ð MicroPython Hysteresis Controller
RP2040 Executing
import machine, time
soil_adc = machine.ADC(machine.Pin(26))
relay = machine.Pin(16, machine.Pin.OUT)
cooldown_until = 0 # Lockout timestamp
while True:
raw = soil_adc.read_u16() # 48935
now = time.time()
if moisture < 25.0 and now >= cooldown_until:
relay.value(1) # Relay ON -> Pump Active
elif moisture >= 25.0 and relay.value() == 1:
relay.value(0) # Relay OFF at 25%
cooldown_until = now + 10 # 10s Lockout
time.sleep(1)
ð Soil Moisture & Relay Logic Quiz
Why does a capacitive soil sensor's analog voltage DECREASE as the soil becomes wetter?