Wednesday, September 29, 2010

Code solutions

Here is a code similar to one from my last post that fades a line of LEDs in sequence. And good input Mr. Sketch, I needed to set more variables up for this code for the fade and brightnesses otherwise the fade direction will shift constantly and the brightnesses will be static or tied together, something i learned the hard way.....the three hour way.



//LED Pin Variables
int ledPins[] = {3,5,6,9,10,11}; //An array to hold the pin each LED is connected to
                                   //i.e. LED #0 is connected to pin 2, LED #1, 3 and so on
                                   //to address an array use ledPins[0] this would equal 2
                                   //and ledPins[7] would equal 9  
int fadeAmount1 = 1;
int fadeAmount2 = 1;
int fadeAmount3 = 1;
int fadeAmount4 = 1;
int fadeAmount5 = 1;
int fadeAmount6 = 1;
// how many points to fade the LED by
int delaytime = 2;
int maxim = 100;
int bright1 = 0;   // how bright the LED is
int bright2 = 20;
int bright3 = 40;
int bright4 = 60;
int bright5 = 80;
int bright6 = 99;

 /*
 * setup() - this function runs once when you turn your Arduino on
 * We the three control pins to outputs
 */
void setup()
{
 
  //Set each pin connected to an LED to output mode (pulling high (on) or low (off)
  for(int i = 0; i < 6; i++){         //this is a loop and will repeat eight times
      pinMode(ledPins[i],OUTPUT); //we use this to set each LED pin to output
    
  }                                  


}


void loop()                    
{
 
 // oneOnAtATime();          //this will turn one LED on then turn the next one
                             //on turning the
                             //former off (one LED will look like it is scrolling
                             //along the line
analogWrite(ledPins[0], bright1);  

  // change the brightness for next time through the loop:
  bright1 = bright1 + fadeAmount1;

  // reverse the direction of the fading at the ends of the fade:
  if (bright1 == 0 || bright1 == maxim) {
    fadeAmount1 = -fadeAmount1 ;
  }    
  // wait for 30 milliseconds to see the dimming effect  
  delay(delaytime);                                
analogWrite(ledPins[1], bright2);  

  // change the brightness for next time through the loop:
  bright2 = bright2 + fadeAmount2;

  // reverse the direction of the fading at the ends of the fade:
  if (bright2 == 0 || bright2 == maxim) {
    fadeAmount2 = -fadeAmount2 ;
  }    
  // wait for 30 milliseconds to see the dimming effect  
  delay(delaytime);    
analogWrite(ledPins[2], bright3);  

  // change the brightness for next time through the loop:
  bright3 = bright3 + fadeAmount3;

  // reverse the direction of the fading at the ends of the fade:
  if (bright3 == 0 || bright3 == maxim) {
    fadeAmount3 = -fadeAmount3 ;
  }    
  // wait for 30 milliseconds to see the dimming effect  
  delay(delaytime);          
  analogWrite(ledPins[3], bright4);  

  // change the brightness for next time through the loop:
  bright4 = bright4 + fadeAmount4;

  // reverse the direction of the fading at the ends of the fade:
  if (bright4 == 0 || bright4 == maxim) {
    fadeAmount4 = -fadeAmount4 ;
  }    
  // wait for 30 milliseconds to see the dimming effect  
  delay(delaytime);        
  analogWrite(ledPins[4], bright5);  

  // change the brightness for next time through the loop:
  bright5 = bright5 + fadeAmount5;

  // reverse the direction of the fading at the ends of the fade:
  if (bright5 == 0 || bright5 == maxim) {
    fadeAmount5 = -fadeAmount5 ;
  }    
  // wait for 30 milliseconds to see the dimming effect  
  delay(delaytime);  
 analogWrite(ledPins[5], bright6);  

  // change the brightness for next time through the loop:
  bright6 = bright6 + fadeAmount6;

  // reverse the direction of the fading at the ends of the fade:
  if (bright6 == 0 || bright6 == maxim) {
    fadeAmount6 = -fadeAmount6 ;
  }    
  // wait for 30 milliseconds to see the dimming effect  
  delay(delaytime);    
}

Why Why Why

does something that seems so logical and direct seem simultaneously so abstract.

Trying to get several leds to light at different times and fade and then when one exstinguishes a new one lights. BUT .. the code doesnt work....yet. And I was just cheking this hoping something interesting would happen, I know i need to use PWM pins for the dimming, that will be the next step.


/*
 Fade

 This example shows how to fade an LED on pin 9
 using the analogWrite() function.

 This example code is in the public domain.

 */
int brightness = 0;
int brightness2 = 150;// how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by
int P1 = 2;    //the number of the first led being lit
int P2 = 3;   //the number of the second
int INPIN = 13;  // a pin that will tell this sequence to begin
void setup()  {
  // declare pin 9 to be an output:
  pinMode(2, OUTPUT);
  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(INPIN, INPUT);
 
}

void loop()  {
  if ( INPIN = HIGH){
 
    if (brightness = 0 ) {
     P1= random (2 , 12);
  }
  // set the brightness of pin 9:
  analogWrite(P1, brightness);  

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;
  }  
  if (brightness2 = 0){
     P2= random(2 , 12);
  }
analogWrite(P2, brightness2);  

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;
  }  
 
  delay(30);// wait for 30 milliseconds to see the dimming effect                              
}
}

Tuesday, September 28, 2010

Final Iterations of Project one

When we presented our second week we had an mildly intelligent wall, it had potential. The sphere holding plants de seemed very attractive to most of the members of the group. This week he have had the challenge of trying to smart this thing up. We are attempting to add some sensors and effects to the surface in order to make it smart for this thursdays final presentation.

Shtien complained last Thursday that all the groups were making greenhouses. It seemed to me that this complaint would not have been a problem if each one of the groups had given a very clear explanation for demand of their product, ie the urban greenhouse being needed in high cost living situations like New York city. In our case the demand is aesthetic. We are capitalizing on our culture's interest, almost obsession, with the environment and trying to make a living aesthetic display for a large building setting.

Using the advice of our classmates (that we needed to concentrate on an application and location) we have elected to make a wall display of spheres in the duderstat atrium. I think this was mostly inspired by our proximity and the fact that we would have a familiar area for people to imagine our design in place.

The code as of now accounts for a timed activation of the water pump to water the plants, a photo resistor to detect night and activate lighting effects, pulsating blue and green lights, and a motion activated red led display to suggest fire. The lighting displays are meant to enhance enjoyment from within the atrium and to make the display enjoyable to people within the dude. I

I plan on making an example acrylic sphere, I hope that gets done in time. That would be the same panel style as our original chipboard spheres.

Thursday, September 23, 2010

new idea

At our next group meeting after my last post we decided to use a new idea for this past week. We had a long brainstorming session using a short list of problems taken from the problem generating exercise of last weeks class. From there we applied our prompts as solutions to these problems. Only one idea seemed to get significant support, to use a close packed plane of spheres to surround a cieling light. The clear, possibly acrylic spheres would each hold
a plant adding a natural component to the living space and interesting lighting effects.

Monday, September 20, 2010

Recent Developements

The review of our project last week made me think we may be using the wrong logic for this project. Strictly speaking we are fulfilling the requirements; the surface has spherical elements which are or can be optimally packed, the spheres can be used as vessels to hold another substance, and the spheres are automated and with added sensors are capable of reacting to their environment. However, the fact that a change in material from chipboard to acrylic had little effect on our design bothers me. To me it means that we are not incorporating the material properties very effectively, justing forcing whatever we are using into the form which fulfills the requirements. Sort of a square ped into a round hole situation. This will be a point at today's meeting. I think we may have to approach this thing again but this time using the problems statement method, perhaps a second start may help us incorporate the acrylic properties.

Wednesday, September 15, 2010

First Smart Surfaces Week

My first concern as I integrated into this course was the imbalance that adding another MSE student would introduce. This was a two ended problem; primarily it would bias any group I was in with engineers, secondly it would cause some problems for the unofficial companion course MSE 489. Mo, the single architecture member in G3 solved the first problem quite neatly for us. He made himself a strong representative of his major, we wont lack of architectural influence. Not only that but the art and architecture students seem to have a lot of common ground, the group dynamic was initially a little more like three on three. The second problem has developed well and has had little influence on the class.

On to the design considerations. The first problem solving session was mostly for the sake of defining terms for instance optimal packing. The MSE student obviously had a strong bias and all began supporting a close packed crystal structure. The prompts optimally packed spheres and holds in addition with the groups strong desire to integrate the spittle bug, mentioned in some of the background material, evoked two concepts from the group. The first was to hold spheres on a surface or in a box that made them pack optimally, the second was to use the spheres as vessels and then pack them optimally in close packed planes.  My initial thoughts took the class name smart surfaces very literally and I was focused on a flat two dimensional surface. My first concept was a flat sheet with tabs which would extend up out of the plane and enforce spheres on the plane to close packed plane arrangement. The tabs would also provide some support and allow the lane to go from level with the ground to nearly a 100 percent grade in the direction where the spheres had the tab under them. This idea didn't get any support and I wasn't very attached to it. The next concept of how to enforce a close packed arrangement was the idea of cutting holes in a box or surface in which a sphere would stably sit. This concept was developed by Carlo and Mo in rhino before the next meeting. I believed this idea showed promise since, unlike a regular vessel which would allow spheres added to it to take on nearly any unoptimal packing structure, the layers in contact with the bottom and walls would be forced to take on a close packed structure and would transmit the structure to spheres added behind them leading to a optimally packed chamber where no space was wasted. To emulate the video shown at the first class meeting we divided our group in two to develop the two concepts (spherical vessels and sphere holing box), I was on the box team.

We decided to prove the concept by building a box for ping-pong balls. The ping pong ball box was to be made to force an FCC structure coming down to a single ball at the bottom. At another meeting together Carlo an Ekta made several panels of chipboard with holes laser cut in them to force a close packed plane, a picture of this will be in my next post. At this point we reconvened as a whole group. The other three had made a sphere which unfolded like a pill bug and was made of panels. The idea had gone through several iterations and looked interesting and promising. The box idea was killed since the point was made that it was not necessarily "smart" it was simply a clever packaging idea. The consensus of the group was that a smart surface was one that could actively adapt or react to its environment using sensors or mechanization. This definition still seems narrow to me. I did agree that the box should not be the focus of the group, given that however the group insisted we not pursue anything other than our main goal and the box died completely. Not necessarily terrible since the problem of FCC and HCP phase boundaries in a large bulk of ping-pong ball occurred to me during that meeting. One more idea struck me during that meeting regarding a grid of punched holes, two overlapping grids which could align to allow spheres to pass through in a close packed plane and could then be unaligned to prevent them from passing. A picture will be shown in my next post. A problem here is that the size of the grid is limited by the fact that in a close packed plane a ball is in contact with all its nearest neighbors so to pass individually through a grid they must come out of contact and the whole arrangement must space apart eventually a ball toward the edge of the grid would not land in the proper location. I did not press the subject.



Next we began discussing the packing and how to justify optimal packing. Suggestions included hanging them in a clump, piling them, or leaving them in a close packed plane. I was not comfortable with any of these since there really wasn't any justification for them or purpose. To me the clump didn't represent close packing, hanging was ostensibly pointless, and a close packed plane did not seem sufficient. Later Melany and Ekta suggested that two spheres which had there other halves nested could be put together opening to opening making one large sphere capable of expanding into two spheres. I will put some of these photos in my next post. These "double" spheres could be put on a flat plane and take up half of the previously assumed space. I thought this was an unique interpretation of 'optimally packed' and was comforted. Furthermore since these 'double' spheres could be arranged in lines I had the idea these could be arranged into lines on two opposing surfaces and then interlocked into one close packed plane protected by the flat panes they sat on as in a suitcase. The suitcase would open, the lines of spheres would open, they would be loaded, and then they could close. However the suitcase could no longer close. I was encouraged to let this be until the Q and A portion of the presentation.