Electronics

Passive Buzzer Module With Low Level Trigger

AED 7.35

1

Description

A passive buzzer (AKA magnetic transducer) can make different tones, but the devices that control the buzzer has to provide it with an oscillating electronic signal at the desired frequency. The supplied frequency will determine the tone. Supplying just a fixed voltage will generate no sound, except perhaps a slight "tick" at the point when the power source is connected or disconnected from the buzzer. 


This Module is Low-Level Trigger using its Low-Level Trigger transistor

1, there is no shock source inside the passive, so if it can't between by DC signal. A square wave of 2K~5K must be used to drive it
2, in some special cases, a control port can be multiplexed with LED.
3, voice frequency controllable, can make "to send Tracy cable" effect.
The characteristics of the active buzzer are:
1, the active buzzer has a shock source inside, so it will be called as long as it is electrified.
2, program control is convenient. A high and low level of MCU can make it sound, but passive buzzer can not do it.
A module description
The 1 module is driven by the 9012 triode
6 with fixed bolt holes for easy installation
7 small size: 3.3cm * 1.3cm PCB
Two module interface description (3 wire system)
2 working voltage 3.3V-5V
1 VCC external 3.3V-5V voltage (directly connected to 5V microcontroller and 3.3V microcontroller).
2 GND outside GND
3 I/O external chip IO port


Controlling the buzzer by Arduino (AKA driving the buzzer)

An Arduino can generate an oscillating signal as required by a passive buzzer. The signal can be emitted at one of the digital pins. However, an Arduino can only provide up to about 40mA of current on each of its pins. 

If you require a louder sound, or if your buzzer requires higher currents than an Arduino can safely supply you can add a transistor to the circuit. You can always use a DMM to measure how much current your buzzer takes when it is driven through a transistor and compare it to Arduino's max current. When doing the calculations, mind that for the oscillating signal, the measured average current will be half of the actual peak current.

The signal from Arduino will connect to the base of the transistor through a base resistor and will open/close the transistor to allow higher current flow from the power source to power the buzzer. When using a transistor you can use lower value series resistors or you can even try none at all.

Popular buzzers are usually 16Ω and usually take as much as 100mA when making a sound (without an additional series resistor). 



Wirings:

Here is the wiring with the codes

2

 Codes:

Here Are two version of codes:

-.Ino Codes: Download here

-Text codes:

Code 1:

//This code is to use with a buzzer if you're using the module with 3 pins wire the I/O with D8
//If you're using the other version wire the (+) pin with 8 // Refer to SurtrTech.com for more information
//Emitting 1KHz sound for 1s and then 2KHz sound for 1s

int buzzer = 8;
 
void setup() {
 
}
 
void loop() {

tone(buzzer, 1000); // tone() is the main function to use with a buzzer, it takes 2 or 3 parameteres (buzzer pin, sound frequency, duration)
 delay(1000);
 tone(buzzer, 2000); // You can also use noTone() to stop the sound it takes 1 parametere which is the buzzer pin
 delay(1000);
 
}

Code 2:

//This code is to use with a buzzer if you're using the module with 3 pins wire the I/O with D8
//If you're using the other version wire the (+) pin with 8 // Refer to SurtrTech.com for more information
//Increasing sound freqency from 100Hz to 2KHz then decreasing frequency from 2KHz to 100Hz

int buzzer = 8;
 
void setup() {
 
}
 
void loop() {
for(int i=100 ; i<2000 ; i++){ // loop for to increase the sound frequency
 tone(buzzer, i);
 delay(10); //You can change the delay if you want to make it longer or shorter
}
for(int i=2000 ; i>100 ; i--){
 tone(buzzer, i);
 delay(10);
} 
}

 

Code 3: Star Wars theme (I took it from here   https://gist.github.com/nicksort/4736535 )

 
const int c = 261;
const int d = 294;
const int e = 329;
const int f = 349;
const int g = 391;
const int gS = 415;
const int a = 440;
const int aS = 455;
const int b = 466;
const int cH = 523;
const int cSH = 554;
const int dH = 587;
const int dSH = 622;
const int eH = 659;
const int fH = 698;
const int fSH = 740;
const int gH = 784;
const int gSH = 830;
const int aH = 880;
 
const int buzzerPin = 8;
const int ledPin1 = 12;
const int ledPin2 = 13;
 
int counter = 0;
 
void setup()
{
 //Setup pin modes
 pinMode(buzzerPin, OUTPUT);
 pinMode(ledPin1, OUTPUT);
 pinMode(ledPin2, OUTPUT);
}
 
void loop()
{
 
 //Play first section
 firstSection();
 
 //Play second section
 secondSection();
 
 //Variant 1
 beep(f, 250); 
 beep(gS, 500); 
 beep(f, 350); 
 beep(a, 125);
 beep(cH, 500);
 beep(a, 375); 
 beep(cH, 125);
 beep(eH, 650);
 
 delay(500);
 
 //Repeat second section
 secondSection();
 
 //Variant 2
 beep(f, 250); 
 beep(gS, 500); 
 beep(f, 375); 
 beep(cH, 125);
 beep(a, 500); 
 beep(f, 375); 
 beep(cH, 125);
 beep(a, 650); 
 
 delay(650);
}
 
void beep(int note, int duration)
{
 //Play tone on buzzerPin
 tone(buzzerPin, note, duration);
 
 //Play different LED depending on value of 'counter'
 if(counter % 2 == 0)
 {
 digitalWrite(ledPin1, HIGH);
 delay(duration);
 digitalWrite(ledPin1, LOW);
 }else
 {
 digitalWrite(ledPin2, HIGH);
 delay(duration);
 digitalWrite(ledPin2, LOW);
 }
 
 //Stop tone on buzzerPin
 noTone(buzzerPin);
 
 delay(50);
 
 //Increment counter
 counter++;
}
 
void firstSection()
{
 beep(a, 500);
 beep(a, 500); 
 beep(a, 500);
 beep(f, 350);
 beep(cH, 150); 
 beep(a, 500);
 beep(f, 350);
 beep(cH, 150);
 beep(a, 650);
 
 delay(500);
 
 beep(eH, 500);
 beep(eH, 500);
 beep(eH, 500); 
 beep(fH, 350);
 beep(cH, 150);
 beep(gS, 500);
 beep(f, 350);
 beep(cH, 150);
 beep(a, 650);
 
 delay(500);
}
 
void secondSection()
{
 beep(aH, 500);
 beep(a, 300);
 beep(a, 150);
 beep(aH, 500);
 beep(gSH, 325);
 beep(gH, 175);
 beep(fSH, 125);
 beep(fH, 125); 
 beep(fSH, 250);
 
 delay(325);
 
 beep(aS, 250);
 beep(dSH, 500);
 beep(dH, 325); 
 beep(cSH, 175); 
 beep(cH, 125); 
 beep(b, 125); 
 beep(cH, 250); 
 
 delay(350);
}