Introduction: Custom Music Maker

Picture of Custom Music Maker

Hello!! This is my first time posting here. I would like to share to all of you about a project I made using arduino,the custom music maker.The project actually takes laptop keyboard as input and buzzer sound as output.This means that when we press some keys to our laptop keyboard, we will get some sound coming out from our buzzer, something like a piano!!!!! .Here are list of Items that will be used in this project:

1)Arduino Unox1

2)Buzzer x1

3)BreadBoard x1

4)Jumper Wires

5) resistor(optional, I did not use resistor in this project)

Softwares:

1)Processing IDE

2)Arduino IDE

Step 1: Assemble and Program the Circuit the Circuit

Picture of Assemble and Program the Circuit the Circuit

The Circuit were assembled as sketch(made by fritzing) above. Pretty easy right? Now Let's program the circuit for our keyboard input, we use Processing IDE and Arduino IDE for this.

PROCESSING IDE:


import processing.serial.*;// so that we can connect to arduino

Serial port;

void setup()

{

size(200,200);

port = new Serial(this, "COM21", 9600);//declaring our port that arduino uses

}

void draw()
{ }

void keyPressed()//this part shows the program for the keyboard key to be pressed

{
if(key == 'q'){ //example when key "q" is pressed

port.write('q'); //the processing IDE sends data "q" to arduino

}

if(key == 'w'){
port.write('w'); }

if(key == 'e'){
port.write('e'); }

if(key == 'r'){
port.write('r'); }

}

---------------------------the end------------------------------------------------------------------------

actually you can just add more keys under the void keyPressed function. I just show 4 example.

You can add more by this format:

if(key == alphabet){

port.write('alphabet');}

--------------------------------------------------------------------------------------------------

ARDUINO IDE:



int spk = 9;//buzzer pin

int val;//value = 0

void setup()
{

Serial.begin(9600); //set serial communication at 9600 bps

pinMode(spk,OUTPUT); }//set buzzer as output

void loop()
{

if (Serial.available()) { // if serial communication available
val = Serial.read(); //value is = to the what the processing read

if(val == 'q'){ //if value is equals to 'q'(means when we press 'q' the processing IDE sends data 'q' to arduino)

tone(spk, 1915,200); }//a tone will be produced with frequency 1915, period 200ms at pin 9(spk)

if(val == 'w'){
tone(spk, 1700,200); }

if(val == 'e'){
tone(spk, 1519,200); }

if(val == 'r'){
tone(spk, 1432,200); }

}

}

-------------the end--------------------------------------------------------------------

you can add more tone values for more alphabets but you also must add the alphabet under the keypressed function in the Processing IDE. in Arduino the format for adding more tones for more alphabets is:

if(val == 'alphabet'){

tone(buzzer_pin,frequency,period);}

BUT REMEMBER ADD IN PROCESSING IDE FIRST!!!!!

---------------------------------------------------------------------------------------

Step 2: Enjoy Your Music Maker!!!!!

Now your music maker is finished let's test it out. first run the program in arduino first and then processing..This is the sample that i made..Good luck.. Also I would like to ask for apology if i made mistake because i am still new in arduino and also instructables... thank you very much

Comments

MsSweetSatisfaction (author)2015-02-07

Very nice gadget, and the sounds it makes are very fun! You arduino looks very nice, especially for a beginner! Welcome to instructables, hope we get to see more from you!

About This Instructable

667views

13favorites

License:

More by halim930112:Arduino Systems: Simple Bluetooth Door LockVoice To Arduino: Control LEDs using MIT Speech RecognizerExperiment for Fun: Morse Code Encrypter Using Arduino and Smartphone!!!!
Add instructable to: