ACTIVE BUZZER WITH ARDUINO UNO R3

About: PrimeRobotics is a E-Commerce site, which focus on supplying right products to Electronics Hobbyists, Enthusiast & Students.

You can use a buzzer whenever you want to make some noise.

Step 1: Components Required

Step 2: Principle

As a type of electronic buzzer with integrated structure, buzzers, which are supplied by DC power, are widely used in computers, printers, photocopiers, alarms, electronic toys, automotive electronic devices, telephones, timers and other electronic products for voice devices. Buzzers can be categorized as active and passive ones (see the following picture). Turn the pins of two buzzers face up, and the one with a green circuit board is a passive buzzer, while the other enclosed with a black tape is an active one.

Step 3: The Schematic Diagram

The difference between an active buzzer and a passive buzzer is:

An active buzzer has a built-in oscillating source, so it will make sounds when electrified. But a passive buzzer does not have such source, so it will not tweet if DC signals are used; instead, you need to use square waves whose frequency is between 2K and 5K to drive it. The active buzzer is often more expensive than the passive one because o f multiple built-in oscillating circuits.

In this experiment, we use the active buzzer.

Step 4: Procedures

Step1:

Build the circuit.

Step 2:

Download the code from https://github.com/primerobotics/Arduino

Step 3:

Upload the sketch to the Arduino Uno board Click the Upload icon to upload the code to the control board. If "Done uploading" appears at

the bottom of the window, it means the sketch has been successfully uploaded. You should now hear the buzzer beep.

Step 5: Code

/*********************************

* name:buzzer

* function: you should hear the buzzer make sounds.

*************************************

/Email: info@primerobotics.in

//Website: www.rimerobotics.in

/************************************/

int buzzer = 12;//the pin of the active buzzer

void setup()

{

pinMode(buzzer,OUTPUT);//initialize the buzzer pin as an output

}

void loop()

{

unsigned char i;

while(1)

{

//output an frequency

for(i=0;i<80;i++)

{

digitalWrite(buzzer,HIGH);

delay(1);//wait for 1ms

digitalWrite(buzzer,LOW);

delay(1);//wait for 1ms

}

//output another frequency

for(i=0;i<100;i++)

{

digitalWrite(buzzer,HIGH);

delay(2);//wait for 2ms

digitalWrite(buzzer,LOW);

delay(2);//wait for 2ms

}

}

}

Share

    Recommendations

    • Paper Contest

      Paper Contest
    • Sweet Treats Challenge

      Sweet Treats Challenge
    • Warm and Fuzzy Contest

      Warm and Fuzzy Contest

    Discussions