You are on page 1of 19

Mini project on Simple Piano using Arduino

+- K. L. E. SOCIETY’S

K. L. E. INSTITUTE OF TECHNOLOGY,

K.L.E.S. Opp. Airport, Gokul, Hubballi-580 027

Phone: 0836-2232681 Website: www.kleit.ac.in

A Mini Project Report on


“Automatic Living Room lights using IR sensor”
Computer Science & Engineering
Semester II
Introduction to embedded systems (BETCK205J)

Submitted By USN
1. Bhagyashree A 2KE22CS030
2. Aparna N H 2KE22CS024
3. Chandrika K 2KE22CS036
4. Deepa G T 2KE22CS043

Under the Guidance of


Mr. Rakesh H.M
Assistant Professor
Dept. of ECE, KLEIT, HUBBALLI

1
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

Subject Code: BETCK205J


+- K. L. E. SOCIETY’S

K. L. E. INSTITUTE OF TECHNOLOGY,

K.L.E.S. Opp. Airport, Gokul, Hubballi-580 027

Phone: 0836-2232681 Website: www.kleit.ac.in

CERTIFICATE
This is to certified that the mini-project work entitled “Simple Piano using Arduino”
is a bonafide work carried out by Ms. Bhagyashree A bearing USN:2KE22CS030,
Ms. Aparna N H bearing USN:2KE22CS024, MS. Chandrika K bearing
USN:2KE22CS036, Ms. Deepa G T bearing USN:2KE22CS043, in a partial
fulfilment for the award of degree of Bachelor of Engineering in II Semester,
Computer Science and Engineering of Visvesvaraya Technological University,
Belagavi, during the year, 2022-23. It is certified that all corrections / suggestions
indicated for internal assessment have been incorporated in the report deposited in the
department library. The mini project has been approved as it satisfies the academic
requirements in respect of mini project work prescribed for the said degree.

Project Guide First year coordinator


(Mr. Rakesh H.M) (Dr Gangadhar. B. Bagihalli)

2
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

ACKNOWLEDGEMENT

On the successful completion of this mini-project work, We would like to


acknowledgement and extend our heartfelt gratitude to the following people who
supported us to complete the project.

To our beloved Principal Dr. Sharad Joshi, for providing an ideal atmosphere to
pursue our objectives under his administration.

We are also thankful to Dr Santosh Nejakar, Head of Electronics and


Communication Engineering Department, who has given valuable suggestions
during the work and his moral support and encouragement.

We are thankful to our guide Mr. Rakesh B Shettar Electronics and


Communication
Engineering Department of for his encouragement, effective guidance and valuable
suggestions right from the beginning of the project till its completion, without
which
the project work would not have been accomplished. We are greatly in debted to
him.

We would like to express our heartfelt thanks to our project Co-ordinator and all
the
teaching faculty and staff members of the department of Electrical and Electronics
Engineering for constructive suggestion and constant encouragement.
We also thank our parents and all our friends whole heartedly who have rendered
their help, motivation and support to accomplish this project.

BHAGYASHREE A

3
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

APARNA N H
CHANDRIKA K
DEEPA G T

INDEX

Contents Page no.

1. Abstract…………………………………………………………………………..5

2. Introduction…………………………………..………………………………….6

3. Problem Definition……………………………………………………………....7

4. Hardware and Software Requirements…………………….………………….8

5. Methodology……………………………………………………………………..13

6. Advantages and Applications..............................................................................15

7. Conclusion ………………………………………………………………………16

4
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

ABSTRACT

This project presents the design and implementation of a simple piano using Arduino, aimed
at creating an interactive musical instrument for educational and recreational purposes. The
project leverages Arduino's hardware capabilities and programming environment to integrate
physical sensors as keys and generate musical notes through sound output components. By
mapping sensor activations to MIDI messages, the piano allows users to produce audible
notes in response to their interactions. The project serves as a practical introduction to
electronics, programming, and MIDI communication while offering opportunities for
customization and creative expression. The piano's cost-effectiveness, accessibility, and
educational value make it a valuable tool for beginners, educators, and hobbyists seeking to
explore the convergence of technology and music.

5
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

INTRODUCTION

Building a simple piano using Arduino is a fun and educational project that combines
electronics and music. This project allows you to create a basic musical instrument with the
Arduino platform. To start, you'll need an Arduino board (such as Arduino Uno), buttons or
touch sensors, and a piezo buzzer. The buttons or touch sensors will act as your piano keys,
and when pressed, they will trigger the piezo buzzer to produce musical notes. The notes can
be generated by sending specific frequency values to the buzzer. By programming the
Arduino using the Arduino IDE, you can map each button or touch sensor to a specific note
and control the duration of the note's sound.

The key steps involve setting up the hardware by connecting the buttons or touch sensors and
the piezo buzzer to the appropriate pins on the Arduino board. You'll then write the Arduino
code, which includes defining the pins for the sensors and the buzzer, creating an array of
note frequencies, and using conditional statements to play the corresponding notes when a
button is pressed or a touch sensor is activated. By iterating through the array and controlling
the buzzer's output, you can generate melodies and play simple tunes.

This project provides an excellent opportunity to learn about digital input and output, arrays,
conditional statements, and the basics of generating sound using a piezo buzzer. It's a great
way to combine creativity and technology, and you can even expand upon it by adding more
keys, experimenting with different melodies, or incorporating additional features. Whether
you're a beginner looking to delve into electronics or an enthusiast interested in combining
music and technology, building a simple piano using Arduino is a rewarding endeavor that
showcases the intersection of art and science.

6
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

PROBLEM DEFITNITION

The result of creating a simple piano using Arduino is an interactive musical instrument that
allows users to play notes and create melodies by interacting with physical sensors. When a
user presses a key (sensor), the Arduino generates MIDI messages that trigger corresponding
musical notes to be played through a sound output component, such as a piezo buzzer or a
speaker.
Key features and outcomes of the project:
1. *User Interaction: * Users can play musical notes by pressing the keys (sensors) of the
piano. Each key corresponds to a specific note, and the system responds in real-time to user
input.
2. *Sound Generation: * The Arduino generates MIDI messages that control the sound output
component. As a result, the sound output produces audible musical notes, creating a simple
but enjoyable musical experience.
3. *Note Mapping: * Each key's activation triggers a specific MIDI note or frequency,
allowing users to play different musical tones based on their interactions.
4. *Polyphony: * Depending on your project's design, the piano might support polyphony,
enabling users to play multiple notes simultaneously and create harmonies.
5. *Customization: * You can customize the project by adjusting note mappings, adding
octave shifts, implementing velocity-sensitive keys, or introducing modulation controls.
6. *Learning Experience: * Creating the piano provides hands-on experience in hardware
integration, software development, MIDI communication, and basic electronics. It's a great
way to learn about how musical instruments work.
7. *Creative Exploration: * Users can experiment with melodies, chords, and musical
patterns, fostering creativity and musical exploration.
8. *Educational Value: * The project can serve as an educational tool for teaching basic
concepts of electronics, programming, and sound generation to beginners.
9. *Showcase and Sharing: * Once completed, you can showcase your Arduino-based piano
to friends, family, or online communities. Sharing your project documentation can inspire
others and contribute to the maker culture.
Remember that the simplicity of the piano design allows for a foundational understanding of
these concepts. As you become more experienced, you can further enhance and expand the
project with additional features and complexities.

7
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

HARDWARE AND SOFTWARE REQUIREMENTS

*Hardware Requirements: *
1. *Arduino Board: * Choose a suitable Arduino board, such as Arduino Uno, Arduino Nano,
or Arduino Mega, depending on the number of sensors and features you want to incorporate.

FIG:1
Arduino Nano

2. *Sensors: *
Select appropriate
sensors for the keys.
Options include push
buttons, capacitive touch sensors, pressure sensors, or even light sensors for continuous
control.

FIG:2 Touch Sensor

8
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

3. *Sound Output Component: * Use a piezo buzzer, small speaker, or external MIDI
synthesizer module to generate sound based on the MIDI messages sent by the Arduino.

FIG:3 Peizo buzzer

4. *Wiring and Connectors: * Gather jumper wires, breadboard (if necessary), and connectors
to establish connections between sensors, sound output, and the Arduino.

FIG:4 Wiring and Connectors

9
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

5. *Power Supply: * Ensure a stable power supply for the Arduino and any additional
components. This could involve batteries, USB power sources, or external power adapters.

FIG:5 BATTERIES

6. *Enclosure (Optional): * Consider building or 3D-printing an enclosure to house the


Arduino and components, providing a neat and organized look to the final project.

FIG:6 Electrical Piano

10
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

*Software Requirements: *
#define T_C 262
#define T_D 294
#define T_E 330
#define T_F 349
#define T_G 392
#define T_A 440
#define T_B 493
#define T_C5 523

const int C5 = 10;


const int C = 9;
const int D = 8;
const int E = 7;
const int F = 6;
const int G = 5;
const int A = 4;
const int B = 3;

const int Buzz = 11;


const int LED = 13;

void setup ()
{
PinMode(LED, OUTPUT);
PinMode(C5, INPUT);
digitalWrite(C5,HIGH);

pinMode(LED, OUTPUT);

11
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

pinMode(C, INPUT);
digitalWrite(C,HIGH);

pinMode(D, INPUT);
digitalWrite(D,HIGH);

pinMode(E, INPUT);
digitalWrite(E,HIGH);

pinMode(F, INPUT);
digitalWrite(F,HIGH);

pinMode(G, INPUT);
digitalWrite(G,HIGH);

pinMode(A, INPUT);
digitalWrite(A,HIGH);

pinMode(B, INPUT);
digitalWrite(B,HIGH);

digitalWrite(LED,LOW);
}

void loop()
{ while(digitalRead(C5) == LOW)
{
tone(Buzz,T_C5);
digitalWrite(LED,HIGH);
}

12
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

while(digitalRead(C) == LOW)
{
tone(Buzz,T_C);
digitalWrite(LED,HIGH);
}

while(digitalRead(D) == LOW)
{
tone(Buzz,T_D);
digitalWrite(LED,HIGH);
}

while(digitalRead(E) == LOW)
{
tone(Buzz,T_E);
digitalWrite(LED,HIGH);
}

while(digitalRead(F) == LOW)
{
tone(Buzz,T_F);
digitalWrite(LED,HIGH);
}

while(digitalRead(G) == LOW)
{
tone(Buzz,T_G);
digitalWrite(LED,HIGH);
}

13
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

while(digitalRead(A) == LOW)
{
tone(Buzz,T_A);
digitalWrite(LED,HIGH);
}

while(digitalRead(B) == LOW)
{
tone(Buzz,T_B);
digitalWrite(LED,HIGH);
}

noTone(Buzz);
digitalWrite(LED,LOW);

14
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

METHODOLOGY

The methodology for creating a simple piano using Arduino involves a step-by-step process
that encompasses both hardware setup and software development. Here's a basic outline of
the methodology:

*1. Planning and Design: *


- Define the number of keys you want for your piano and select the appropriate sensors
(push buttons, touch sensors, etc.).
- Determine the sound output component (piezo buzzer, speaker, etc.) and the type of
enclosure you'll use.
- Decide on the layout of the keys, including note mapping and any additional features
(octave shifting, modulation, etc.).

*2. Gather Components: *


- Acquire the chosen Arduino board, sensors, sound output component, wires, connectors,
power supply, and any necessary tools.

*3. Hardware Assembly: *


- Connect the sensors to the digital or analog pins of the Arduino, depending on the type of
sensors used.
- Connect the sound output component (piezo buzzer or speaker) to a suitable pin on the
Arduino.
- Ensure proper wiring and connections, using a breadboard if needed for a temporary
setup.

*4. Code Development: *


- Write the code using the Arduino IDE or a code editor of your choice.
- Include the necessary libraries, like the MIDI library if you're using it.
- Create functions to handle sensor inputs, generate MIDI messages, and control sound
output.
- Implement note mapping, where each sensor triggers a specific MIDI note.

15
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

*5. MIDI Communication: *


- Establish a Serial connection between the Arduino and your computer or MIDI
synthesizer module.
- Set up the communication protocol to send MIDI messages (Note On and Note Off) based
on sensor inputs.

*6. Sound Generation: *


- Develop logic to play the appropriate MIDI notes on the sound output component when
sensors are activated.
- Manage timing to ensure accurate note duration and avoid overlapping sounds.

*7. Test and Debug: *


- Upload the code to the Arduino and test the functionality of the piano.
- Monitor the Serial communication using the Serial Monitor to ensure MIDI messages are
being sent correctly.

*8. Iteration and Refinement: *


- Fine-tune the note mapping, timing, and overall responsiveness of the piano.
- Incorporate any additional features or enhancements based on your initial design.

*9. Enclosure and Finalization: *


- If desired, design and create an enclosure using CAD software or other tools.
- Assemble the components within the enclosure, ensuring proper placement and secure
connections.

*10. Documentation: *
- Document your project, including the hardware setup, circuit diagram, code explanation,
and any troubleshooting steps.
- Share your project online if you'd like to contribute to the maker community.

16
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

FIG: CIRCUIT DIAGRAM

17
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

ADVANTAGES AND APPLICATIONS

*Advantages: *

1. *Educational Tool: * The project serves as an engaging educational tool for learning about
electronics, programming, and basic sound generation principles. It's an excellent way to
introduce beginners, students, and enthusiasts to the world of STEM.

2. *Hands-On Learning: * Building the piano involves hands-on assembly, wiring, and
coding, fostering practical skills in circuit design, sensor integration, and software
development.

3. *Creativity and Expression: * Users can explore their creativity by composing melodies
and tunes on a simple piano. It encourages artistic expression through music.

4. *Low-Cost Prototyping: * The project can be implemented using affordable components,


making it an accessible prototyping platform for experimenting with interactive sound
devices.

5. *Customization: * Builders can customize the piano's design, layout, and sound to suit
their preferences. It's an opportunity to tailor the instrument to specific creative visions.

6. *Introduction to Electronics: * Aspiring electronics enthusiasts can gain insight into sensor
technology, wiring, and the interaction between hardware and software.

*Applications: *

1. *Education: * The simple piano can be utilized as an educational tool in schools,


workshops, and STEM programs to teach students about electronics and coding in a fun and
interactive way.

2. *Hobbyist Projects: * Enthusiasts can undertake the project as a hobby, combining their
interests in electronics and music to create a unique musical instrument.

3. *Interactive Art Installations: * Artists and creators can incorporate the simple piano into
interactive art installations that engage audiences in public spaces or galleries.

4. *Therapeutic Applications: * The instrument can be used in therapeutic settings to


encourage relaxation, creativity, and cognitive engagement through music.

5. *Demonstrations: * The piano can serve as a demonstration piece in technology expos,


maker fairs, and events that showcase DIY electronics projects.

18
Department of CSE K.L.E.I.T Hubballi
Mini project on Simple Piano using Arduino

6. *Music Education: * While it's a basic instrument, it can be used as a teaching aid in
introductory music classes to help students understand basic musical concepts.

7. *Rapid Prototyping: * For those interested in developing more complex musical


instruments, the simple piano can serve as a stepping stone for rapid prototyping and
experimentation.

CONCLUSION

In conclusion, the creation of a simple piano using Arduino brings together technology and
music to offer an engaging and educational experience. By integrating physical sensors,
sound output components, and code, individuals can transform their Arduino boards into
interactive musical instruments. This project serves as a stepping stone for beginners to delve
into electronics, programming, and MIDI communication while fostering creativity and
musical exploration.

Through the process of building and experimenting with the simple piano, users gain valuable
insights into hardware integration, software development, and the mechanics of musical
instruments. The ability to generate sound based on user interactions introduces a tactile and
auditory dimension to the learning journey, making concepts more tangible and
understandable.

Furthermore, the advantages of cost-effectiveness, customizability, and educational value


make this project accessible to a wide range of enthusiasts, students, and educators. It opens
doors to applications in music education, entertainment, creative expression, and even
therapeutic use.

19
Department of CSE K.L.E.I.T Hubballi

You might also like