Active Buzzer

# Active Buzzer An active buzzer is a self-contained unit that generates sound when power is supplied to it. It has a built-in oscillator, so you only need to provide a high or low signal to turn it on or off. It makes sound continuously when powered. You cannot change the sound. You can only turn it On or Off. The Active and Passive Buzzers look identical, except that the Active Buzzer has a sticker on top. This sticker is used to prevent moisture or dirt from entering the buzzer during manufacturing and shipping. It should be removed before use, as leaving it on will result in a very low sound volume. ![Pasted image 20250125232117.png](https://cdn.shopify.com/s/files/1/0331/9994/7908/files/Pasted_image_20250125232117.png?v=1741563569) An active buzzer has two pins: a long leg for the positive (usually 5V or 3.3V) and a short leg for the negative (Ground). You can connect the positive pin to the MCU’s GPIO for an Active High configuration, meaning the buzzer will turn on when the GPIO is High. Alternatively, you can connect the buzzer’s ground pin to the MCU’s GPIO for an Active Low configuration, meaning the buzzer will turn on when the GPIO is Low. Generally, we use the Active High configuration, where the buzzer’s positive pin is connected to the MCU’s GPIO and the negative pin is connected to Ground. ```cpp #define BUZZER_PIN 3 void setup() { pinMode(BUZZER_PIN, OUTPUT); } void loop() { // Active Buzzer - just turn it on and off digitalWrite(BUZZER_PIN, HIGH); // Turn on active buzzer delay(1000); // Wait for 1 second digitalWrite(BUZZER_PIN, LOW); // Turn off active buzzer delay(1000); // Wait for 1 second } ```

RELATED ARTICLES