Thursday, February 28, 2013

Improv Jungle

Children are willing to dance and move at practically no provocation.  You put some tunes on and they'll start running around and moving and shaking.  Anyone who has ever been to a wedding with children knows this.




Sometime between the age of 10 (when what scientists call the "ew boys" phase*) and death, most people lose that childish lack of inhibitions.  A facsimile of this not giving a crap can be found through the help of alcohol (often needing copious amounts).  My project seeks to help people change this behaviour, if only for a short time.

The basic idea of my project is that people are in a dark room, milling about.  Everyone is wearing a strange belt.  With different movements, various things happen in the room.  If a user (to borrow from some CS lingo here) stands very still, slowly blue flowers begin to light up around him.  With the rising lights, a soft, mellow bass line starts playing in his vicinity.  Another user, standing some distance away, nervously shifts from leg to leg.  This slight swinging of her hips starts to light up greenery around her and a jaunty melody plays.  Seeing this, she shakes her hips more because it's a VERY catchy song that makes you have to dance.  Some distance away, two users are talking to each other, hear the music from the green plants and start dancing, because let's face it, this is hypothetical and that music is REALLY catchy.  The red flowers around them light up due to their closeness and there you go! it's a magic music jungle!  The users then try all different kinds of actions to light up more colors, but they just look silly because there are only three colors in this jungle.


Obviously I could not illustrate the music.  For the purposes of presenting in this class, I will implement the shaker (basically the accelerometer), and the lack of shaking (basically no movement and the blue light turns on slowly), and the proximity of another person with a magnet and the magnetic sensor.  That will turn on the red led slowly.  None of the lights will go off until reset.  In my fully realized implementation of this, the lights would go off slowly with no movement and the blue ones would only start turning off when all the others were.  But by slowly I mean over a period of about 20 - 30 minutes.

To add a little fun to this setup, the users will also be able to affect the brightness of the jungle.  Calibrating for ambient noise (including the level of the music the plants themselves are emitting), as the level of noise in the room rises, so, too, will the brightness of the lights.  This will provide a fun experiment to see if people will get louder as the visual noise of the flowers gets louder.  Since we don't have a noise sensor, the serial input of !!!!!'s will be a substitute.

Here are the sensors I will be using.  This is a hall effect magnetic sensor.  It will be affecting the red lights.

The other sensor is an accelerometer
This will be connected to the green lights.

Here is my code:

Since I accidentally burned out my red LED, the yellow LED will substitute as the blue lights, and the green will act as the red ones and the green ones.  My LED meter will act as a noise level.

int accX = A0;
int accY = A1;
int accZ = A2;

float xVal,
      yVal,
      zVal;
     
int mag = A7;

float magVal;

int ledG = 9;
int ledY = 10;

int ledRval;
int ledGval;
int ledBval;

int ledMeter;
int i;

//bar graph
int led_0 = 30;
int led_1 = 31;
int led_2 = 32;
int led_3 = 33;
int led_4 = 34;
int led_5 = 35;
int led_6 = 36;
int led_7 = 37;
int led_8 = 38;
int led_9 = 39;

void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);
  pinMode(accX, INPUT);
  pinMode(accY, INPUT);
  pinMode(accZ, INPUT);
 
  pinMode(ledG, OUTPUT);
  pinMode(ledY, OUTPUT);
 
  pinMode(led_0, OUTPUT);
  pinMode(led_1, OUTPUT);
  pinMode(led_2, OUTPUT);
  pinMode(led_3, OUTPUT);
  pinMode(led_4, OUTPUT);
  pinMode(led_5, OUTPUT);
  pinMode(led_6, OUTPUT);
  pinMode(led_7, OUTPUT);
  pinMode(led_8, OUTPUT);
  pinMode(led_9, OUTPUT);
 
  pinMode(mag, OUTPUT);
 
  ledBval = 0;
  ledMeter = 0;
 
  i = 0;
}

void loop()                     // run over and over again

  xVal = analogRead(accX);
  yVal = analogRead(accY);
  zVal = analogRead(accZ);
   
  magVal = analogRead(mag);
 
  if(xVal > 18 || xVal < 18 ||
     yVal > 190 || yVal < 190 ||
     zVal > 250 || zVal < 250)
       analogWrite(ledG, 255);
  else
  {
    analogWrite(ledG, 0);
    ledBval += 10;
    analogWrite(ledY, ledBval);
  }
 
  if(mag > 0)
    analogWrite(ledG, 255);
   
   
  i = 0;
  char inputChar;
  char* input;
 
   while(Serial.available() && i < 3)
      {
        inputChar = Serial.read();
        input[i] = inputChar;
        i++;
        delay(10);
      }
     
  ledMeter = i;
 
  if(ledMeter == 0)
  {
    analogWrite(led_0, 0);
    analogWrite(led_1, 0);
    analogWrite(led_2, 0);
    analogWrite(led_3, 0);
    analogWrite(led_4, 0);
    analogWrite(led_5, 0);
    analogWrite(led_6, 0);
    analogWrite(led_7, 0);
    analogWrite(led_8, 0);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 1)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 0);
    analogWrite(led_2, 0);
    analogWrite(led_3, 0);
    analogWrite(led_4, 0);
    analogWrite(led_5, 0);
    analogWrite(led_6, 0);
    analogWrite(led_7, 0);
    analogWrite(led_8, 0);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 2)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 255);
    analogWrite(led_2, 0);
    analogWrite(led_3, 0);
    analogWrite(led_4, 0);
    analogWrite(led_5, 0);
    analogWrite(led_6, 0);
    analogWrite(led_7, 0);
    analogWrite(led_8, 0);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 3)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 255);
    analogWrite(led_2, 255);
    analogWrite(led_3, 0);
    analogWrite(led_4, 0);
    analogWrite(led_5, 0);
    analogWrite(led_6, 0);
    analogWrite(led_7, 0);
    analogWrite(led_8, 0);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 4)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 255);
    analogWrite(led_2, 255);
    analogWrite(led_3, 255);
    analogWrite(led_4, 0);
    analogWrite(led_5, 0);
    analogWrite(led_6, 0);
    analogWrite(led_7, 0);
    analogWrite(led_8, 0);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 5)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 255);
    analogWrite(led_2, 255);
    analogWrite(led_3, 255);
    analogWrite(led_4, 255);
    analogWrite(led_5, 0);
    analogWrite(led_6, 0);
    analogWrite(led_7, 0);
    analogWrite(led_8, 0);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 6)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 255);
    analogWrite(led_2, 255);
    analogWrite(led_3, 255);
    analogWrite(led_4, 255);
    analogWrite(led_5, 255);
    analogWrite(led_6, 0);
    analogWrite(led_7, 0);
    analogWrite(led_8, 0);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 7)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 255);
    analogWrite(led_2, 255);
    analogWrite(led_3, 255);
    analogWrite(led_4, 255);
    analogWrite(led_5, 255);
    analogWrite(led_6, 255);
    analogWrite(led_7, 0);
    analogWrite(led_8, 0);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 8)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 255);
    analogWrite(led_2, 255);
    analogWrite(led_3, 255);
    analogWrite(led_4, 255);
    analogWrite(led_5, 255);
    analogWrite(led_6, 255);
    analogWrite(led_7, 255);
    analogWrite(led_8, 0);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 9)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 255);
    analogWrite(led_2, 255);
    analogWrite(led_3, 255);
    analogWrite(led_4, 255);
    analogWrite(led_5, 255);
    analogWrite(led_6, 255);
    analogWrite(led_7, 255);
    analogWrite(led_8, 255);
    analogWrite(led_9, 0);
  }
  else if(ledMeter == 10)
  {
    analogWrite(led_0, 255);
    analogWrite(led_1, 255);
    analogWrite(led_2, 255);
    analogWrite(led_3, 255);
    analogWrite(led_4, 255);
    analogWrite(led_5, 255);
    analogWrite(led_6, 255);
    analogWrite(led_7, 255);
    analogWrite(led_8, 255);
    analogWrite(led_9, 255);
  }
   
  delay(50);
}



*by scientists I mean me.

Tuesday, February 26, 2013

scratch that

Scratch that old project 2.  I don't like it, and no matter how many artsy words I throw in it still doesn't make any sense.  why wouldn't everyone just go into one room?  'Tis a silly idea.  New idea!


Catherine showed me: http://likebelt.com/ and suggested I make a game where people have to thrust at each other.  I immediately thought this was weird.  And still do, but I love the ridiculousness of it.  How about this.  You have only one room, a dark room with weird, mechanical plants all around.  You and the group of strangers you're with are tasked with waking up the plants by doing various actions.  Each action coincides with a different color and part of the plant.  Shaking your hips (which are outfitted with accelerometers) wakes up the green leaves and shrubbery (not EVERYTHING is led, mind you, there are some regular spotlights around of various colors).  Thrusting at another person's belt wakes up the red flowers.  Standing absolutely still wakes up the blue.  Etc, etc.  The people put in the room aren't told what does what so they have to figure it out.  Perhaps someone does a really awkward handshake and red flowers start to wake up.  Or maybe someone's really non-cooperative and the blue flowers around them are all turned on.  You get the point.  Oh, and it's also based on proximity.  I don't know how to do the proximity yet, though.

Project 2

Our second project we're tasked with getting two boards to communicate serially (or the board and the computer, but where's the fun in that).  Either way, the board has to communicate through the serial port and then react in some way using LEDs.  My idea involves fostering communication and cooperation.  Or the opposite, competition is fun, too.  Anyways, in ideal form this project would involve two rooms with two different LED art installations.  These would be interactive, but not in the way people would expect.  They change based on the noise level in the adjacent room.  If it's loud, the picture grows and flows, if it's quiet, the picture is more muted and calm.  This would encourage people to run from room to room trying to see each display.

In model form, I would connect my led sound meter (the bar of lights) to my arduino and depending on how many !'s I typed into the serial port would be how much the bar lights up.

On second thought, I think a jungle that people could walk through would be even more awesome, made of lights, of course.  Think Avatar.  Or in a much less crazy CG way, think these lights from apartmenttherapy.com: http://www.apartmenttherapy.com/magnificent-high-tech-led-bouq-101115.  Of course, they would still "grow" based on the noise in the next room.

This also conjures up a sort of natural prisoner's dilemna.  Assuming the rooms are separated enough, the only way for each of the people to see all the pretty lights would be for them to be quiet, but having no way of making sure the other person stays quiet, you must make the effort of not making noise.  Of course, when the pretty lights come on, I like to think people would make lots of "oohs" and "ahhs" which would then incentivize the other room's people to be loud in retaliation.  Oh, I love anonymous competition like this.

As an addendum to this, I think I would make the forest/jungle uglier and angrier (i.e. redder and darker) with louder sounds, and eh... this is a lousy idea.

Thursday, February 7, 2013

My project is an LED wall in a hallway or tunnel.  I've given up on the motion sensors because not only are they more difficult to use than light sensors, but they aren't as cost effective either.  That's a lose-lose.  So, my design is still essentially the same, but instead of using passive IR to detect motion it will detect whether or not the light sensitive diode is covered up.  Of course, the diode will have to be encased in a sort of tube to prevent the leds around it from interfering, but the motion sensor would have needed the same thing.


 Here is a conceptual drawing of what I am imagining.  The colors will fade as the person moves, leaving a trail of light behind them.  If another person walks by, they will trail a different, random color.  If one person's trail overtakes another's, then the colors would mix.  The setup would include a wall of LEDs (in this diagram, the blue dots), and at the four foot vertical mark, a line of light sensors.  These would be encased in small tubes shielding them from the light of the surrounding LEDs.


Here is a diagram for how the LDR will be hooked up:


The LED will be hooked up as usual.  The code is as follows:

int lightPin = A0;
int ledPin = 10;

int lightVal;
int ledVal;

void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);
  pinMode(lightPin, INPUT);
 
  pinMode(ledPin, OUTPUT);
}

void loop()                     // run over and over again
{
  lightVal = analogRead(lightPin);
 
  while(lightPin >= 250)  //would have to be calibrated to the hallway
  {
    ledVal -= 10;
    delay(10);
    analogWrite(ledPin, ledVal);
    Serial.print(ledVal);
    Serial.print('\n');
    lightVal = analogRead(lightPin);
    if(ledVal < 0)
      ledVal = 0;
  }
 
    ledVal = 255;
    analogWrite(ledPin, ledVal);
}


http://dobpler.com/photo.html  - led wall in sweden

http://www.youtube.com/watch?v=6xriYUzJ9Ls - movement tracking led wall in Montreal

Monday, February 4, 2013

Assignment 2

I sort of forgot exactly what we were supposed to do for this blog post.  I think it was that we should think of an awesome idea we'd like to eventually make and then make a small prototype version of it.  My idea that I'd love to eventually make is in the realm of wearable art (everything sounds fancy when you say 'realm').  Anyway, I think a sweater or a scarf would be really cool if it had led's embedded in it that changed color based on the temperature.  Okay, so maybe a scarf would be better for this, other wise you'll end up like those shirts in the 80's that changed color based on heat and just made people look like they had psychedelic sweat stains.  Or even better, apparently they made swim trunks.  Wow.  Okay, so I will think of a different idea.  Yes.  A much different idea.

Here's some fun hypercolor for you to wish you'd never seen (also, not UNsafe for work, but not exactly safe either): http://www.thesoundfaction.com/fash12.jpg

I'll come back after some brainstorming.

Brainstorming done.

My idea is a wall of LEDS that as a person walks along it, the leds light up and keep pace with that person.  If a person stays still, the lights fade out.  I think this would be really really cool with a fifty foot long wall.  I also would make the LEDs rgb leds so that if another person was following that person, the color of their light trail would be different.