Skip to content

Buzzer Sounds and Patterns

Beginning of the lesson

Understanding Buzzer Types
Active Buzzer
  • Internal oscillator - produces sound automatically when powered
  • Fixed frequency - typically ~2kHz tone
  • Simple control - just turn ON/OFF with digitalWrite()
  • Identification - often has a white sticker on top, sealed case
Passive Buzzer
  • Like a tiny speaker - requires AC signal to produce sound
  • Variable frequency - can create different tones and melodies
  • Uses tone() function - Arduino generates the frequency
  • Identification - open back, exposed PCB, green circuit board visible
Why Use a Transistor?
Current Limitations:
  • Arduino pins can safely source 20mA continuous
  • Maximum absolute limit: 40mA
  • Buzzers typically draw 20-40mA or more

Solution: 2N2222 Transistor

The transistor acts as an electronic switch that can handle 100-500mA safely, providing:

  • Louder sound output
  • Protection for Arduino pins
  • Ability to drive larger buzzers
Base Resistor Calculation:
R = (5V - 0.7V) / Ibase
For 30mA collector current with gain of 100:
Ibase ≈ 0.3mA minimum
1kΩ resistor provides ~4.3mA (safe with margin)
Flyback Diode Protection

When a buzzer (inductive load) turns off, it creates a voltage spike that can damage the transistor.

The 1N4007 flyback diode provides a safe path for this energy:

  • Cathode (silver band) connects to buzzer positive
  • Anode connects to GND
  • Diode is reverse-biased during normal operation
  • Conducts only during voltage spike, protecting transistor
Interactive visualization — available in the full lesson

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