Collaborative Light Box

Submitted by zwasson on Mon, 04/22/2013 - 14:06

 

Description

For this lab, we created a light box with multiple LEDs and photoresistors. The idea of the instrument was to allow users to collaboratively create structures inside the box in order to manipulate the sound. We used Max/MSP to create interesting sounds that worked well together. The photoresistors were used to manipulate the amplitude of each sound. The LEDs and photoresistors were not related one-to-one, but rather we wanted the users to affect each other's sounds. In addition, users can use objects that reflect light as well to focus it in on particular photoresistors.

We ran into various issues along the way due to the weakness of our LEDs, even though they were rated around 18000mcd. We ended up halving the size of our light box, which reduces the number of users that can interact with it simultaneously. Even with the size reduced, we still had issues getting fine-grained control of the sound. We also ran into issues with calibration, since the performance can easily vary from room to room based on the ambient light.

Components

  • Arduino Uno
  • 6 Green LEDs
  • 2 Blue LEDs
  • 6 1k resistors
  • 6 photoresistors
  • Styrofoam box

Code

#define NUM_SENSORS           6
#define BASE_LINE_SAMPLES     100
 
int light_pin[NUM_SENSORS] = {A0, A1, A2, A3, A4, A5};  // top-row: first three, bottom-row: last three
String light_names[NUM_SENSORS] = {"L0", "L1", "L2", "L3", "L4", "L5"};
int light_data[NUM_SENSORS];
 
long base_line[NUM_SENSORS] = {0};
 
void setup() {
  Serial.begin(115200);
  for(int j = 0; j < BASE_LINE_SAMPLES; j++) {
    for(int i = 0; i < NUM_SENSORS; i++) {
      base_line[i] += analogRead(light_pin[i]);
    }
  }
  for(int i = 0; i < NUM_SENSORS; i++) {
    base_line[i] = base_line[i] / BASE_LINE_SAMPLES;
  }
  
}
 
void loop() {
   for(int i = 0; i < NUM_SENSORS; i++) {
     light_data[i] = analogRead(light_pin[i]) - base_line[i];
     Serial.print(light_names[i]);
     Serial.print(" ");
     Serial.print(light_data[i]);
     Serial.print("\n");
   }  
  delay(250);
}
0
Your rating: None
Drupal theme by Kiwi Themes.