Blog
Buzzer Module
A buzzer is an integrated electronic sounder that is powered by direct current voltage. As an acoustic device, it is widely used in various electronic products such as computers, printers, copiers, alarms, electronic toys, automotive electronic equipment, telephones, timers and so on.
Buzzer can be classified into active buzzer and passive buzzer based on the driving method. Active buzzer has a fixed sound frequency and a single tone, making them suitable for simple fixed frequency alerts. Passive buzzer has a controllable sound frequency and can achieve various tone effects, making them more suitable for scenarios that require flexible tone control.
Active Buzzer Module
What is active buzzer module?
An active buzzer is a sound module that integrates components such as a diaphragm, driving circuit, and sound source.It can generate clear and stable sound signals. It has an internal oscillation circuit and amplification circuit, and can produce sound signals simply by inputting a DC voltage. Compared with passive buzzers, active buzzers do not require an external signal source to drive them, making them more convenient to use. They are widely applied in alarm, prompt, and reminder scenarios.
Active Buzzer Module Working Principle
- The active buzzer contains an oscillator inside, so it can buzzsimply by connecting a direct current power supply.
- Working principle: The input of the direct current power supply passes through the amplification and sampling circuit of the oscillation system, and under the action of the resonant device, a sound signal is generated. The advantage of the active buzzer is that its program control is convenient, but the sound frequency is relatively fixed and is not easy to change.
- The active buzzer module has two models, namely highlevel trigger and low level trigger.
Active buzzer module low level trigger : When the microcontroller is at a low level, the buzzer emits sound. When the microcontroller is at a high level, it does not emit sound.
Active Buzzer Module Schematic Diagram — Low Level Trigger
Active buzzer module high level trigger : When the microcontroller is at a high level, the buzzer emits sound. When the microcontroller is at a low level, it does not emit sound.
Active Buzzer Module Schematic Diagram — High Level Trigger
Active Buzzer Module Feature
- The active buzzer module features small size, low power consumption and simple usage.
- Due to its integrated oscillation and amplification circuits, users do not need additional hardware design and can achieve sound generation by simply connecting the power supply.
- The sound intensity and pitch of the module are relatively fixed, making it suitable for occasions that require simple alarm prompts.
Active Buzzer Module Pin Function
I/O PIN | GPIO control pin |
VCC | Power supply (according to the specifications of the buzzer) |
GND | Grounding |
Active Buzzer Module Arduino
How to connect active buzzer module to Arduino
Active Buzzer Module Wiring Diagram
GND — Arduino GND
I/O — Arduino D3 (Users can customize the I/O ports.)
VCC — 3.3 V
· Simulated Wiring Diagram
· Physical Wiring Diagram
Active buzzer module arduino code
· Low level trigger
/*
Active buzzer module (triggered by low level)
*/
#define BUZZER 3
void setup() {
pinMode(BUZZER,OUTPUT);
digitalWrite(BUZZER,HIGH);
}
void loop() {
buzzer_Di();
}
void buzzer_Di() {
digitalWrite(BUZZER,LOW);
}
· High level trigger
/*
Active buzzer module (triggered by high level)
*/
#define BUZZER 3
void setup() {
pinMode(BUZZER,OUTPUT);
digitalWrite(BUZZER,LOW);
}
void loop() {
buzzer_Di();
}
void buzzer_Di() {
digitalWrite(BUZZER,HIGH);
}
Active Buzzer Module Application Scenarios
The active buzzer module is widely used in various electronic devices, such as household appliances, medical equipment, automotive electronics, industrial control, and other fields. In household appliances such as washing machines and microwave ovens, the active buzzer module is used to inform users of the operating status or fault information. In medical devices, such as blood pressure monitors and blood glucose meters, the active buzzer module is used to alert users to read the data or detect abnormal situations. In automotive electronics, such as reversing radar and tire pressure monitoring systems, the active buzzer module is used to provide safety alerts. In industrial control, such as PLC controllers and sensors, the active buzzer module is used for alarm indication or status indication.
Passive Buzzer Module
What is passive buzzer module?
The internal part of an inductive buzzer has no excitation source. Only by providing it with a certain frequency of square wave signal can the vibration device of the buzzer be activated, thereby achieving sound production. At the same time, the different frequencies of input square wave result in different sounds. Passive buzzers can simulate melodies to achieve musical effects.
Passive Buzzer Module Working Principle
- When a direct current voltage is applied to the buzzer, the piezoelectric ceramic film inside will be deformed under the action of the electric field.
- When the direction of the electric field changes, the piezoelectric ceramic film will vibrate repeatedly, generating sound.
- The vibration frequency of the buzzer is determined by the frequency of the input electrical signal.
Frequency calculation method:
Frequency = the reciprocal of the period, that is, f = 1/T.
The unit of frequency f is Hertz (Hz), and the unit of period T is second (s).
Generally, we calculate the period by using the frequency. For example, the period corresponding to a frequency of 1 KHz is 1s / 1000Hz = 0.001s = 1ms.
We use the delay function to output the same duration of high and low level analog square wave signals within one period. Then, we send the signals to the passive buzzer to drive the buzzer to make a sound.
Next, by referring to the frequency and pitch comparison table below, you can play your favorite music using an inductive buzzer.
Passive Buzzer Module Feature
- The sound frequency can be controlled, enabling the effect of ” Do、Re、Mi、Fa、Sol、La、Si”.
- The volume is high and the sound quality is good.
- It has high flexibility. The output pitch can be adjusted according to different scenarios.
Passive Buzzer Module Pin Function
I/O PIN | GPIO control pin |
VCC | Power supply (according to the specifications of the buzzer) |
GND | Grounding |
Passive Buzzer Module Arduino
How to connect passive buzzer module to Arduino
Passive Buzzer Module Wiring Diagram
GND — Arduino GND
I/O — Arduino D3 (The user can customize. If you want to adjust the volume, you need to select an IO pin that supports PWM.)
VCC — 5V
· Simulated Wiring Diagram
· Physical Wiring Diagram
Passive buzzer module arduino code
Code 1: Playing music
Function: Play simple melodies (such as “Do-Re-Mi”)
#define NOTE_C4 262 // Define the frequency of musical notes(Hz)
#define NOTE_D4 294
#define NOTE_E4 330
int melody[] = {NOTE_C4, NOTE_D4, NOTE_E4}; // Melody
int noteDurations[] = {200, 200, 400}; // Note duration(ms)
void setup() {
for (int i = 0; i < 3; i++) {
tone(3, melody[i], noteDurations[i]);
delay(noteDurations[i] * 1.3); // Interval of notes
}
noTone(3);
}
void loop()
{
}
Code 2: PWM controls volume
Note: Use pins that support PWM (such as D3, D5, D6, D9, etc.)
const int buzzerPin = 3;
void setup() {
pinMode(buzzerPin, OUTPUT);
}
void loop() {
analogWrite(buzzerPin, 128); // PWM pulse width ratio 50% (medium volume)
delay(1000);
analogWrite(buzzerPin, 0); // close
delay(1000);
}
Common Issues Resolution:
- No sound: Check if the wiring is correct and confirm that the tone() function is used instead of digitalWrite().
- Inaccurate pitch: Adjust the frequency value in the tone() function (refer to the note frequency table).
- Excessive current: Use a series resistor to limit the current (100Ω to 1kΩ).
Passive Buzzer Module Application Scenarios
- If the project involves more complex tasks of generating audio signals, it is recommended to give priority to using passive buzzers. Because these buzzers allow developers to flexibly adjust the output frequency according to specific requirements, and even combine multiple signals of different frequencies to synthesize a specific melody. For example, in the fields of music toys and educational robots, passive buzzers can be used to create a rich and diverse audio effect experience.
In certain industrial environments, such as factory production lines and warehouse logistics management systems, it may be necessary to issue various types of alarm messages based on different state changes. At this point, using a programmable logic controller (PLC) or other embedded systems to drive passive buzzers is a good choice. By writing the corresponding control program, the pitch and duration of each alarm event can be precisely controlled, ensuring accurate information transmission.
Active Buzzer VS Passive Buzzer
Characteristic | Active Buzzer | Passive Buzzer |
Drive Mode | DC level | PWM square wave |
Frequency | Fixed (built-in oscillator) | Programmable (determined by input signals) |
Control Complexity | Simple (only ON/OFF) | Complex (requiring the configuration of a timer) |
Tone Variation | Single tone | Produce different tone |
Typical Application | Alarm notification, button sound | Music playback, multi-tone alarm |
Power Consumption | Relatively high | It can be adjusted by the duty cycle. |
The choice between an active buzzer and a passive buzzer depends on the specific application requirements. If we need a higher volume, controllable frequency, and rich sound effect, a passive buzzer is suitable. While in scenarios where sound quality is not a priority and simplicity of use is the main concern, we can choose an active buzzer.
Buzzer Module Matters needing attention
- Correct wiring: When connecting the buzzer, ensure it is properly connected to the power supply and control signal. Avoid reversing the connections or connecting the wrong wires to prevent the buzzer from not functioning properly or getting damaged.
- Control frequency and voltage range: Different types of buzzers have different requirements for working frequency and voltage range. When using, set the appropriate frequency and voltage according to the specification sheet to avoid affecting performance or lifespan due to exceeding the range.
- Pay attention to the working environment of the buzzer. Avoid installing the buzzer in a humid, hot, or environment with corrosive gases, as this may affect the sound output effect or shorten the lifespan.
- During use, avoid having the buzzer work continuously for a long time to prevent overheating and damage. This can also extend the lifespan of the buzzer.
Relative Information
Buzzer Module Purchase Link
FAQ
- How can we determine whether a buzzer is good or bad?
Sound output: The most direct way to determine whether a buzzer is functioning properly is through sound output. If the buzzer can produce clear and stable sounds, then it is likely to be functioning normally. If the sound is intermittent or there is no sound at all, then the buzzer may be damaged.
Resistance value: We can determine whether the buzzer is functioning properly by measuring its resistance value. If the resistance value is within the normal range, then the buzzer is likely to be in good condition. If the resistance value is abnormal, then the buzzer may have been damaged.
Waveform output: Using an oscilloscope to measure the waveform output of the buzzer is also an important method to determine whether it is functioning properly. If the buzzer is functioning normally, then the oscilloscope will display a stable waveform. If the waveform is unstable or there is no output, then the buzzer may have been damaged.
2. How to make a buzzer louder?
The volume can be controlled by adjusting the duty cycle using software.
Connecting resistors in series reduces the volume, while increasing the supply voltage enhances the volume.
Connecting resistors in parallel provides a discharge path, and with charging and discharging, the volume will increase.
3. Can a buzzer play music?
The buzzer can play music, especially the passive buzzer. By adjusting the control frequency, the passive buzzer can produce different tones and thus play music. The passive buzzer needs to receive a certain frequency of pulse signal to make a sound, so it can be driven by a PWM wave and the frequency can be adjusted to achieve different tones. The active buzzer can also make a sound, but the passive buzzer is more accurate in tone control.