Project tutorial

Our project name is spinet.our project deals with music so we have chosen the title as Spinet. Spinet mean a small piano.

• 1,413 views
• 20 respects

## Components and supplies

 Ultrasonic Sensor - HC-SR04 (Generic)
×1
 Arduino MKR1000
×1

## Apps and online services

 Arduino IDE

• Our is about to make a virtual piano.In our project we a created a small piano which is physically not present.by using the ultrasonic sensor we generate the sounds.We have coded in such manner that ,the ultrasonic sensor
• Measures the distance . For a particular distance we have initialized the sounds of different frequencies. In this way we are able to produce different sounds.we have decided to make this because in real time the musicians carry a big piano with them ,but using our idea we make a product in such a way that, it is easy to carry and quite interesting something that something using our hand moments sound is produced

## Code

##### Project SpinetArduino
int trig = 2;

int echo = 3;
int pin = 9;
void setup()
{
Serial.begin(9600);
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
pinMode(pin, OUTPUT);
}
void loop()
{
int duration , distance;
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duration = pulseIn(echo, HIGH);
distance = (duration / 2) / 21.9;
Serial.print(distance);
Serial.print("cm");
delay(50);

if (distance < 3)

{

tone(pin, 1318.5);
}
else if ((3 < distance) && (distance < 6))
{
tone(pin, 1244.5);

}
else if ((6< distance) && (distance < 9))
{
tone(pin, 1174.7);
}
else if ((9 < distance) && (distance < 12))
{
tone(pin, 1108.7);
}
else if ((12 < distance) && (distance < 15))
{
tone(pin, 1046.5);
}
else if ((15 < distance) && (distance < 18))
{
tone(pin, 987.77);
}
else if ((18 < distance) && (distance < 21))
{
tone(pin, 932.33);
}
else if ((21 < distance) && (distance < 24))
{
tone(pin, 880);
}
else if ((24 < distance) && (distance < 27))
{
tone(pin, 830.61);
}
else if ((27 < distance) && (distance < 30))
{
tone(pin, 783.99);
}
else if ((30 < distance) && (distance < 33))
{
tone(pin, 739.99);

}
else if ((33 < distance) && (distance < 36))
{
tone(pin, 698.46);
}

else
{
noTone(pin);
}
}

## Custom parts and enclosures

final_spinet_SW4hCIYNS3.docx

## Schematics

• 1 project
• 7 followers

April 2, 2017

#### Members who respect this project

and 12 others

See similar projects
you might like

#### Smart Garbage Monitoring System Using Arduino 101

Project tutorial by Technovation

• 21,394 views
• 32 respects

#### Dash Lid

Project tutorial by claude garrett

• 4,256 views
• 11 respects

• 1,651 views
• 12 respects

#### Arduino MEGA Guitar Pedal

Project tutorial by electrosmash

• 17,622 views
• 105 respects

#### Minimal MIDI Drum Kit with 3D Printer

Project tutorial by ryokosaka

• 9,889 views
• 1 comment
• 29 respects

#### ANDI - Random Rhythm Generator - Electronics

Project tutorial by ANDinstruments

• 7,645 views