Passive Buzzer Unit

by M5Stack

Buzzer Unit is a mini passive buzzer unit, drived by 4KHz signal, that sounds up to 72dB within 10cm distance under rating input power.

With the feature of compact size, low-power consumption, awesome audio performance, and a protective housing. Applied for varied buzzer alarm scenario.

Features

  • Drive signal:
  • 4KHz oscillation frequency
  • Up to 72dB (within 10cm, at rating power)
  • Drive signal: 4KHz 1/2duty square wave

Include

  • 1x BUZZER Unit
  • 1x HY2.0-4P cable (20cm)

Specification

Specifications Parameters
Drive frequency 4KHz 1/2duty square wave
Power consumption 5V@86mA
Net weight 3.5g
Gross weight 8.5g
Product size 24 x 24 x 8mm
Packing size 93 x 138mm

PinMap

M5CORE - PORT B G26
BUZZER SIGNAL

Example

Arduino

#include <Arduino.h>

#define buzzer_pin 26
int freq = 4000;
int ledChannel = 0;
int resolution = 10;

void setup() {
ledcSetup(ledChannel, freq, resolution); //Sets the frequency and number of counts corresponding to the channel. 设置通道对应的频率和计数位数
ledcAttachPin(buzzer_pin, ledChannel); //Binds the specified channel to the specified I/O port for output. 将指定通道绑定到指定 IO 口上以实现输出
ledcWrite(ledChannel, 512); //Output PWM. 输出PWM
}

void loop() {
ledcWrite(ledChannel, 512); //Output PWM. 输出PWM
delay(3000);
ledcWrite(ledChannel, 0); //Output PWM. 输出PWM
delay(3000);
}