349

5

1

## Introduction: Linkit One Musical Organ

In this instructable I would be telling you how to make a simple musical organ. This thing works upon the distance. As the distance of your hand increase from it, it plays various notes. Their is a simple buzzer attached which is used to play the musical notes. I garranty you that making this project will really be fun. Make it and play with it.

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 1: Gather Parts

Here are the parts required by you:

• Ultrasonic sensor
• A simple buzzer
• Jump cables

## Step 2: Connecting Ultrasonic Sensor

A ultrasonic measures the distance using sound waves. Their is a pair of transmitter and receiver. The transmitter sends sound wave and it strikes the from a object and is returned. The returned sound wave is received by the receiver. From the time taken, we calculate the distance. Here we would be using it to measure the distance and set the note played by the buzzer according to the distance. Connect the ultrasonic sensor to your board as said:

• vcc of module-----vcc of linkit one board
• gnd of the module-----gnd of the board
• echo pin-----digital pin 8
• trig pin-----digital pin 7

## Step 3: Connect the Buzzer

To play musical note a buzzer is used by me. You can also use a speaker with a amplifier which would be even a better option. I had a buzzer lying around me so I decided to use it instead of a speaker. Connect gnd of the buzzer to ground and positive of the buzzer to digital pin 3.

## Step 4: Upload the Code

Now its time to upload the code. After uploading the code, bring your hand near to it. The range of each note is about 7cm. Move your hand towards or away from the buzzer and you will be able to hear the different musical notes.

#define trigPin 8
#define echoPin 9

int buzzer=3;

void setup()

{

pinMode(trigPin, OUTPUT) ;

pinMode(echo pin, INPUT) ;

pinMode(buzzer,OUTPUT);

}

void loop()

{

int duration,distance;

digitalWrite(trigPin,HIGH);

delayMicroseconds(1000);

digitalWrite(trigPin,LOW);

duration=pulseIn(echoPin,HIGH);

distance=(duration/2)/29.1;

if (distance<70 && distance>7)

{

if(distance>63)

{

tone(buzzer,490);

}

else

if(distance>56)

{

tone(buzzer,523);

}

else

if(distance>49)

{

tone(buzzer,587);

}

else

if(distance>42)

{

tone(buzzer,659);

}

if(distance>35)

{

tone(buzzer,698);

}

else

if(distance>28)

{

tone(buzzer,784);

}

else

if(distance>21)

{

tone(buzzer,880);

}

else if(distance>14)

{

tone(buzzer,988);

}

}

delay(50)';

}

## Step 5: END

This is the end of this instructable.Hope you liked it and loved it also. For any query and problem comment below.

THANK YOU

Participated in the
Tech Contest

22 2.3K
20 2.0K
139 8.0K