Skip to content

Arduino Piano with recording and playback

License

Notifications You must be signed in to change notification settings

amateomi/arduino-piano

Repository files navigation

Arduino Piano with recording and playback

piano

About The Project

My course project on circuit engineering. I always wanted to try programming microcontrollers and design and assemble electronic circuits by hand. From a circuitry point of view, the project is quite simple: a couple of buttons and resistors used in a voltage divider. The project does not use third-party libraries, so there should be no problems with compiling and loading into the Arduino Uno board.

Components

The device consists of several logical modules, the description of which is given below.

Analog keyboard

Analog keyboard for playing notes of one octave is represented by the S2-S8 buttons. To play sharps (black keys on the piano), you must simultaneously press adjacent buttons (for example, S2 and S3). The buttons control the inclusion of resistors R2-R8 to the voltage divider circuit. I chose 560Om, 1.3kOm, 2.7kOm, 3.9kOm, 5.6kOm, 7.5kOm and 10kOm resistors but this is not strictly necessary. You can use other similar values for resistors, but then you will have to change the corresponding values in the arduino-piano.ino file.

Buzzer

The sound is generated by the SG1 buzzer. Volume and sound quality may vary by model.

Octave switch

Buttons S14 and S13 are used to switch between octaves. Piano middle octave is initially selected. Pressing S14 will lower the octave, and pressing S13 will raise the octave.

Recorder

Button S12 is used to control the recording of the melody. The first press starts recording. After that, all clicks on the analog keyboard will be recorded in the device's memory, taking into account delays. Pressing again ends the recording of the melody. You can record several melodies of different lengths. If the device runs out of memory for recording a melody, a specific sound signal will be played and subsequent recording attempts will have no result.

Player

Buttons S9 and S10 are used to select recorded tunes for playback. The mechanism for controlling them is similar to switching between octaves. Pressing the S11 button will start playback of the currently selected melody.

Arduino Uno

Arduino Uno board reads user input from the buttons and processes it. It also feeds the entire circuit through the corresponding pins. All key functions of the device are logged via the Serial port and transmitted to the PC via a USB cable, which also powers the board itself.

Note

If you find a bug or have a question, feel free to leave an issue.