Piezoelectric speakers are frequently used as beepers in watches and other electronic devices. In this project, a piezo speaker is used to play melodies. It sends a square wave of the appropriate frequency to the piezo, generating the corresponding tone.

Connect the red wire of a piezo speaker to Arduino's PWM pin 9, and the black wire to ground. Use the Arduino code "Melody" to play different notes.