ESP32 Buzzer Active Passive module

This project demonstrates how to interface a passive buzzer with an ESP32 microcontroller. It showcases basic control of the buzzer to produce sound by turning it on and off at regular intervals.

Components Needed

Circuit Setup

Connecting Passive Buzzer to ESP32:

Connect the positive terminal (usually longer leg) of the passive buzzer to GPIO pin 13 on the ESP32.

Connect the negative terminal (usually shorter leg) of the passive buzzer to ground (GND).

Instructions

Setup:

Initialize the GPIO pin connected to the buzzer (buzzerPin) as an output using pinMode().

Operation:

In the loop() function:

Set buzzerPin to HIGH to turn the buzzer on.

Delay for a specified duration (delay(1000) in this example) to keep the buzzer on.

Set buzzerPin to LOW to turn the buzzer off.

Delay again for a specified duration before repeating the cycle.

Considerations:

Buzzer Selection: Ensure compatibility of the buzzer with the ESP32's GPIO voltage levels.

Sound Output: Adjust the duration of delay() calls to control the sound duration and frequency.

Current Limiting: Ensure the current supplied to the buzzer is within safe operating limits.

Applications

Notes