PyRaspBeta

Relay + heater

The relay + heater kit is a high-trigger relay module with a heater wired through its contacts, both fed from the same 5 V supply. It costs $20 and is for temperature control: the heating half of a thermostat, a greenhouse warmer, a keep-alive loop. Wire vcc to 5 V, gnd to ground and sig to a GPIO — sig high means the heater is on.

What's inside

PartQtyPrice each
Relay module1$4
Heater1$10
Total2$14
  • The relay module isolates the Pi from the load: ~72 mA energises its coil, and its contacts carry the heater's current instead of the GPIO.
  • The heater is the load; in the simulator it warms its room at the rated power while it is switched on.
Exposed pinInside the kit
vccrelay:DC+
gndrelay:DC-
sigrelay:IN

vcc feeds the relay coil and the switched loop (DC+ → COM → NO → heater+ → heater− → DC−), so it must be 5 V. sig is high-trigger: driving it above 1.8 V closes the contacts. The kit has no chain ends.

Wiring it in circuit.py

circuit.py
from wiring import *

pi = Pi()
heat = kits.RelayHeater()

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

Driving it in main.py

main.py
from gpiozero import OutputDevice
from time import sleep

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

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

Why buy the kit

Loose parts cost $4 + $10 = $14.00, against $20 — $6.00 for the coil feed, contact loop and load return assembled. That is the same premium the other relay kits charge for a safe wiring job, and it is worth more here: a heater is exactly the kind of load that must never be connected straight to a GPIO. See the relays primer for why.

Simulator vs real hardware

  • Contacts close about 10 ms and open about 5 ms after sig changes, so a control loop sees the same small lag as hardware.
  • On the board the heater is a 5 V, 100 mA stand-in; its effect on its room uses the rated power, and the room loses heat to the outdoors as it warms — a 1 kW heater raises a small room by a few degrees per hour.
  • The simulator does not model mains; the contacts are rated 10 A at 250 VAC, but on a bench keep high-voltage wiring to qualified hands.

Further reading

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