Skip to main content

Wiring & Schematics

System diagram

Edit this project interactively in Cirkit Designer.

The controller is a development board with:


Pinout

FunctionRaspberry Pi Pico PinNotes
Soil sensor analog OUTGPIO26 (ADC
Analog-to-Digital Converter - converts analog voltages into digital values that microcontrollers can read.
)
Higher reading = drier soil
Valve PWM (MOSFET gate)GPIO0Logic-level PWM
Pulse Width Modulation - controls average power by switching rapidly. The duty cycle determines the effective output.
(3.3 V)
RGB LED dataGPIO25On-board LED
A light-emitting diode used frequently as a status indicator in electronic devices.
LED
5 V inputUSB VBUSWall USB power supply only
GroundGND
Ground - the common electrical reference point in a circuit.
Common reference for sensor, valve and controller

Typical wiring

Soil moisture sensor

  • VCC → 3.3 V or 5 V (according to sensor rating)
  • GND → GND
  • OUT → GPIO0 (ADC
    Analog-to-Digital Converter - converts analog voltages into digital values that microcontrollers can read.
    )

The firmware assumes higher ADC

Analog-to-Digital Converter - converts analog voltages into digital values that microcontrollers can read.
value = drier soil for this sensor type.

Valve / pump via MOSFET
Metal-Oxide-Semiconductor Field-Effect Transistor - an electronic power switch. Logic-level MOSFETs can be driven directly from GPIO pins.

  • Valve or pump positive → 5-12 V supply (directly or from a DC
    Direct Current - electric current flowing in one direction, common in batteries and embedded devices.
    -DC
    Direct Current - electric current flowing in one direction, common in batteries and embedded devices.
    step-up module)
  • Valve or pump negativeMOSFET
    Metal-Oxide-Semiconductor Field-Effect Transistor - an electronic power switch. Logic-level MOSFETs can be driven directly from GPIO pins.
    drain
  • MOSFET
    Metal-Oxide-Semiconductor Field-Effect Transistor - an electronic power switch. Logic-level MOSFETs can be driven directly from GPIO pins.
    source → GND
  • MOSFET
    Metal-Oxide-Semiconductor Field-Effect Transistor - an electronic power switch. Logic-level MOSFETs can be driven directly from GPIO pins.
    gate → GPIO0 (optional 100-220 Ω series resistor in the gate line)

If the load is inductive (pump, solenoid valve), add a Flyback Diode

A diode placed across inductive loads like valves or pumps to absorb voltage spikes when current is interrupted.
(e.g. 1N5819) across the load, with the diode's band towards the positive side.

Power topology


Safety notes

⚠️ Use only a wall USB power supply Do not power this project from a PC, laptop, TV, or monitor USB port. The valve or pump can draw more current than those ports are designed for.

💧 Keep electronics above water The tank and plumbing can eventually leak. Place the electronics box higher than the maximum water level and route cables with drip loops where practical.

Protective components Always use a Flyback Diode

A diode placed across inductive loads like valves or pumps to absorb voltage spikes when current is interrupted.
on inductive loads and consider adding a fuse on the valve/pump supply line for extra safety.