Piezo Buzzer
Makes beeps and tones straight from a digital pin.
How it works
A piezo buzzer turns an electrical signal into sound. There are two kinds: an active buzzer has its own oscillator and just beeps at one pitch when powered, while a passive buzzer needs you to feed it a square wave — the frequency you send sets the pitch.
For melodies use a passive buzzer with the Arduino tone() function, which generates the square wave for you. tone(pin, frequency) plays a note; noTone(pin) stops it.
Pins
- + (signal)
- To a digital pin.
- − (GND)
- To GND.
Ratings
- Voltage
- 3–5 V
- Drive
- Passive: tone(); active: HIGH = beep
Tips
- Use a passive buzzer for melodies, an active one for a simple beep.
- Put a 100 Ω resistor in series to make it quieter.