Switches & motion

Buzzer & speaker

Turn an electrical signal into sound. A speaker moves a paper cone with a coil and a magnet; a piezo buzzer bends a ceramic disc. Either way, the frequency of the signal sets the pitch.

Pins

Speaker
: Two terminals, polarity matters only for keeping several speakers in step.
Buzzer +
: The longer leg or the one marked +. "Active" buzzers make their own tone from DC; "passive" ones need a square wave.

Piezo buzzers are flat black discs; small speakers are 8 Ω cones from 20 mm upwards.

What to look for inside

  • An AC signal drives the speaker coil.
  • Current in the coil makes it an electromagnet. It is pushed out and pulled back against the fixed magnet as the current reverses.
  • The cone is glued to the coil, so it pushes the air in and out, sending pressure waves (sound) outward. Faster swings mean a higher pitch.

The numbers that matter

SpecTypical
Impedance (speaker)
Far too low for a GPIO pin: it needs an amplifier.
4 Ω · 8 Ω
Rated power
More makes it louder until it distorts or burns.
0.25 W to 3 W (small)
Resonant frequency (piezo)
Piezos are loudest at their resonance.
2 kHz to 4 kHz
Active / passive (buzzer)
Active: apply DC and it beeps. Passive: drive it with PWM to choose the note.
—

Where you’ll use it

  • Beeps, alarms and simple tunes (PWM from a microcontroller).
  • Audio output through an amplifier.

Common mistakes

  • Connecting a speaker straight to a pin. 8 Ω draws far too much current.
  • Giving a passive buzzer DC and wondering why it only clicks once.

Lessons that use it

Lesson 4.3’s PWM mode makes exactly the kind of square wave that drives a passive buzzer.

Go deeper

fnote=fPWMf_{note} = f_{PWM}

For a passive buzzer, the PWM frequency is the pitch you hear (duty ≈ 50 %).

Read next

All components · All lessons · Glossary