Keypad Module Piano With RGB LED

Intro

Hello ladies and gentleman, welcome to my very first instructable! Today, I will be teaching you how to create a piano with main components being a keypad module and a piezo buzzer and have it able to play DO-RE-MI and so on.

The keypad module most often intended purpose, is to be a keypad combined with an arduino RFID to create a safe box for valuable items. In this case I changed the keypad, instead of protecting something I decide to use to speak the simple joy and music.

Idea Concept

The idea concept for this creation, evolve from a simple happy memory while playing the xylophone when I was younger in music class. The amount of joy and excitement running through my body was at its peak, I mean every kid was easily satisfied and my satisfaction was playing the xylophone.

Research

After your idea light bulb above lights up, a little research must be done. After browsing the web for sometime, I can came across my idea I initially thought of! A keypad module turned piano, someone has created the same project video here. Thinking ahead I needed to add a separate component that would further enhance the project but make it more engaging and be able to call it my own.

Step 2: Building Time!

4x4 Keypad Module & Piezo Buzzer

Theory

As the 4x4 keypad module and piezo buzzer contain so many individual pin input and I'll decide to split the components used into two pairs. Focusing on the keypad, usually used as a input. The SunFounder 4*4 Matrix Keypad Module is a matrix non- encoded keypad consisting of 16 keys in parallel, The keys of each row and column are connected through the pins outside – pin Y1-Y4 as labeled beside control the rows, when X1-X4, the columns.

Purpose

Purpose of these components to the entire project, is to allow the user to press a button which is set to a specific sound created by the piezo buzzer through frequency in hertz.

Matrix Module Pin - Arduino Pin

4 - 2

3 - 3

2 - 4

1 - 5

5 - 6

6 - 7

7 - 8

8 - 13

Piezo Buzzer - Arduino Pin

Black - GND

Red - Power

My most difficult task in this build is figuring out where each wire is plugged into. Above I provide you and quick and easy how to way of the wire locations, as long as followed top to bottom, tip is take your time and make sure every pin is correctly inserted into the right slot.

*Tip is to follow where each wire is location from one end to another.

All Tinkercad sketch of the specific component wires are colour coded correctly so follow along carefully.

Step 3: Sound Sensor Module and RGB LED

Sound Sensor Module and RGB LED

Theory

The sound sensor module allows you to detect when sound has exceeded a set point you select. Sound is detected via a microphone and fed into an LM393 op amp. Once sound level exceeds the set point, an LED on the module is illuminated and the output.

Purpose

Purpose of these components to the entire project, is to obtain a sound/volume reading of the sound sensor module and through that reading an RGB LED will activate the correct colour pertaining to sound.

Sound Sensor Module - Arduino Pin (Use 3 Pin Jumper Wire)

Output - A0 Analog Pin

GND - Any open GND pin slot

VCC - 3V

RGB Common Anode (+) LED - Arduino Pin

Red - 9

Power - 5V

Green - 10

Blue - 11

Keep in mind to wire, each individual wire through a 330 ohm resistor. Use the picture above as reference.

My most difficult task in this build is figuring out where each wire is plugged into. Above I provide you and quick and easy how to way to of wire locations, as long as followed top to bottom, tip is to take your time and make sure every pin is correctly inserted into the right slot to prevent future debugging.

*Tip is to follow where each wire is inserted either way.

All Tinkercad sketch of the specific component wires are colour coded correctly so follow along.

Step 4: Code

Code

This code allows all the components to work together by using newly defined function to contain all the many controls a single component that has many changeable variables those components were the RGB led and using rgb colour to change the colour while on and the piezo buzzer and the sound it would make depending on the button push.

pinMode(speakerPin, OUTPUT); // sets the speakerPin to be an output
pinMode(redPin, OUTPUT); // sets the red pin to be an output
pinMode(greenPin, OUTPUT); // sets the green pin to be an output
pinMode(bluePin, OUTPUT); // sets the blue pin to be an output

Attachments

Step 5: Final Thoughts

Final Thoughts

Final thoughts of this project is its intended purpose is to be a toy, to bring fun and simplistic joy. As this project is a complete and working on, I believe this build and can furthered with maybe more components such as a recording element, or copy/simon says element, or even LCD with the notes appearing to play a specific song.

I would love to know your opinion about the Keypad Module, what components you thought could have been added. Are you going to use it in any of your projects? Please post your ideas in the comments section below.