0% found this document useful (0 votes)
20 views

Arduino KEY F

The project report details the design and development of an Arduino-based music keyboard that simulates a musical instrument using an Arduino Uno microcontroller. It allows users to play musical notes through push buttons, with features for recording and playback, making it accessible for both beginners and experienced users. The report also discusses the project components, implementation, challenges, and potential future improvements for enhanced functionality and user experience.

Uploaded by

gokulak723
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Arduino KEY F

The project report details the design and development of an Arduino-based music keyboard that simulates a musical instrument using an Arduino Uno microcontroller. It allows users to play musical notes through push buttons, with features for recording and playback, making it accessible for both beginners and experienced users. The report also discusses the project components, implementation, challenges, and potential future improvements for enhanced functionality and user experience.

Uploaded by

gokulak723
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

ARDUINO BASED MUSIC KEYBOARD

A PROJECT REPORT
Submitted by
GOKULA KRISHNAN S - 712821106016
KISHOR S - 712821106022
PRABHU M - 712821106031
SRIRAM G - 712821106053

in partial fulfillment for the award of the degree of

BACHELOR OF ENGINEERING
In
ELECTRONICS AND COMMUNICATION

RVS COLLEGE OF ENGINEERING AND TECHNOLOGY


(An Autonomous Institution)
COIMBATORE-641 402
BATCH : 2021 - 2025

1
RVS COLLEGE OF ENGINEERING AND TECHNOLOGY
(An Autonomous Institution)
Coimbatore – 641402

BONAFIDE CERTIFICATE

Certified that this project work “Arduino Based Music Keyboard” is the
Bonafide work of

GOKULA KRISHNAN S - 712821106016


KISHOR S - 712821106022
PRABHU M - 712821106031
SRIRAM G - 712821106053

who carried out the project under my supervision.

SIGNATURE
Dr. B . SUGANTHI, M.E ,Ph.D,
ASSOCIATE PROFESSOR & HEAD,
Department of Electronics & Communication Engineering,
RVS College of Engineering and Technology,
Coimbatore -641402.

2
ABSTRACT
This project focuses on the design and development of an
Arduino-based music keyboard that combines both hardware
and software components to simulate a musical instrument.
Using an Arduino Uno microcontroller, the system interprets
user input from buttons, sensors, or touchpads that represent
piano keys. Each key is mapped to a specific frequency
corresponding to musical notes in the western chromatic scale.
When a key is pressed, the Arduino activates a piezo buzzer or
an external sound module, producing the corresponding
musical note. The primary objective is to create a simple,
affordable, and customizable platform that is easy to use,
making it accessible for both beginners and more experienced
users in the realm of electronic music production.

3
ACKNOWLEDGEMENT

We would like to express our heartfelt gratitude to our project


guide Dr. B. Suganthi, M.E, Ph.D for her invaluable guidance,
encouragement, and support throughout the development of
our project,"Arduino Based Music Keyboard".Our sincere
thanks to our project coordinator Mr.V.Venkateswaran,M.E,
for his constant support and supervision, ensuring that stayed
on track during the course of the project. Our gratitude goes to
RVS College of Engineering and Technology/Department of
Electronics and Communication Engineering for providing
the necessary resources and infrastructure to complete this
work. We extend our heartfelt thanks to other teaching and non
teaching faculty, our friends, and family for their constant
motivation and assistance, which played a crucial role in the
successful completion of this project.

4
TABLE OF CONTENTS

ABSTRACT--------------------------------------------------------------------- 3

ACKNOWLEDGEMENT------------------------------------------------------ 4

1.INTRODUCTION------------------------------------------------------------6

2.PROJECT DESIGN----------------------------------------------------------- 7

1. Components Used

2. Sound Generation

3. IMPLEMENTATION-------------------------------------------------------11

4. PROJECT CODE -----------------------------------------------------------22

5. RESULTS AND DISCUSSIONS----------------------------------------- 18

6. CONCLUSION--------------------------------------------------------------21

REFERENCES-----------------------------------------------------------------22

5
INTRODUCTION :
Music is a universal language that transcends barriers
connecting people through rhythm and melody. It has the
power to evoke emotions, tell stories and bring people together,
regardless of culture. This project is designed using an Arduino
to create a simple and interactive musical instrument. The core
functionality relies on multiple input switches, such as push
buttons, which, when pressed, generate signals that trigger
corresponding musical tones. The Arduino reads these inputs in
a default low state, where the buttons are connected to ground,
and each button press activates a unique musical note based on
the frequency assigned to it.

In addition to basic note generation, the project incorporates an


optional feature for recording and playback. This allows users
to record a sequence of notes, effectively creating a custom
melody or tune. Once recorded, the melody can be replayed,
providing a simple but effective way to both play and store
music. By adding features like playback functionality, this
project can evolve into a basic digital recorder, enhancing the
musical experience with the ability to replay compositions.

6
2. PROJECT DESIGN
2.1 Components Used

1. Arduino Board

Fig 1 : Arduino Uno

The Arduino is the main controller that makes everything work.


It takes care of reading the signals from the push buttons and
deciding which musical note to play when a button is pressed.
The Arduino can generate sounds through a piezo buzzer or
speaker by sending specific signals to create different
frequencies. It uses simple code to process the button presses
and control the output sound. Additionally, by using MIDI, the
Arduino can send messages to other devices, like a computer or
synthesizer, to produce music. The Arduino is easy to use,
flexible, and works well with many components, making it the
perfect choice for building a music keyboard. It also allows us to
easily add new features as we expand the project.

7
2. Push Buttons / Switches

Fig 2 : Push buttons

A matrix of push buttons is used to represent the piano keys.


Each button corresponds to a specific musical note, and when
pressed, it sends a signal to the Arduino board, which then
processes the input to either generate a sound or send a MIDI
message. For simplicity, by using push buttons arranged in a
row or matrix configuration, minimizing the number of pins
required on the Arduino. When a button is pressed, the circuit
completes, and the Arduino detects the low or high signal,
depending on the wiring setup.

3. Piezo Buzzer

Fig 3 :Piezo Buzzer

The piezo buzzer is used to generate sound signals for the


musical notes when a key is pressed.A piezo buzzer is an
inexpensive and easy-to-use component capable of producing
sound at different frequencies. By using the tone() function in
Arduino, could generate specific frequencies corresponding to
musical notes.
8
4. Resistors

Fig 4 : Resistors

Used for pull-up or pull-down configurations for the pushbutton


matrix to prevent floating pin issues.

5. Wires and Breadboard

Fig 5 :Wires and Breadboard

Wires and a breadboard are essential for connecting and


organizing the components. Wires are used to link the Arduino
to the push buttons, piezo buzzer, resistors, and other
components, allowing electrical signals to flow between them.
Jumper wires, which come with connectors at both ends, make
these connections easy and secure. The breadboard provides a
convenient, solder-free platform for building the circuit. It has
rows for power and ground connections and a grid of holes to
place and link components like resistors and buttons.
9
6. LCD

Fig 6 : LCD
The LCD serves as an interface to display various information
such as the currently played note, the status of recording or
replaying, and other relevant data like tempo or key mappings.
With this visual feedback, users can easily track their actions
and make adjustments during recording or playback. The
integration of an LCD helps to create an intuitive, interactive
system that allows musicians to engage with the project
effectively, providing both functional and aesthetic value to the
project.

2.2 Sound Generation

Sound generation is achieved using a piezo buzzer. The buzzer


is controlled through the Arduino's digital output pins, where
different frequencies are used to produce specific musical
notes.When a key on the keyboard is pressed, the Arduino reads
the input and triggers the `tone()` function, which generates a
square wave at the frequency corresponding to the musical note
assigned to that key. The `tone()` function takes two
parameters: the pin number connected to the buzzer and the
frequency of the sound in Hertz (Hz).

10
3. IMPLEMENTATION
The push buttons are connected to the digital pins of the
Arduino.Use pull-up or pull-down resistors to ensure stable
signal readings from the buttons.The piezo buzzer is connected
to another pin on the Arduino for sound output.

1. Reading Input: The state of each button is monitored by the


Arduino using digitalRead().
2. Generating Notes: The tone() function is used to generate
sound. Each button corresponds to a frequency for musical
notes, such as:
o C4: 261 Hz
o D4: 294 Hz
o E4: 330 Hz, etc.
3. Debouncing: To avoid multiple readings when a key is pressed,
debouncing techniques are used in the software. This ensures
that each key press results in only one note being played.

11
4 . PROJECT CODE
#include <LiquidCrystal.h>
int notes[] = {262, 294, 330, 349, 392, 440, 494, 523}; // Set frequency
for C4, D4, E4,
F4, G4, A4, B4, C5
const int rs = 8, en = 9, d4 = 10, d5 = 11, d6 = 12, d7 = 13; //Pins to which
LCD is connected
LiquidCrystallcd(rs, en, d4, d5, d6, d7);
char button = 0;
int analogVal;
char REC = 0;
int recorded_button[200];
int pev_button;
int recorded_time [200];
char time_index;
char button_index = 0;
unsigned long start_time;
int note_time;

void setup()
{
Serial.begin(9600);
pinMode (6, INPUT);
lcd.begin(16, 2); //We are using a 16*2 LCD display
lcd.print("Arduino Piano"); //Display a intro message
lcd.setCursor(0, 1); // set the cursor to column 0, line 1
lcd.print("-CircuitDigest"); //Display a intro message
delay(2000); //Wait for display to show info
lcd.clear(); //Then clean it

12
}

void loop()
{
while (digitalRead(6) == 0) //If the toggle switch is set in recording
mode
{
lcd.setCursor(0, 0); lcd.print("Recording..");
lcd.setCursor(0, 1);
Detect_button();
Play_tone();
}

while (digitalRead(6) == 1) //If the toggle switch is set in Playing mode


{
lcd.clear();
lcd.setCursor(0, 0); lcd.print("Now Playing..");
for (int i = 0; i<sizeof(recorded_button) / 2; i++)
{
delay((recorded_time[i]) * 10); //Wait for before paying next tune
if (recorded_button[i] == 0)
noTone(7); //user dint touch any button
else
tone(7, notes[(recorded_button[i] - 1)]); //play the sound
corresponding to the button touched by the user
}
}
}

13
void Detect_button()
{
analogVal = analogRead(A0); //read the analog voltag on pin A0

pev_button = button; //remember the previous button pressed by the


user

if (analogVal< 550)
button = 8;

if (analogVal< 500)
button = 7;

if (analogVal< 450)
button = 6;

if (analogVal< 400)
button = 5;

if (analogVal< 300)
button = 4;

if (analogVal< 250)
button = 3;

if (analogVal< 150)
button = 2;

if (analogVal< 100)
button = 1;
14
if (analogVal> 1000)
button = 0;

/****Rcord the pressed buttons in a array***/


if (button != pev_button&&pev_button != 0)
{
recorded_button[button_index] = pev_button;
button_index++;
recorded_button[button_index] = 0;
button_index++;
}
/**End of Recording program**/
}
void Play_tone()
{
/****Rcord the time delay between each button press in a array***/
if (button != pev_button)
{
lcd.clear(); //Then clean it
note_time = (millis() - start_time) / 10;
recorded_time[time_index] = note_time;
time_index++;
start_time = millis();
}
/**End of Recording program**/
if (button == 0)
{
noTone(7);

15
lcd.print("0 -> Pause..");
}
if (button == 1)
{
tone(7, notes[0]);
lcd.print("1 -> NOTE_C4");
}
if (button == 2)
{
tone(7, notes[1]);
lcd.print("2 -> NOTE_D4");
}
if (button == 3)
{
tone(7, notes[2]);
lcd.print("3 -> NOTE_E4");
}
if (button == 4)
{
tone(7, notes[3]);
lcd.print("4 -> NOTE_F4");
}
if (button == 5)
{
tone(7, notes[4]);
lcd.print("5 -> NOTE_G4");
}
if (button == 6)
{
tone(7, notes[5]);
16
lcd.print("6 -> NOTE_A4");
}
if (button == 7)
{
tone(7, notes[6]);
lcd.print("7 -> NOTE_B4");
}
if (button == 8)
{
tone(7, notes[7]);
lcd.print("8 -> NOTE_C5");
}
}

17
5 . RESULTS & DISCUSSION
5.1 Software simulation :

Fig 7:

Software connection
Fig 7 shows the hardware connections between the Arduino
microcontroller, the key switches, and the audio output components,
forming the basis for the functioning of the music keyboard.

Fig 8 : Proteus Output


Fig 8 shows circuit diagram shows the output for hardware connections .
18
5.2 Hardware Implementation :

Fig 9 : Hardware Output

Fig 9 outlines the hardware connections between Arduino and


keyboard which results in the prototype of the project and makes
musical tones.
19
5.3 Challenges And Limitations
For future work, the limitations of this Arduino-based musical
instrument can be addressed by incorporating several improvements to
enhance both its functionality and user experience. To overcome the
limited sound quality, an external speaker or digital-to-analog converter
(DAC) could be integrated to produce higher-quality, more nuanced
audio. Additionally, the input interface could be upgraded by using
capacitive touch sensors or pressure-sensitive pads, allowing for
dynamic key sensitivity and more natural interaction. To address
memory constraints, optimizing the code and using more advanced
hardware, such as a more powerful microcontroller, could enable the
storage and playback of complex melodies. Expanding scalability could
involve adding more keys, MIDI output support, or incorporating sound
synthesis features. Lastly, enhancing the user interface by adding a
display or feedback system could provide a more intuitive and
20
interactive experience, improving both the ease of use and enjoyment of
the instrument.

6 . CONCLUSION
The Arduino based music keyboard project demonstrates the
fusion of basic electronics with creative expression, offering an
accessible introduction to sound generation, input handling, and
digital signal processing. Despite its simplicity, using push buttons and
a piezo buzzer to generate musical notes, the project serves as a solid
foundation for exploring music and electronics. While the sound
quality is limited and the user interface lacks advanced features like
touch or pressure sensitivity, the project highlights the potential for
future improvements, such as better audio output, expanded key
count, and enhanced user interfaces. With further development, this
project could evolve into a more sophisticated musical instrument or
MIDI controller, allowing users to innovate and expand their skills in
both music and electronics.
21
REFERENCES :

1. T. Carter, S. A. Seah, B. Long, B. Drinkwater, and S. Subramanian,


“Ultrahaptics: multi-point mid-air haptic feedback for touch surfaces.” in
UIST, S. Izadi, A. J. Quigley, I. Poupyrev, and T. Igarashi, Eds. ACM, 2013,
pp. 505–514. [Online]. Available: http://dblp.
uni-trier.de/db/conf/uist/uist2013.html#CarterSLDS13
2. Goodwin and R. D. Green, “Key detection for a virtual piano teacher,” in
IVCNZ, 2013, pp. 282–287.
3. F. Huang, Y. Zhou, Y. Yu, Z. Wang, and S. Du, “Piano ar: A markerless
augmented reality based piano teaching system,” in 2011 Third
International Conference on Intelligent Human-Machine Systems and
Cybernetics, U. IEEE Computer Society Washington, DC, Ed.

22
4. T. Maki-patola and P. H ¨ am¨ al¨ ainen, “Latency toler- ¨ ance for gesture
controlled continuous sound instrument without tactile feedback,” in
Proc. International Computer Music Conference (ICMC), 2004, pp. 1–5.
5. R. Parncutt and M. Troup, “Piano,” in The Science & Psychology of Music
Performance: Creative Strategies for Teaching and Learning, 2011.
6. I. Rizkiansyah, “PengembanganAplikasiPembelajaranIneraktif Teknik
Bermain Piano Berbasis Multimedia di Lembaga KursusMusik ‘Ethnictro’
Yogyakarta,” J. Inform., 2015.
7. K. M. Rizki, R. Maulana, and W. Kurniawan, “Implementasi Sensor
Piezoelectric Sebagai Prototype AlatMusik Piano Berbasis Arduino UNO,”
vol. 2, no. 11, 2018.

Sangmi Lee &Soook Cha, “A Study on the Music Education Environment


and Teacher Recognition according to the Types of Nursery Facilities”,
Korea Education Inquiry, vol 29, no. 2, pp. 22-57, December. 2011.

23

You might also like