19.9.08

pianoDuino

The pinaoDuino is a Street-Gadget i've been thinking about for a long while.
It's a large piano-keys carpet, put in the street. When people walk on it and step on the keys, they actually close switches. The switches close a selective circuit, that sends resistance values to the arduino. The arduino manipulates the resistance values to correlated bytes. Bytes are sent via serial port to a C# program, that reads the byte and sounds the relative *.wav file.
It is meant to be friendly and nice - for people who walk on it in the street on a friday. One who really likes the experience - can have a video/picture of him sent to his cellphone via bluetooth.

To sum up:
person's foot ==> carpet switches ==> resistor array ==> arduino ==> PC ==> loudspeakers ==> happiness.

/* ‎‎16/‎09/‎08 00:22:07
* pianoDuino
* This is the Arduino code for the pianoDuino
* Idea is to put a carpet in the street that when peoeple walk on - plays a note.
* Build from an arrray of transistors - every time one is used
* The arduino reads the resistor and understands which resistor is used - by ranges.
* every resistor generates a different serial message, which is sent to the PC.
* 1 , 2 , 3 , 4 will tell a C# program to play notes (*.wavs)
* 0 is silence - therefore it is the default serial message.
*
* 4nur nachman eytan
* http://nurne.blogspot.com
* nurnur@Gmail.com*/

int inputPin = 0; // input pin for the resistors array
int val = 0; // resistor values
byte valToPc = 0; // byte sent to the PC
int boundOne = 0; // first bound range
int boundTwo = 256; // second bound range
int boundThree = 512; // third bound range
int boundFour = 768; // fourth bound range
int boundFive = 1023; // fifth bound range
int threshLow = 10; // bottom threshold
int threshHigh = 1010; // top threshhold

void setup()
{
beginSerial(9600); // begin serial communication at 9600 baud
}

void loop()
{
val = analogRead(inputPin); // read the value from resistors array
if ( val > threshLow && val < threshHigh ) // if resistor is in test range
{
if ( val <= boundFive && val >= boundFour) // if resistor is in 5-4 range
{
valToPc = 1; // msg to pc 1
serial.Println(valToPc); // send it on serial
delay(100) // wait, to avoid overload
}
if ( val <= boundFour && val >= boundThree) // if resistor is in 4-3 range
{
valToPc = 2; // msg to pc 2
serial.Println(valToPc); // send it on serial
delay(100) // wait, to avoid overload
}
if ( val <= boundThree && val >= boundTwo) // if resistor is in 3-2 range
{
valToPc = 3; // msg to pc 3
serial.Println(valToPc); // send it on serial
delay(100) // wait, to avoid overload
}
if ( val <= boundTwo && val >= boundOne) // if resistor is in 2-1 range
{
valToPc = 4; // msg to pc 4
serial.Println(valToPc); // send it on serial
delay(100) // wait, to avoid overload
}
}
valToPc = 0; // msg pc - o - back to silence
serial.Println(valToPc); // send it on serial
delay(100) // wait, to avoid overload
}

2 comments:

nurlan said...

איפה אפשר להשיג ארדוינו בישראל?

Anonymous said...

There was once a commercial using a similar trick. There was a road that played a sequence (maybe some part of an Opus of Mozart or something classical like that) when cars went over it. The problem was that it was designed to a specific car (which it advertized) and other cars just made kinda random sounds when they drove through the road, which made drivers go nuts.
It was removed sometime after.