Skip to content

Active Buzzer

Component Active Buzzer
Type Output
Function Generate sound

Introduction

An active buzzer is a type of electronic buzzer that generates sound when a voltage is applied to it. It is an output device that is commonly used in electronic projects to provide audible feedback to the user. Active buzzers are often used in alarm systems, timers, and other applications where an audible signal is required.

You use an active buzzer (instead of a passive buzzer) when you want to use one signal to generate sound. A passive buzzer requires an alternating signal to generate sound, while an active buzzer only requires a direct current signal.

Pin Description

An active buzzer has two pins: a positive pin and a negative pin. You connect the positive pin to a digital output pin on a microcontroller, and the negative pin to the ground pin. When you apply a high signal to the positive pin, the buzzer generates sound.

Code Example

The following code example demonstrates how to generate a sound using an active buzzer connected to an Arduino board.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#define BUZZER_PIN 8 // define the buzzer pin

void setup() {
  pinMode(BUZZER_PIN, OUTPUT); // set the buzzer pin as an output
}

void loop() {
  digitalWrite(BUZZER_PIN, HIGH); // apply a high signal to the buzzer pin
  delay(1000); // wait for 1 second
  digitalWrite(BUZZER_PIN, LOW); // apply a low signal to the buzzer pin
  delay(1000); // wait for 1 second
}

In this example, we use the digitalWrite function to apply a high signal to the buzzer pin, causing the buzzer to generate sound. We then wait for 1 second using the delay function, and then apply a low signal to the buzzer pin to stop the sound.