Skip to content

Beginning of the lesson

What you will be able to do

  • Tell an active buzzer apart from a passive buzzer, and know which one plays tunes.
  • Wire a passive buzzer to a Pico GPIO pin safely.
  • Use PWM, freq() and duty_u16() to make a single note.
  • Write a reusable play_tone(freq, duration) helper.
  • Store a melody as a list of (note, duration) pairs and play a real song.
  • Build alarm and siren effects with loops.
  • Understand why buzzers are quiet, and how a transistor makes them louder.
  • Fix the two most common problems: total silence and wrong pitch.

1. Active vs passive buzzers

There are two kinds of small buzzer, and telling them apart is the single most important thing in this lesson. If you pick the wrong one, no code in the world will play a melody.

Active buzzer

An active buzzer has its own tiny electronic circuit built inside. Give it power and it makes one fixed beep on its own. That is all it can ever do.

  • You give it: just ON or OFF (like an LED).
  • It plays: one buzz at one fixed pitch.
  • It cannot play different notes, so it cannot play a melody.
  • Often taller, sealed on top, sometimes has a sticker.

Continue this lesson on YourAIZone

The full lesson has the complete explanation, worked examples, common mistakes, tests with instant checking and an AI tutor. Start right away as a guest, or create an account to keep your progress.

In the full lesson

  • The complete explanation
  • Worked examples
  • Common mistakes and how to avoid them
  • Test questions: 15
  • AI tutor that answers questions about the topic
  • Progress tracking for students, parents and teachers