🐮 Tutorial 16 - Active Buzzer

When a voltage is applied to the active buzzer, the supporting circuitry generates a signal that causes the piezoelectric element to vibrate at a specific frequency, producing an audible tone. The frequency of the tone depends on the design of the buzzer element and the supporting circuitry.

Active buzzers are commonly used in a variety of electronic devices and circuits, such as alarms, timers, and notification systems. They are often used to provide an audible alert when a specific event occurs, such as a low battery warning or an error condition.

One advantage of active buzzers is that they are relatively easy to use and require only a simple connection to a voltage source to operate. They also provide a consistent and reliable output, making them ideal for use in a wide range of applications.

Overall, active buzzers are an important component in electronic circuits and devices, providing a simple and effective way to produce an audible sound for various types of alerts and notifications.

Components Needed

ComponentQuantity
Raspberry Pi Pico W1
Micro USB Cable1
Breadboard1
WiresSeveral
Resistor1 - 1KΩ
Active Buzzer1

Fritzing Diagram

Code

import machine
import utime

buzzer = machine.Pin(15, machine.Pin.OUT)
while True:
    for i in range(4):
        buzzer.value(1)
        utime.sleep(0.3)
        buzzer.value(0)
        utime.sleep(0.3)
    utime.sleep(1)

Code Explanation