Raspberry Pi practice problem · Motors & actuators
Heat in rhythm
MediumBudget $25Python · gpiozero
A relay can't dim a heater — but a heater is slow, so switching it on for part of every few seconds sets its average power. That's time-proportioning, PWM slowed down to suit a relay.
Use the relay + heater kit with its input on GPIO17 (VCC to 5 V, GND to ground). Work in 2.5 s cycles, each starting with the heater on:
- for the first 3 cycles (0–7.5 s): 40 % power — on 1 s, off 1.5 s;
- then (from 7.5 s) 80 % power — on 2 s, off 0.5 s.
The test measures the cycle length and the fraction of time the heater is on in each phase.