Starting Electronics needs your help! Please make a donation to help cover our hosting and other costs. Click the donate button to send a donation of any amount.

Geekcreit Active Buzzer Module Arduino Tutorial

Created on: 21 November 2017

How to use the active buzzer module from the Geekcreit 37 in 1 sensor module board set kit for Arduino.

This tutorial shows how to connect the active buzzer to Arduino as well as basic use and testing of the buzzer module.

The image below shows the active buzzer module used in this tutorial with the sticker seal in place on the left and with the sticker removed on the right.

Geekcreit Active Buzzer with Sticker Seal (left) and Sticker Removed (Right)
Geekcreit Active Buzzer with Sticker Seal (left) and Sticker Removed (Right)

Basic Buzzer Operation and Testing

The active buzzer has built-in electronics that produces the buzzer sound. For this reason it will sound when power is connected to it and does not need any external electronics or an Arduino for it to produce a sound.

As can be seen in the above image, with the buzzer facing forward, the left pin is negative (-) and the right pin is positive (+). The middle pin is not connected. For more details, see the Geekcreit active buzzer module pinout.

The simplest way to test the buzzer to see that it is working is to connect a 5V power supply that can deliver 30mA or more across its pins. When the buzzer is connected to 5V it should sound.

5V from an Arduino can be connected to the buzzer as shown in the image below. No Arduino sketch is necessary as the Arduino 5V is used directly for testing purposes.

Basic Testing of the Geekcreit Active Buzzer Module with Arduino
Basic Testing of the Geekcreit Active Buzzer Module with Arduino

Controlling the Active Buzzer Module with Arduino

An Arduino can be used to switch the buzzer on and off. It could be used in an alarm circuit or as an audible indicator that a keypad key is pressed.

Because the buzzer draws more current than the maximum current that an Arduino pin can deliver, it is necessary to connect the buzzer to Arduino using a transistor.

As shown in the circuit diagram below, a transistor such as a PN2222 or KSP2222 can be used so as not to overload the Arduino pin. In this circuit, only around 2mA is drawn from the Arduino pin, while the full current drawn by the buzzer is taken from the Arduino 5V supply through the transistor. The transistor acts as a switch that delivers more than 20mA to the buzzer.

Arduino Active Buzzer Transistor Interface Circuit
Arduino Active Buzzer Transistor Interface Circuit

Switch the Buzzer On and Off with Arduino

The following sketch shows how to switch the buzzer on and off. Arduino pin number 3 is used to control the buzzer, but any digital output pin can be used by changing the pin number at the top of the sketch.

// change pin that buzzer is connected to here
#define BUZZER_PIN  3

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

void loop() {
  // pulse the buzzer on for a short time
  digitalWrite(BUZZER_PIN, HIGH);
  delay(100);
  digitalWrite(BUZZER_PIN, LOW);
  delay(2000);
}

In the sketch the buzzer is pulsed on for a short duration (100ms) and then switched off for 2 seconds (or 2000ms). This produces a short sharp periodic beep.

Other Arduino Buzzer Circuits

Certain low current buzzers can be directly connected to an Arduino pin as shown in the article on connecting a buzzer to an Arduino Uno. The buzzer must draw less than 20mA if it is to be driven directly by an Arduino pin.

A buzzer that operates from a voltage higher than the Arduino 5V can be driven by a transistor and external power supply shown in the Arduino buzzer circuit.

Books that may interest you:

C Programming with Arduino Book Ultimate Arduino MEGA 2560 Hardware Manual Ultimage Arduino Uno Hardware Manual