Arduino

Electronic Spinet – Musical instrument using Arduino

electronic-spinet-arduino

Spinet it is a vintage musical instrument which has similar looks of a keyboard. It always get better when Technology touches the vintage stuffs. So we decided to build a simple Electronic Spinet using Arduino without using any keys. This project use of ultrasonic sensor which replace the keys. Let’s look into making of this project.

HARDWARE COMPONENTS:

  • Arduino UNO
  • HC-SR04 Ultrasonic sensors.
  • 8 ohm Speaker.

SCHEMATIC DESIGN OF ELECTRONIC SPINET:

electronic-spinet-circuit-design

ULTRASONIC SENSORS:

It contains two major parts named as trig and echo. The trig act as transmitter which sends the ultra sound waves. After a small time interval the echo is activated which act as a receiver and accepts the ultra sound which gets reflected from the obstacles. Using the time interval of transmitted and echoed Ultrasonic waves distance between the object is calculated. Later it was fed into Arduino digital pins.

SETTING UP THE PROJECT:

  • Fix the sensor to the table so that it will not move from its position, i advise to use any adhesive.
  • Then place each sensors at a optimum distance say 50cms to 75cms
  • Keep the wires aside so that it will not get stuck to your fingers while usage.

WORKING OF E-SPINET:

In the code, we have used different frequencies of the piano that is frequencies of the existing physical piano. The complete working of the spinet is based on the distance parameter. If there is an obstacle in front of the ultrasonic sensor, sound will be produced in the speaker. Here obstacle is nothing but our finger which we are using for producing the sound.

We have designed the code in such a way that for every 3cms the sound should be changed so that music can be played when we are waving our fingers between the sensors. For example, if we place the finger at the distance of 3cms from the ultrasonic sensor, tone of particular frequency will be produced. Similarly, if we place finger at a distance of 6cms from the ultrasonic sensor, different frequency will be produced. Using this Electronic spinet, we can produce up to 24 sounds which can be expandable up to the users wish.

CODE:

int trig = 2;

int echo = 3;
int pin = 9;
int trig1 = 4;

int echo1 = 5;
int pin1= 10;
void setup()
{
Serial.begin(9600);
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
pinMode(pin, OUTPUT);
Serial.begin(9600);
pinMode(trig1, OUTPUT);
pinMode(echo1, INPUT);
pinMode(pin1, 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);
int duration1 , distance1;
digitalWrite(trig1, HIGH);
delayMicroseconds(10);
digitalWrite(trig1, LOW);
duration1 = pulseIn(echo1, HIGH);
distance1 = (duration1 / 2) / 21.9;
Serial.print(distance1);
Serial.print("cm");
delay(50);


if (distance < 3)

{

tone(pin, 349.23);
}
else if ((3 < distance) && (distance < 6))
{
tone(pin, 369.99);

}
else if ((6< distance) && (distance < 9))
{
tone(pin, 392);
}
else if ((9 < distance) && (distance < 12))
{
tone(pin, 415.3);
}
else if ((12 < distance) && (distance < 15))
{
tone(pin, 440);
}
else if ((15 < distance) && (distance < 18))
{
tone(pin, 466.16);
}
else if ((18 < distance) && (distance < 21))
{
tone(pin, 493.88);
}
else if ((21 < distance) && (distance < 24))
{
tone(pin, 523.25);
}
else if ((24 < distance) && (distance < 27))
{
tone(pin, 554.37);
}
else if ((27 < distance) && (distance < 30))
{
tone(pin, 587.33);
}
else if ((30 < distance) && (distance < 33))
{
tone(pin, 622.25);

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

else
{
noTone(pin);
}


if (distance1 < 3)

{

tone(pin1, 1318.5);
}
else if ((3 < distance1) && (distance1 < 6))
{
tone(pin1, 1244.5);

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

}
else if ((33 < distance1) && (distance1 < 36))
{
tone(pin1, 698.46);
}

else
{
noTone(pin1);
}
}

ADVANTAGES:

  • It is very small
  • Can be carried easily
  • User-friendly

Besides this Electronic Spinet will make a great play toy for the children because of it’s attractive keyless playing nature. Making a toy using your Electronic skills will be something you can feel proud of and something they will deeply cherish.

LIMITATIONS:

  • Ultrasonic sensor distance measurement might vary with temperature, so longer the usage you might encounter small degradation in its performance.

WORKING VIDEO:

 

MAKERS:

inventor-icon

  1. S. SARIKA
  2. T.  TARUN 
  3. R. SAHITHI

The post Electronic Spinet – Musical instrument using Arduino appeared first on Gadgetronicx.

Source: gadgetronicx.com – Arduino

Leave a Reply

Your email address will not be published. Required fields are marked *