Raspberry Pi practice problem · Motors & actuators
Gentle on the pin
EasyBudget $3Python · gpiozero
A passive buzzer on GPIO18 plays a 1500 Hz tone for the first 3 s, then stops.
Its coil is only 16 Ω: straight from a 3.3 V pin it would pull far too much current. This time the test holds the pin to the strict 16 mA limit — choose a series resistor that keeps it under (Ohm's law: 3.3 V ÷ 16 mA ≈ 206 Ω in total).
gpiozero.TonalBuzzer(18, octaves=2) can play Tone(frequency=1500); RPi.GPIO.PWM(18, 1500) with a 50 % duty works too.