This installation called “Singing in the rain”. It’s a hand made piano-like instrument, which is played by “raindrops” automatically. The magic is that the “raindrops” showing on the wall will hit the keyboard and play ticking sound. People can enjoy the rain and the rhythm through their voice. Then the raindrops will make changes and play different sounds to communicate with people. It involves the technology of physical computing and p5.js, a JavaScript framework for creative coding. By analyzing people’s voice frequency, a beautiful pattern of “raindrops” will be generate, which will play a variable rhythm on the piano.

update on 2017/1/25

Documentation of the final project:

Winter Show at ITP

update on Feb 4, 2017

I was invited to participate in STEM Night at New York Hall of Science on Feb 3, 2017.

 

The Arduino code:

 

const int ledPins[] =   {2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,19,20,21,22};
const int lightPins[] = {43,45,47,49,51,53,52,50,48,46,44,42,40,38,36,34,28,32,30,26,24};
bool ledState[] = {false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false} ;
bool ledReady[] = {false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false} ;
unsigned long buttonPushedMillis; // when released
unsigned long ledTurnedOnAt; // when led was turned on
unsigned long turnOffDelay = 500; // turn off LED after this time

void setup() {
   Serial.begin(9600);
 for (int i = 0; i < 21; i++) {
    pinMode(ledPins[i], OUTPUT);
    digitalWrite(ledPins[i], LOW);
        pinMode(lightPins[i], OUTPUT);
    digitalWrite(lightPins[i], LOW);
  }
}

void loop() {
  for (int i = 0; i < 21; i++) {
 if (Serial.available() > 0) {
  int inByte = Serial.read();  
  //digitalWrite(ledPins[inByte],HIGH);
  ledReady[inByte] = true;
 }
 unsigned long currentMillis = millis(); 
 
if (ledReady[i]) {
    buttonPushedMillis = currentMillis;
    digitalWrite(ledPins[i], HIGH);
    digitalWrite(lightPins[i], HIGH);
    ledState[i] = true;
    ledTurnedOnAt = currentMillis;
    ledReady[i]= false;
    }
 
   if (ledState[i]) {
     if ((unsigned long)(currentMillis - ledTurnedOnAt) >= turnOffDelay) {
     ledState[i] = false;
     digitalWrite(ledPins[i], LOW);
     digitalWrite(lightPins[i], LOW);
     }
   }
 }
}

Here is the code for testing each pair of LED and piano key

void setup() {
  // 6 and 24 are the numbers of a pair of LED and solenoid.
  pinMode(2, OUTPUT);
  pinMode(43, OUTPUT);
}

void loop() {
  digitalWrite(2, HIGH);   // turn the LED on 
  digitalWrite(43, HIGH);   
  delay(1000);              
  digitalWrite(2, LOW);    // turn the LED off 
  digitalWrite(43, LOW);  
  delay(1000);              // wait for a second
}

 

P5 codes here.

Components

Diode:

(1N4006)*21

Transistor:

(PN2222A)*21

I use PN2222A in my project,which pins arrange different from P2N2222A.

Other Equipments:

Projector: LG PB63U

manfrotto arm

HDMI

HDMI to VGA

Stereo Speakers

Stereo Mic

USB extension wires *4

Mini USB wire