“Simple note” an Arduino musical instrument


Simple note works like a musical keyboard. It has 8 buttons which you can use to plays notes (C D E F G A B C) similar to a piano. Pitch and duration of the notes (Octaves) can be adjusted by a potentiometers or hard-coded in the code. The video below shows the circuit in action:
The board is shown in the picture above. Its better to build the circuit on a bread board before soldering it on a piece of strip board. The schematics for the micro sequencer is shown below:
As shown above 6 push buttons are used on digital inputs (pull up resistors, R1-R6 can be any value from 1K to 10K ohm) and two potentiometers are on Analog inputs (potentiometers can be any range from 1K to 50K ohm).
If you intend to increase the number of buttons or analog inputs simply copy the same component and connections and change the code accordingly. You can use a variety of sensors (LDRs, IR/Ultra Sonic distance meters, Force sensors, etc.) instead of the potentiometers.
This program uses the Arduino tone library to play music. Program reads the eight digital inputs and plays the corresponding tone for that key on digital pin 9 of Arduino. The music signal needs to be amplified with a small amplifier like an LM386 amplifier.
Button 1, 2, 3, 4, 5, 6, 7, 8: C, D, E, F, G, A, B, C tone in order
Analog input 0: Controls the duration of tones, if you don’t want the pot simply hard code “duration” variable in the code
Analog input 1: Controls the (pitch), if you don’t want the pot simply hard code “octave” variable in the code
Download the code from here.
You can change the tones order in the variable “Melody”, so the keys would come in another other like A,B,C,D,E,F,G.
For a complete list of tones that you can use refer to the ‘Public Constants’ here. There you can read about the tone library more.
More info
Here is a simple guide to music and music alphabets. Here you can read about mapping of frequency to notes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s