Introduction: Simple Musical Instrument
This is a simple musical instrument consisting of a button, a speaker and a potentiometer. There is also an LCD Display to let you know the note you are playing, but it is not necessarily required to make the instrument.
Step 1: Build the Circuit
Parts
- Arduino (I used an Arduino Uno)
- Push button switch
- 10K Ohm resistor
- Potentiometer
- Speaker or Piezo (I used a speaker I took from an old land-line phone)
- Optional: LCD Display and 220 Ohm resistor
Build the circuit as shown in the design. The LCD is the standard arduino way to connect, except that pin 9 is used to control contrast (which allows for one less potentiometer to be used, since breadboard real estate is valuable when an LCD is used).
Step 2: The Code
The code is very simple and uses intervals of the potentiometer reading to create different switch cases. The button is used in the input pullup mode, and a tone corresponding to the potentiometer position is played whenever it is pressed.
This project is currently written in the Key of C, but a button (or potentiometer) could easily be added to allow for key changes for you more advanced musicians/engineers.