PyRaspBeta

Relay + pump

The relay + pump kit is a high-trigger relay module with a water pump connected through its contacts, both powered from the same 5 V feed. It costs $18 and is for watering automatically: a plant loop that reads soil moisture and pumps when dry. Wire vcc to 5 V, gnd to ground and sig to a GPIO — sig high starts the pump.

What's inside

PartQtyPrice each
Relay module1$4
Water pump1$8
Total2$12
  • The relay module switches the pump's current from the 5 V rail; the GPIO only drives its ~2.5 mA input stage.
  • The pump is the load; in the simulator it waters the soil in its zone while running, and moisture sensors there see it.
Exposed pinInside the kit
vccrelay:DC+
gndrelay:DC-
sigrelay:IN

vcc feeds the relay coil and the switched loop (DC+ → COM → NO → pump+ → pump− → DC−), so it must be 5 V. sig is high-trigger and needs only a logic-level high from a GPIO. The kit has no chain ends.

Wiring it in circuit.py

circuit.py
from wiring import *

pi = Pi()
water = kits.RelayPump()

pi.V5 >> water.vcc       # relay coil and switched supply are both 5 V
water.gnd >> pi.GND
pi.GPIO17 >> water.sig   # high = pumping

Driving it in main.py

main.py
from gpiozero import OutputDevice
from time import sleep

pump = OutputDevice(17, active_high=True, initial_value=False)

while True:
    pump.on()
    sleep(1)
    pump.off()
    sleep(1)

Why buy the kit

Loose parts cost $4 + $8 = $12.00, against $18 — $6.00 for the four-wire switched loop done and tested. A pump is a motor, so it is exactly what must not be wired to a GPIO directly; the kit's relay is the isolation, and the relays primer explains the contacts if you want to do the wiring yourself.

Simulator vs real hardware

  • Contacts follow the input with the modelled delays (about 10 ms on, 5 ms off), so short pulses still switch the pump.
  • On the board the pump is a 5 V, 100 mA stand-in; in its zone it waters the soil, and about 10 ml raises a 1-litre pot's moisture by one percentage point, so a real control loop — read soil moisture, pump, read again — closes.
  • A relay cannot vary pump speed: on/off is all it does, and rapid PWM switching would buzz and wear the contacts.

Further reading

  • gpiozero: OutputDevice — the plain digital output used to drive a relay input, with active_high for low-trigger modules.