Notifications Buzzer

Alert the user with a brief 440Hz beep tone driven by a single GPIO pin. This audio feature requires a passive speaker/transducer and driver circuit.

Type: Notifications

Name: Notifications Buzzer

Status: NORMAL CLIMATE COLLECTION SONOFF SHELLY

GitHub: N002_Buzzer.cpp

Maintainer: .

Used libraries: .

Introduction

Notifications Buzzer is used to trigger an audio beep tone. This is ideal for system alerts and other attention seeking situations.

A “Notify” command is used in the device rule file to produce the sound. It is a simple 440Hz tone with 500mS duration.

Please be aware that ESPEasy supports a more advanced audio tone feature named Buzzer (RTTTL) that can produce user defined melodies.

Hint

To learn about the RTTTL tone feature please click here Buzzer (RTTTL)


Speaker Driver

There are many ways to adapt the GPIO output to drive a piezo transducer or common speaker. Adding an alert beep sound to a microcontroller is a popular topic discussed by Arduino project builders. So for inspiration a quick internet search is all that is required. The implementation can be fully DiY using a simple transistor driver circuit, a ready-to-use module, or 1000 watt rock concert amplifier with a stage full of speakers.

Be aware that the tone frequency is created by software. So the audio output device must be the “passive” type that does not include an oscillator.

Keep in mind that common buzzers and beepers are turned on by a fixed voltage; Do NOT use that type with the Notifications feature.

The idle state for the Buzzer’s GPIO pin is logic low. So the driver circuit should have an active high turn-on state, which will be toggled on/off to create the tone’s fixed 440Hz frequency.

Below is one such circuit, which requires only three components:

  • 2N7000 MOSFET Transistor

  • 22Ω 1/8W Resistor

  • 8-16 ohm Speaker

Simple Speaker Driver Circuit

ESPEasy Buzzer Configuration

ESPEasy’s Notifications tab allows up to three declarations for email and buzzer alerts. Only one Buzzer entry is needed to enable the feature.

Notifications Tab

From the Notifications page, press Edit on an available Nr option. Next, Choose Buzzer in the drop-down list and select the GPIO pin number for your audio output. Be sure to check the Enabled box before pressing the Submit button.

Buzzer Configuration Example

Command Syntax

The general syntax for making a buzzer noise is:

notify <Nr>

Where <Nr> is the position number (1,2,3) assigned to the notification declaration.


Rules Example

To make a buzzer sound on startup, create a rule like this:

On System#Boot do
  notify 1 // Beep!
endon

To make a buzzer sound every 60 seconds, create a rule file with these commands:

On System#Boot do
  LoopTimerSet,1,60  // Start the timer.
endon

On Rules#Timer=1 do
  notify 1 // Beep!
endon

Hint

The examples discussed here have setup the buzzer in the very first (Nr 1) row. So the command syntax will be “notify 1