Skip to main content

Making sounds with a piezo

'Piezo' normally refers to an electrical component which can be used to make sound, however more broadly a piezo is a component that is susceptible to the two-way piezoelectric effect where pressing or squeezing the piezo element can create a small voltage, and vice versa a small voltage can create a small expanding/contracting movement.

Practically this means you can use a piezo to make sounds like a simple speaker, or act as a contact microphone.

In this tutorial we'll look at wiring it up to Arduino with the Tone feature to create a melody.

Wiring

Wiring is simple, there are just two wires, applying power causes the piezo to expand, just as applying power to an LED causes it to illuminate.

  1. Ground
  2. Power

Diagram showing how to connect a piezo to the Arduino

Getting started

To get started quickly you can use one of the examples from the Arduino examples menu:

Screenshot: Arduino app showing File > Examples > 02. Digital > tonePitchFollower example in menu

Read more about tone()