Description: This is a fun synthesizer using an Arduino and a piezo buzzer. This synth has 7 keys, adjustable octaves, customizable note configurations, a recording function, playback function, and adjustable playback speed via potentiometer!
How it works: The heart of this project is the Piezo Buzzer. When an alternating voltage is applied (in our case, a square wave), the material inside the buzzer vibrates rapidly, producing sound. We can control the frequency of the vibrations by adjusting the frequency of our square wave!
So, how does controlling the frequency of the vibrations turn this project into a real keyboard? I knew nothing about music when this project started, so this part was interesting to learn. A musical note is defined by the frequency of the sound wave produced. An octave is a series of eight notes (C,D,E,F,G,A,B,C). So, all notes have a base frequency, and to move a note to the next octave is to simply double its frequency!
Example:
A Note Base Frequency (octave 0) = 55Hz
Next octave (octave 1) = 55Hz * 2 = 110Hz
Next octave (octave 2) = 110Hz * 2 = 220Hz
Formula for octaves = noteBaseFrequency * 2octave
So an A note in octave three = 55Hz * 23 = 55Hz * 8 = 440Hz
This keyboard simply sets each key with a specified frequency to output, and adjusts octaves based on this formula!
Parts:
2x Breadboard
1x Arduino uno (or mega)
10x Momentary Push Button
12x 10k Ohm Resistor
2x 1k Ohm Resistor
1x Piezo Buzzer
2x Micro Slide Switch
1x Blue LED
1x Green LED
1x 1k Ohm Potentiometer
Hookup Diagram:

Schematics:

Github: https://github.com/TSJ-Electronics/ArduinoSynth
Any suggestions, comments or questions please let me know in the comment section below!