Prøve GULL - Gratis

MakerSpace Buzzer music: Simple melodies with the Pi Pico Buzz It, Baby!

Linux Magazine

|

#297/August 2025: Cleaning Up

Use the buzzer to have your MCU play small wake-up melodies, signals, or music to accompany LED animations. The sound might not be a feast for the ears, but it does give your projects a great retro feel.

- By Bernhard Bablok

MakerSpace Buzzer music: Simple melodies with the Pi Pico Buzz It, Baby!

Every PC has at least a small beeper for signal tones. In the case of microcontrollers, you need to retrofit a buzzer to do this, but buzzers are too good for just outputting beeps. They are available for a small amount from the typical marketplaces, and you can choose between two basic types: active and passive. The active relies on a builtin oscillator to generate sound and only require two pins, while you need to feed a PWM signal to the passive. Besides voltage and earth, they require another pin for the signal.

The buzzers themselves look like small black pots with two pins (Figure 1, center and right). For active buzzers, you just need the component itself, but for passive buzzers, it makes sense to use a breakout with the required circuitry (Figure 1, left). There are also breakouts for active buzzers with three pins, but one of them is not assigned in this case. When purchasing, you can use the designation as a guide: Passive buzzers will be known as KY-006 or HW-508, while an active variant often has KY-012 in its name.

Because the parts are inexpensive, it’s a good idea to grab a handful of them. A single buzzer is fine for simple tone sequences, but it’s more fun if you have several of them so that you can create entire chords instead of just individual tones.

Pulse Width Modulation

PWM signals are levels that are switched on and off at fixed intervals, resulting in a typical square wave curve (Figure 2). The pitch of the buzzer output depends on the frequency. You could simply generate these PWM signals by switching a GPIO pin, but that would be painstaking and unnecessary. All microcontrollers have builtin hardware units for this; you just have to feed them the right parameters. In addition to the frequency, which is decisive for the pitch, this also includes the duty cycle, i.e., the proportion of active time that determines the volume.

Linux Magazine

Denne historien er fra #297/August 2025: Cleaning Up-utgaven av Linux Magazine.

Abonner på Magzter GOLD for å få tilgang til tusenvis av kuraterte premiumhistorier og over 9000 magasiner og aviser.

Allerede abonnent?

FLERE HISTORIER FRA Linux Magazine

Linux Magazine

Exercise Place

The GRUB 2 boot manager might seem intimidating at first glance. All the more reason to spin up a virtual playground so you can practice.

time to read

10 mins

#298/September 2025: Indie Game Studio

Linux Magazine

Terminal Mosaic

What's better than one command line? Many command lines that never die. Take the terminal to new places with Zellij.

time to read

9 mins

#298/September 2025: Indie Game Studio

Linux Magazine

Linux Magazine

MakerSpace

Build a Long-Range Sensor Network with ChirpStack Sensor Symphony

time to read

14 mins

#298/September 2025: Indie Game Studio

Linux Magazine

Linux Magazine

How Flatpak, AppImage, and Snap are changing software distribution Ship It!

Modern-day package systems solve some problems posed by classic formats like DEB and RPM. We look at Flatpak, AppImage, and Snap and describe how they differ.

time to read

12 mins

#298/September 2025: Indie Game Studio

Linux Magazine

Linux Magazine

Dashboard Delight

Simplify the chaos of self-hosted services with Homepage, a customizable dashboard with widgets that put service statistics at your fingertips.

time to read

9 mins

#298/September 2025: Indie Game Studio

Linux Magazine

Linux Magazine

MADDOG'S DOGHOUSE

Free software, and the FOSS community, can help technology students get the education they desire in Brazil and elsewhere.

time to read

3 mins

#298/September 2025: Indie Game Studio

Linux Magazine

Linux Magazine

Rethinking the Terminal

The Warp AI agent takes the guesswork out of working at the command line. We show you how to build a simple website with one prompt.

time to read

4 mins

#298/September 2025: Indie Game Studio

Linux Magazine

Just in Time

Just is a command runner that lets you define project-specific tasks in a declarative justfile.

time to read

7 mins

#298/September 2025: Indie Game Studio

Linux Magazine

Linux Magazine

The Watcher

This versatile security app checks for vulnerabilities, watches logs, and acts as a single interface for other tools.

time to read

7 mins

#298/September 2025: Indie Game Studio

Linux Magazine

Linux Magazine

NO INTERNETREQUIRED

This new utility lets you update a system that is notconnected to the Internet.

time to read

4 mins

#298/September 2025: Indie Game Studio

Listen

Translate

Share

-
+

Change font size