Making sounds with a piezo
)# What is 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 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.
To get started quickly you can use one of the examples from the Arduino examples menu: