Site Tools





What is active buzzer?
The buzzer is an integrated electronic alarm device that is powered by a DC power source, widely used in computers, printers, copiers, alarms, electronic toys, automotive electronics, telephones, timers, etc. The active buzzer can make a sound as long as there is a power supply. Our programming output alternated high and low levels to make the buzzer sound. Considering that some chips have a weak GPIO output current, we have integrated a transistor on the active buzzer module to drive the buzzer. The main function of the transistor is to amplify the voltage or current. The transistor is divided into two types, one is NPN, such as the S8050 we provided; the other is PNP, such as the S8550 we provided. And chip transistors are used on the module. The active buzzer we use


S Digital input

Module schematic



1 * microbit
1 * microbit expansion board
1 * USB cable
1 * Active buzzer module
- Several Jumper wires

Then connect the active buzzer to the micro:bit

microbit code:


MU python:

# File name   :
# Description : Buzzer rang.
# Author      : jason
# E-mail      :
# Website     :
# Date        : 2018/12/22
from microbit import *
while True:

Download the code to micro:bit:

Arduino UNO


1 * Adeept Arduino UNO R3 Board
1 * Active Buzzer Module
1 * USB Cable
1 * 3-Pin Wires

Connect the buzzer to the Arduino UNO

Adeept UNO R3 Board Active Buzzer Module
D8 S
5V +

arduino code:

File name: _10_ActiveBuzzerModule.ino
Description: The active buzzer beeps like the sound of "Di Di"..
Author: Tom
Date: 2018/12/22 
int activebuzzerPin=8; //definition digital 8 pins as pin to control the active buzzer
void setup()
    pinMode(activebuzzerPin,OUTPUT); //set digital 8 port mode, the OUTPUT for the output
void loop()
    digitalWrite(activebuzzerPin,HIGH); //set PIN 8 feet as HIGH = 5 v "Di"
    delay(2000);                        //set the delay time,2000ms 
    digitalWrite(activebuzzerPin,LOW);  //Set PIN 8 feet for LOW = 0 v "no Di" 
    delay(2000);                        //set the delay time,2000ms 

Select the development board model and COM port

Click Download

Now you can hear the sound from the buzzer

Raspberry Pi


1 * Raspberry Pi
1 * Passive buzzer module
1 * Breadboard
Several jumper wires

Connect the active buzzer to the Raspberry Pi

Copy the code to Raspberry Pi Linux

Raspberry code:

python code:

  #!/usr/bin/env python
# File name   :
# Description : make an active buzzer beep.
# Author      : Jason
# E-mail      :
# Website     :
# Date        : 2018/12/12
import RPi.GPIO as GPIO
import time
BeepPin = 12    # pin11
def setup():
	GPIO.setmode(GPIO.BOARD)        # Numbers pins by physical location
	GPIO.setup(BeepPin, GPIO.OUT)   # Set pin mode as output
	GPIO.output(BeepPin, GPIO.HIGH) # Set pin to high(+3.3V) to off the beep
def loop():
	while True:
		GPIO.output(BeepPin, GPIO.LOW)
		GPIO.output(BeepPin, GPIO.HIGH)
def destroy():
	GPIO.output(BeepPin, GPIO.HIGH)    # beep off
	GPIO.cleanup()                     # Release resource
if __name__ == '__main__':     # Program start from here
	print 'Press Ctrl+C to end the program...'
	except KeyboardInterrupt:  # When 'Ctrl+C' is pressed, the child program destroy() will be  executed.

C code:

* File name   : buzzer.c
* Description : Make an active buzzer sound.
* Website     :
* E-mail      :
* Author      : Jason
* Date        : 2018/12/12
#include <wiringPi.h>
#include <stdio.h>
#define BeepPin  1
int main(void)
	if(wiringPiSetup() == -1){ //when initialize wiringPi failed, print message to screen
		printf("setup wiringPi failed !");
		return -1; 
	pinMode(BeepPin, OUTPUT);   //set GPIO0 output
		digitalWrite(BeepPin, LOW);  //beep on
		delay(100);                  //delay
		digitalWrite(BeepPin, HIGH); //beep off
		delay(100);                  //delay
	return 0;

Step 2: Edit and save the code with vim or nano.

(Code path: /home/Adeept_RFID_Learning_Kit_C_Code_for_RPi/03_passiveBuzzer/passiveBuzzer.c)\\

Step 3: Compile

$ gcc passiveBuzzer.c -o passiveBuzzer –lwiringPi -lpthread

Step 4: Run

$ sudo ./passieBuzzer

For Python users:

Step 2: Edit and save the code with vim or nano.

(Code path: /home/Adeept_RFID_Learning_Kit_Python_Code_for_RPi/

Step 3: Run

$ sudo python

Now, you can hear the sounds of the buzzer – in varying “rhythms”.

Link for code download: Download the kit information as needed.
Video link:

pub/active_buzzer.txt · Last modified: 2019/01/22 16:52 by Adeept