The Passive Buzzer Module by Robocraze, part ID RC-B-552, is an electronic sound-generating device that requires an external signal to produce tones. Unlike active buzzers that have an internal oscillator, passive buzzers need to be driven by an external pulse-width modulated (PWM) signal to generate various tones and sounds. This makes them highly versatile for creating different sound effects and musical notes in applications such as alarms, notification systems, and DIY musical instruments.
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Connect to 3.3V or 5V power supply |
2 | GND | Connect to the ground of the circuit |
3 | SIG | Signal input, connect to PWM output |
To generate sound with the passive buzzer module, you need to provide a PWM signal to the SIG pin. The frequency of the PWM signal will determine the pitch of the sound produced by the buzzer.
// Define the buzzer pin
int buzzerPin = 9;
void setup() {
// Set the buzzer pin as an output
pinMode(buzzerPin, OUTPUT);
}
void loop() {
// Generate a 1kHz tone for 1 second
tone(buzzerPin, 1000, 1000);
delay(1500); // Wait for 1.5 seconds
// Generate a 500Hz tone for 1 second
tone(buzzerPin, 500, 1000);
delay(1500); // Wait for 1.5 seconds
}
tone()
function in Arduino to easily generate different frequencies.tone()
function is correctly implemented in your code.Q: Can I use the passive buzzer module with a digital pin that is not PWM capable?
A: No, the passive buzzer requires a PWM signal to generate sound. A digital pin without PWM capability cannot provide the necessary signal.
Q: What is the difference between a passive and an active buzzer?
A: A passive buzzer requires an external PWM signal to produce sound, while an active buzzer has an internal oscillator and generates sound when powered.
Q: How can I play a melody with the passive buzzer?
A: You can play a melody by generating a sequence of PWM signals at different frequencies corresponding to the musical notes of the melody.
For further assistance or inquiries about the Passive Buzzer Module RC-B-552, please contact Robocraze customer support.