Jellyfish/Cake

Yerang Choi and I worked on creating a piece with LEDs that would respond to noise/sound.

We used a small plastic piece in which we punched holes through with thumbtacks. After this we stuck in our LEDs that we had soldered to wires and resistors. There are a total of ten LEDs. Surrounding the plastic so as to hide the inside organs of our piece is tin foil. The piece resembles a jellyfish or a cake. We took inspiration from some videos on YouTube:

http://www.youtube.com/watch?v=SkrhCUQHKX8

http://www.youtube.com/watch?v=3P7JoxfNo-0

http://www.youtube.com/watch?v=___XwMbhV4k

http://www.youtube.com/watch?v=guppB4cK3oU

Images of our process:

photo copy Final copy

 

Link to a video of us after completing the project (without foil though):

http://lisasquinleyportfolio.tumblr.com/post/69841572377/creative-computing-fall-2013-professor-aisen 

And the code!!!!!

/****************************************
 * Example Sound Level Sketch for the
 * Adafruit Microphone Amplifier
 ****************************************/
const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
unsigned int sample;
//mic
int vcc= 16;
int gnd= 15;
int out= A0;
void setup()
{
  Serial.begin(9600);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(11, OUTPUT);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
  // mic
  pinMode(16, OUTPUT);
  pinMode(15, OUTPUT);
  pinMode(A0, INPUT);
}
void loop()
{
  digitalWrite(15, LOW);
  digitalWrite(16, HIGH);
  unsigned long startMillis= millis();  // Start of sample window
  unsigned int peakToPeak = 0;   // peak-to-peak level
  unsigned int signalMax = 0;
  unsigned int signalMin = 1024;
  // collect data for 50 mS
  while (millis() – startMillis < sampleWindow)
  {
    sample = analogRead(0);
    if (sample < 1024)  // toss out spurious readings
    {
      if (sample > signalMax)
      {
        signalMax = sample;  // save just the max levels
      }
      else if (sample < signalMin)
      {
        signalMin = sample;  // save just the min levels
      }
    }
  }
  peakToPeak = signalMax – signalMin;  // max – min = peak-peak amplitude
  double volts = (peakToPeak * 3.3) / 1024;  // convert to volts
  Serial.println(volts);
// collect data for 50 mS
  while (millis() – startMillis < sampleWindow)
  {
    sample = digitalRead(LOW);
    if (sample < 1024)  // toss out spurious readings
    {
      if (sample > signalMax)
      {
        signalMax = sample;  // save just the max levels
      }
      else if (sample < signalMin)
      {
        signalMin = sample;  // save just the min levels
      }
    }
  }
  peakToPeak = signalMax – signalMin;  // max – min = peak-peak amplitude
//  double volts = (peakToPeak * 3.3) / 1024;  // convert to volts
  Serial.println(volts);
  if(volts <= 0.39 ){
    analogWrite(6, 0);
    analogWrite(5, 255);
    analogWrite(3, 255);
    analogWrite(11,0);
    analogWrite(9,0);
    analogWrite(10,255);
    digitalWrite(4, HIGH);
    digitalWrite (7, HIGH);
    digitalWrite (2,HIGH);
    digitalWrite (8,LOW);
    digitalWrite (12, LOW);
    digitalWrite (13, HIGH);
    //  delay(1000);
  }
  else if(volts >= 0.4 && volts <= 0.59){
    analogWrite(5,0);
    analogWrite(6, 255);
    analogWrite(3, 255);
    analogWrite(11,0);
    analogWrite(9,255);
    analogWrite(10,255);
    digitalWrite(4, LOW);
    digitalWrite (7, LOW);
    digitalWrite (9,LOW);
    digitalWrite (8,HIGH);
    digitalWrite (12, HIGH);
    digitalWrite (13,LOW);
    //  delay(1000);
  }
  else if(volts >= 0.6 && volts <= 1.00 ){
    analogWrite(3, 0);
    analogWrite(6, 255);
    analogWrite(5, 255);
    analogWrite(11,255);
     analogWrite(9,255);
     analogWrite(10,255);
    digitalWrite(4, HIGH);
    digitalWrite (7, HIGH);
    digitalWrite (2,HIGH);
    digitalWrite (8,LOW);
    digitalWrite (12, LOW);
    digitalWrite (13, HIGH);
    //  delay(1000);
  }
  else if(volts >= 1.01 && volts <= 2.00 ){
    analogWrite(3, 0);
    analogWrite(6, 255);
    analogWrite(5, 255);
    analogWrite(11,255);
     analogWrite(9,255);
     analogWrite(10,0);
    digitalWrite(4, HIGH);
    digitalWrite (7, LOW);
    digitalWrite (9,LOW);
    digitalWrite (8,LOW);
    digitalWrite (12, HIGH);
    digitalWrite (13, LOW);
    //  delay(1000);
  }
  else if(volts >= 2.01 ){
    analogWrite(3, 0);
    analogWrite(6, 255);
    analogWrite(5, 255);
    analogWrite(11,255);
     analogWrite(9,255);
    analogWrite(10,0);
    digitalWrite(4, LOW);
    digitalWrite (7, LOW);
    digitalWrite (9,HIGH);
    digitalWrite (8,LOW);
    digitalWrite (12, LOW);
    digitalWrite (13, LOW);
    //  delay(1000);
  }
}
This entry was posted in Uncategorized on by .

About Lisa Quinley

Adopted from China. Mother Japanese and father a US citizen. Dual-citizenship - USA and Ireland. Lived overseas most of my life - Nepal, Cambodia, Nigeria, to name a few. Dual-degree program (BA/BFA) Global Studies at Eugene Lang and Communication Design at Parsons.