CIRC06: Music with Piezo

To this point we have controlled light, motion, and electrons. Let's tackle sound next. But sound is an analog phenomena, how will our digital Metro cope? We will once again rely on its incredible speed which will let it mimic analog behavior.

We are going to attach a piezo element to one of the Metro's digital pins. A piezo element makes a clicking sound each time it is pulsed with current. If we pulse it at the right frequency (for example 440 times a second to make the note middle A), these clicks will run together to produce notes.

Let's get to experimenting and make your Metro play "Twinkle Twinkle Little Star"!

This guide was first published on Aug 18, 2017. It was last updated on Aug 18, 2017. This page (CIRC06: Music with Piezo) was last updated on Mar 29, 2020.