2.10 Active Buzzer

Share for us

Overview

In this lesson, you will get to know about active buzzer. As a type of electronic buzzer with an integrated structure, active buzzer is supplied by DC power, widely used in computer, alarm, electronic toy, telephone, timer and other electronic products or voice devices.

Components Required

Component Introduction

Buzzers can be categorized as active and passive ones (see the following picture). Turn the buzzer so that its pins are facing up, and the buzzer with a green circuit board is a passive buzzer, while the one enclosed with a black tape is an active one.

The difference between an active buzzer and a passive buzzer:

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 beep 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 of multiple built-in oscillating circuits.

The following is the electrical symbol of a buzzer. It has two pins with positive and negative poles. With a + in the surface represents the anode and the other is the cathode.

You can check the pins of the buzzer, the longer one is the anode and the shorter one is the cathode. Please don’t mix them up when connecting, otherwise the buzzer will not make sound.

Fritzing Circuit

In this example, we use the digital pin 9 to drive the buzzer and extend the cathode of the Buzzer to GND and its anode to the digital pin 9.

Schematic Diagram

Code

const int buzzerPin = 9;

void setup() 
{
  pinMode(buzzerPin, OUTPUT);
}

void loop() 
{
  digitalWrite(buzzerPin, HIGH);
  delay(300);
  digitalWrite(buzzerPin,LOW);
  delay(300);
}

When you finish uploading the codes to the Mega2560 board, you can hear the beep—beep emitted from the buzzer. If you want to know more about the detail code explanation, please refer to Part 1-1.2 Digital Write.  

Phenomenon Picture