Chapter 8 Buzzer
If you have any concerns, please feel free to contact us via support@freenove.com
Component knowledge
Buzzer
Buzzer is a sounding component, which is widely used in electronic devices such as calculator, electronic
warning clock and alarm. Buzzer has two types: active and passive. Active buzzer has oscillator inside, which
will sound as long as it is supplied with power. Passive buzzer requires external oscillator signal (generally use
PWM with different frequency) to make a sound.
Active buzzer Passive buzzer
Active buzzer is easy to use. Generally, it can only make a specific frequency of sound. Passive buzzer
requires an external circuit to make a sound, but it can be controlled to make a sound with different
frequency. The resonant frequency of the passive buzzer is 2kHz, which means the passive buzzer is loudest
when its resonant frequency is 2kHz.
Next, we will use an active buzzer to make a doorbell and a passive buzzer to make an alarm.
Schematic
As shown in the figure below, we connect a buzzer to GPIO33 of ESP32. When GPIO33 outputs high level, the
buzzer circuit is turned on; when GPIO33 outputs low level, the buzzer circuit is turned off. Since the buzzer
is a passive buzzer, when we switch quickly between high and low levels, we can control the passive buzzer
to make a sound. The frequency of the sound depends on the duration of the high and low levels (f=1/T,
T=t1+t2).