1.Product Introduction
Buzzer module is an integrated structure of sound electronic components, using DC power supply, widely used in toys, alarms and other electronic products. Buzzer is divided into passive buzzer and active buzzer; There is no shock source inside the passive buzzer, and it needs to be driven by 2K~5K square wave. Passive buzzer can freely control the output sound frequency, and can be programmed to write different scales and duration time to synthesize a beautiful melody of music.
2.Parameter Specification
Parameter | Value/Representation |
---|---|
Operating voltage | 3.3~5V |
Operating temperature | -20°C~+70°C |
Output signal | Digital signal |
Size | 3.16cm*2.38cm |
3.Wiring Diagram
P-Buzzer Module | UNO |
---|---|
VCC | 5V |
GND | GND |
S | Digital Pin 7 |
4.Sample Code
1int buzzerPin=7;//Define the buzzer pin
2#define C4 262
3#define D4 294
4#define E4 330
5#define F4 350
6#define G4 393
7#define A4 441
8#define B4 495
9int length0=14;
10int tune0[] = { C4, C4, G4, G4, A4, A4, G4, F4, F4, E4, E4, D4, D4, C4 };
11float durt0[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2 };
12
13void setup(){
14 for (int x = 0; x < length0; x++) {
15 tone(buzzerPin, tune0[x]);
16 delay(500 * durt0[x]);
17 noTone(buzzerPin);
18 delay(30);
19 }
20}
21void loop(){
22}
5.Test Result
After you upload the code to the controller board, the buzzer will emit a piece of music, and you can change the tune to play different music.
6.Related Resources
7.Get One Now
B2B Business: info@acebott.com