Some materials (certain crystals, for example) produce a charge when they are deflected; this is called a piezoelectric effect. Materials which exhibit this property are called piezoelectric materials or piezo materials. If a piezoelectric material is sandwiched between two conductors, or electrodes, a voltage difference is produced between the electrodes when the material is deflected.
For this project, we will be creating a switch that can turn an LED on and off by simply bending a piezoelectric element.
In this project, we will be generating sound using a piezoelectric buzzer. We will initially explore how to generate different frequencies by cycling a digital pin from HIGH to LOW at different rates. We will then examine some of the fundamentals of music theory and how they can help us play music with our buzzer.