Piezo buzzers are simple devices that can generate basic beeps and tones. They work by using a piezo crystal, a special material that changes shape when voltage is applied to it. If the crystal pushes against a diaphragm, like a tiny speaker cone, it can generate a pressure wave that the human ear picks up as sound. Simply change the frequency of the voltage sent to the piezo and it will start generating sounds by changing shape very quickly!

This guide will explore how to generate tones with a piezo buzzer, code-free, with Adafruit IO WipperSnapper. It will also explore how to use a piezo buzzer as an alarm for a temperature sensor.

What is WipperSnapper

WipperSnapper is a firmware designed to turn any WiFi-capable board into an Internet-of-Things device without programming a single line of code. WipperSnapper connects to Adafruit IO, a web platform designed (by Adafruit!) to display, respond, and interact with your project's data.

Simply load the WipperSnapper firmware onto your board, add credentials, and plug it into power. Your board will automatically register itself with your Adafruit IO account.

From there, you can add components to your board such as buttons, switches, potentiometers, sensors, and more! Components are dynamically added to hardware, so you can immediately start interacting, logging, and streaming the data your projects produce without writing code.

Parts

Top view of black rectangle-shaped microcontroller.
One of our star Feathers is the Adafruit HUZZAH32 ESP32 Feather - with the fabulous ESP32 WROOM module on there, it makes quick work...
$19.95
In Stock
Large Enclosed Piezo Element with two Wires
This large (30mm diameter) piezo element is nicely enclosed with mounting holes so you can attach easily. Piezo elements convert vibration to voltage or voltage to vibration. That...
$0.95
In Stock
Bread-board friendly Piezo Buzzer
Piezo buzzers are used for making beeps, tones and alerts. This one is petite but loud! Drive it with 3-30V peak-to-peak square wave. To use, connect one pin to ground (either one) and...
$1.50
In Stock
Angled shot of Adafruit SCD-40 - NDIR CO2 Temperature and Humidity Sensor.
Take a deep breath in...now slowly breathe out. Mmm isn't it wonderful? All that air around us, which we bring into our lungs, extracts oxygen from and then breathes out carbon...
$44.95
In Stock
Text image that reads "IO+"
The all-in-one Internet of Things service from Adafruit you know and love is now even better with IO+. The 'plus' stands for MORE STUFF! More feeds, dashboards,...
$99.00
In Stock
1 x STEMMA QT / Qwiic Cable
JST SH 4-Pin Cable - 50mm Long
1 x USB A to micro B Cable
Fully Reversible, Pink/Purple, 1m long

Wiring

To connect a piezo buzzer you just need to connect one leg of the buzzer to your board ground, and another leg to a PWM-capable or analog-out output of your board.

Here's how to wire a piezo to a Feather ESP32 V2:

  • One leg of the piezo buzzer (or black wire) to board GND.
  • The other leg of the piezo buzzer (or red wire) to board D14 (or any other PWM-capable output).
The WipperSnapper firmware and ecosystem are in BETA and are actively being developed to add functionality, more boards, more sensors, and fix bugs. We encourage you to try out WipperSnapper with the understanding that it is not final release software and is still in development. If you encounter any bugs, glitches, or difficulties during the beta period, or with this guide, please contact us via http://io.adafruit.com/support

What is WipperSnapper

WipperSnapper is a firmware designed to turn any WiFi-capable board into an Internet-of-Things device without programming a single line of code. WipperSnapper connects to Adafruit IO, a web platform designed (by Adafruit!) to display, respond, and interact with your project's data.

Simply load the WipperSnapper firmware onto your board, add credentials, and plug it into power. Your board will automatically register itself with your Adafruit IO account.

From there, you can add components to your board such as buttons, switches, potentiometers, sensors, and more! Components are dynamically added to hardware, so you can immediately start interacting, logging, and streaming the data your projects produce without writing code.

Sign up for Adafruit.io

You will need an Adafruit IO account to use WipperSnapper on your board. If you do not already have one, head over to io.adafruit.com to create a free account.

Add a New Device to Adafruit IO

Log into your Adafruit IO account. Click the New Device button at the top of the page.

After clicking New Device, you should be on the board selector page. This page displays every board that is compatible with the WipperSnapper firmware.

In the board selector page's search bar, search for the Feather ESP32 V2. Once you've located the board you'd like to install WipperSnapper on, click the Choose Board button to bring you to the self-guided installation wizard.

Follow the step-by-step instructions on the page to install Wippersnapper on your device and connect it to Adafruit IO.

If the installation was successful, a popover should appear displaying that your board has successfully been detected by Adafruit IO.

Give your board a name and click "Continue to Device Page".

You should be brought to your board's device page.

Next, Visit this guide's WipperSnapper Essentials pages to learn how to interact with your board using Adafruit IO.

Feedback

Adafruit.io WipperSnapper is in beta and you can help improve it!

If you have  suggestions or general feedback about the installation process - visit https://io.adafruit.com/support, click "Contact Adafruit IO Support" and select "I have feedback or suggestions for the WipperSnapper Beta".

Troubleshooting

If you encountered an issue during installation, please try the steps below first.

If you're still unable to resolve the issue, or if your issue is not listed below, get in touch with us directly at https://io.adafruit.com/support. Make sure to click  "Contact Adafruit IO Support" and select "There is an issue with WipperSnapper. Something is broken!"

I don't see my board on Adafruit IO, it is stuck connecting to WiFi

First, make sure that you selected the correct board on the board selector.

Next, please make sure that you entered your WiFi credentials properly, there are no spaces/special characters in either your network name (SSID) or password, and that you are connected to a 2.4GHz wireless network.

If you're still unable to connect your board to WiFi, please make a new post on the WipperSnapper technical support forum with the error you're experiencing, the LED colors which are blinking, and the board you're using.

I don't see my board on Adafruit IO, it is stuck "Registering with Adafruit IO"

Try hard-resetting your board by unplugging it from USB power and plugging it back in.

If the error is still occurring, please make a new post on the WipperSnapper technical support forum with information about what you're experiencing, the LED colors which are blinking (if applicable), and the board you're using.

"Uninstalling" WipperSnapper 

WipperSnapper firmware is an application that is loaded onto your board. There is nothing to "uninstall". However, you may want to "move" your board from running WipperSnapper to running Arduino or CircuitPython. You also may need to restore your board to the state it was shipped to you from the Adafruit factory. 

Moving from WipperSnapper to CircuitPython

Follow the steps on the Installing CircuitPython page to install CircuitPython on your board running WipperSnapper.

  • If you are unable to double-tap the RST button to enter the UF2 bootloader, follow the "Factory Resetting a WipperSnapper Board" instructions below.

Uploading this sketch will overwrite WipperSnapper. If you want to re-install WipperSnapper, follow the instructions at the top of this page.

Moving from WipperSnapper to Arduino

If you want to use your board with Arduino, you will use the Arduino IDE to load any sketch onto your board.

First, follow the page below to set up your Arduino IDE environment for use with your board.

Then, follow the page below to upload the "Arduino Blink" sketch to your board.

Uploading this sketch will overwrite WipperSnapper. If you want to re-install WipperSnapper, follow the instructions at the top of this page.

Factory Resetting a WipperSnapper Board

Sometimes, hardware gets into a state that requires it to be "restored" to the original state it shipped in. If you'd like to get your board back to its original factory state, follow the guide below.

Usage

Assuming you have already gone through the WipperSnapper Setup page and connected your board to WipperSnapper, navigate to the WipperSnapper board list.

On this page, select the WipperSnapper board you just connected.

  • If you do not see your board listed - go back to the WipperSnapper Setup Page and make sure it registers with Adafrut.io

On the device page, quickly check that your device is online and is running the latest version of the WipperSnapper firmware.

The device tile on the left indicates the version number of the firmware running on the connected board.

Click the New Component button or the + button to bring up the component picker.

Under PWM Components, select the Piezo Buzzer.

Next, Select Pin D14 as the Piezo Buzzer Pin.

WipperSnapper matches musical notes to frequencies, in Hertz. Select the musical note you'd like the Piezo to play when it's activated.

Click Create Component

The device page displays a new piezo buzzer component.

Clicking the switch will cause the Piezo buzzer to play the note you selected within the component setup - piezo buzzer component. Setting the switch to the "off" position will stop the Piezo buzzer.

Modifying the Piezo Buzzer's Note

Is your buzzer's tone too high-pitched or too quiet? To modify the note played by the buzzer, click the cog on the top-right of the Wippersnapper piezo component and select a new tone from the dropdown labeled Note.

Follow the guide below to set up the AHT20 on the same device you've been using. The sensor board is connected to the Feather board using a Stemma QT cable - plug and play.

Now, you should have both sensors on the same device page. Click the gear on one of the AHT20's sensors.

Disable all the sensors except for temperature sensor you're going to use. In this example, I'm using the Fahrenheit feed.

Now click 'Update Component'.

Click the tab labeled Actions and then click New Action.

Click the tab labeled Actions and then click New Action. Choose the Reactive Action option.

Fill out the options for this action like so. You can set whatever number you want for the comparison value or feed. I chose 80 so it'd let me know when my apartment is getting a bit hot. The value you set the feed to is the note it will play. I'm setting it to 785 (Hertz), which is G5 on the musical scale.

Make another reactive action and this time set it up so that it's less than or equal to the comparison value you set above and that it sets the feed to 0, or off.

Now, whenever the temperature goes above 80 degrees, the alarm will play until the temperature is lower.

This guide was first published on Jan 10, 2023. It was last updated on Mar 08, 2024.