passive buzzer/How it makes a sound/03. Passive means you make the wave
How it makes a sound · 03 of 10

Passive means you make the wave

A passive buzzer has no oscillator inside. It sounds only while something outside pulls its coil on and off, so the sketch makes the wave and chooses the pitch. Held HIGH it clicks once and goes silent, with the coil still drawing about 200 mA.

Passive and active

Two kinds of buzzer look alike and are wired alike, and they want opposite things from your pin.

Passive means you make the wave
Buzzer
SIGNAL
Sound
no
Pitch
none
Coil current
about 200 mA, steady
LED
lit
HIGH, and held there: one click as the coil pulls the disc in, then silence, because nothing moves it again. The coil keeps drawing about 200 mA from 3.3 V (worked out from its 16 Ω), and the LED stays lit. A passive buzzer needs a wave; digitalWrite HIGH is the active buzzer's way, not this one's.

An active buzzer has a small oscillator circuit inside it. Give it power, a steady HIGH on its input, and it makes its own wave and beeps at the one pitch it was built for. The Active Buzzer block is one.

A passive buzzer, this one, has no circuit inside: only the coil and the disc. It makes a sound only while something outside switches the coil on and off, and whatever does that switching chooses the pitch. Here that is your sketch.

HIGH is silent

A steady HIGH turns the transistor on and leaves it on. The coil pulls the disc in, you hear one click, and then nothing moves. The only thing still happening is the coil's current: with nothing but its 16 Ω to limit it, about 200 mA from a 3.3 V supply and about 300 mA from 5 V. That is worked out from the datasheet's resistance, not measured, and it is two or three times what the buzzer is rated for while playing.

So a sketch for this block never leaves SIGNAL HIGH. When it wants silence it writes LOW, or calls noTone(), which does the same.

The LED makes the mistake visible: it lights fully and stays lit.

A wave is a sound

tone(pin, 2700) puts a square wave on the pin, HIGH for half of each cycle and LOW for the other half, 2700 times a second. The coil pulls the disc in on each HIGH and lets it go on each LOW, and the disc moving 2700 times a second is a 2700 Hz tone.

Change the number and the pitch changes. 440 is the A orchestras tune to; 262 is middle C. Any whole number of hertz the board can produce is a note this buzzer will play, and where it is loudest is the only thing that varies.

When it does not work

digitalWrite(HIGH) makes a click and nothing else.

That is a passive buzzer doing what it should. HIGH pulls the disc in once and holds it, and a held disc makes no sound. Use tone(pin, frequency) to make the wave, and write the pin LOW, or call noTone(), when you want silence.

My sketch was written for an active buzzer.

An active buzzer sketch sets the pin HIGH for sound and LOW for silence. On this block that gives a click and then silence, with the LED lit and the coil drawing current. Replace each HIGH with tone(pin, 2700) and each LOW with noTone(pin).

Can I use this block where an active buzzer was?

Yes, if the sketch changes as above. It is the more flexible of the two: an active buzzer has one pitch, this one plays any pitch you send it.

Where this goes next

Where the coil's current comes from, and where it goes when the transistor lets go.

The transistor and the diode

Edit this page — content/books/passive-buzzer/passive-means-you-make-the-wave.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

Passive Buzzer

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum