Arduino KEY F
Arduino KEY F
A PROJECT REPORT
Submitted by
GOKULA KRISHNAN S - 712821106016
KISHOR S - 712821106022
PRABHU M - 712821106031
SRIRAM G - 712821106053
BACHELOR OF ENGINEERING
In
ELECTRONICS AND COMMUNICATION
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
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
4
TABLE OF CONTENTS
ABSTRACT--------------------------------------------------------------------- 3
ACKNOWLEDGEMENT------------------------------------------------------ 4
1.INTRODUCTION------------------------------------------------------------6
2.PROJECT DESIGN----------------------------------------------------------- 7
1. Components Used
2. Sound Generation
3. IMPLEMENTATION-------------------------------------------------------11
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.
6
2. PROJECT DESIGN
2.1 Components Used
1. Arduino Board
7
2. Push Buttons / Switches
3. Piezo Buzzer
Fig 4 : Resistors
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.
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.
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();
}
13
void Detect_button()
{
analogVal = analogRead(A0); //read the analog voltag on pin A0
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;
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.
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 :
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.
23