30 Days Lost in Space → Help Center

Components

Passive Buzzer

Want your HERO board to make noise? A passive buzzer turns electrical pulses into sound, and you control the pitch by changing the frequency.

What is a Passive Buzzer?

A passive buzzer contains a piezoelectric disc — a crystal wafer that physically flexes when voltage is applied. Feed it a square wave and it flexes back and forth at that frequency, pushing air, making sound. Change the frequency, change the pitch. That's the whole instrument.

"Passive" means it has no oscillator of its own: you generate the tone. That's more work than an active buzzer's fixed beep, but it means you can play any note, siren, or melody.

Passive vs Active

| Feature | Passive Buzzer (yours) | Active Buzzer | |---------|------------------------|---------------| | Sound control | Any frequency you want | One fixed tone | | Signal needed | Square wave (tone()) | Just HIGH/LOW | | Given steady DC | A single faint click | Continuous beep |

That last row is the field test: if it beeps on plain digitalWrite(pin, HIGH), it's active. Yours clicks once — passive.

The tone() Function

tone(pin, frequency);            // play until told to stop
tone(pin, frequency, duration);  // play for duration ms, then stop itself
noTone(pin);                     // stop now

Three things the missions rely on:

  • tone() doesn't block. tone(BUZZER_PIN, 880, 100) starts the beep and returns immediately — your code keeps running while it plays. Day 13 uses exactly this for key-press feedback.
  • One tone at a time, board-wide. Starting a new tone replaces the old one.
  • tone() borrows Timer2, the same timer that runs PWM on pins 3 and 11. While a tone is playing, analogWrite on those two pins won't work. Plan pins accordingly.

Musical Notes

Each note is just a frequency. One octave up = double the frequency.

| Note | Frequency (Hz) | |------|----------------| | C4 | 262 | | D4 | 294 | | E4 | 330 | | F4 | 349 | | G4 | 392 | | A4 | 440 | | B4 | 494 | | C5 | 523 |

Humans hear roughly 20Hz–20kHz; this little disc is happiest (loudest) from a few hundred Hz to ~5kHz.

Wiring

Two pins: one to a digital pin — the missions use pin 10 — the other to GND. No resistor needed; the piezo element barely draws current. If your buzzer has a + marking, that side goes to the signal pin.

Where You'll Use It

| Mission | What it does | |---------|--------------| | Day 12 | The keypad becomes a 16-key piano | | Day 13 | Confirmation beeps (880Hz) for the security panel | | Day 14 | Alarm tones for wrong codes | | Day 19 | Ascent-rate warning chirps during the climb to the surface | | Day 24 | Launch-sequence audio |

Common Mistakes

  • Silence: wrong pin number in tone(), or the buzzer's on a pin while tone() is aimed at another
  • Weird ticking instead of a note: frequency too low — stay above ~100Hz for clean tones
  • A note refuses to end: an un-timed tone() was never followed by noTone()
  • Volume complaints: piezo volume is basically fixed. Want it quieter? Cover the hole. Louder? Mount it against something hollow.