Making Furniture Interactive

December 17, 2007

[Dan D.W. Kang] Final Project- Interactive Coffee Table

Filed under: Dong Woo Kang,Final Project — dwkang @ 5:07 pm

dscn1305.jpgdscn1303.jpgdscn1300.jpgdscn1292.jpgdscn1287.jpgdscn1286.jpgdscn1285.jpgdscn1284.jpgdscn1280.jpgdscn1278.jpg

* Description

This interactive coffee table responds to the users and objects (coffee cups) by giving out different shades of light.

Two I/R sensors are attached on each side of the table to detect how many people there are. Two photocells are attached on the top of the table at both ends to detect how many coffee cups are being used. Depending on how many people or coffee cups there are, the table will respond differently with different shades and intensity of color. The table reaches its happiest state when the table is being fully utilized; two people sitting at the table, both of them drinking coffee. The table will entertain the users by flashing colorful lights and spinning.

* Code

int lightVal = 0;
int lightValB = 0;
int distanceVal = 0;
int distanceValB = 0;
int lightsensor = 0;
int lightsensorB = 2;
int distancesensor = 3;
int distancesensorB = 1;
int green = 11;
int red = 9;
int blue = 10;
int greenB = 3;
int redB = 5;
int motor = 7;
int value = 0;
int state = 1;
void setup() {
  pinMode(lightsensor, INPUT);
  pinMode(lightsensorB, INPUT);
  pinMode(distancesensor, INPUT);
  pinMode(distancesensorB, INPUT);
  pinMode(motor,OUTPUT);
  pinMode(red,OUTPUT);
  pinMode(green,OUTPUT);
  pinMode(blue,OUTPUT);
  pinMode(redB,OUTPUT);
  pinMode(greenB,OUTPUT);
  Serial.begin(9600); // Set up the serial communication.
}
void loop()
{
  lightVal = analogRead(lightsensor);
  lightValB = analogRead(lightsensorB);
  distanceVal = analogRead(distancesensor);
  distanceValB = analogRead(distancesensorB);
  Serial.println(“—–“);
  Serial.print(“lightvallue “);
  Serial.println(lightVal);
  Serial.print(“lightvalueB “);
  Serial.println(lightValB);
  Serial.print(“distancevalue “);
  Serial.println(distanceVal);
  Serial.print(“distancevalueB “);
  Serial.println(distanceValB);
 Serial.print(“state “);
 Serial.println(state);
 if (state == 0) {noPnoC ();}
 else if (state == 1) {noPoneC ();}
 else if (state == 2) {noPoneC_B ();}
 else if (state == 3) {noPtwoC ();}
 else if (state == 4) {onePnoC ();}
 else if (state == 5) {onePnoC_B ();}
 else if (state == 6) {onePoneC ();}
 else if (state == 7) {onePoneC_B ();}
 else if (state == 8) {onePtwoC ();}
 else if (state == 9) {onePtwoC_B ();}
 else if (state == 10) {twoPnoC ();}
 else if (state == 11) {twoPoneC ();}
 else if (state == 12) {twoPoneC_B ();}
 else if (state == 13) {twoPtwoC ();}
}
void noPnoC()    
{
  alloff();
  for(value = 0; value <=75; value+=5)   {analogWrite(red, value);   delay(100);}     for(value = 75; value >=0; value-=5)
  {analogWrite(red, value);
  delay(100);}
condition();
}   
void noPoneC()   
{
  alloff();
  for(value = 0; value <=50; value+=2)   {analogWrite(red, value);   delay(200);}     for(value = 50; value >=0; value-=2)
  {analogWrite(red, value);
  delay(200);}
 
condition();
}
void noPoneC_B()       
{
  alloff();
  for(value = 0; value <=50; value+=2)   {analogWrite(red, value);   delay(200);}     for(value = 50; value >=0; value-=2)
  {analogWrite(red, value);
  delay(200);}
 
 condition();
}
void noPtwoC()      
{
  alloff();
  for(value = 0; value <=50; value+=2)   {analogWrite(red, value);   delay(200);}     for(value = 50; value >=0; value-=2)
  {analogWrite(red, value);
  delay(200);}
 
 condition();
}
void onePnoC()
{
  alloff();
  for(value = 0 ; value <=180; value+=5)   {analogWrite(blue, value);   delay(30); }   for(value = 180 ; value >=0; value-=5)
  {analogWrite(blue, value);
  delay(30);}
 
condition();
}
void onePnoC_B()
{
  alloff();
  for(value = 0 ; value <=180; value+=5)   {analogWrite(red, value);   delay(30); }   for(value = 180 ; value >=0; value-=5)
  {analogWrite(red, value);
  delay(30);}
 
condition();
}

void onePoneC()
{  alloff();
  for(value =0; value <=180; value+=5)   {analogWrite(blue, value);   delay(30);}   for(value = 0; value <=255; value+=10)   {analogWrite(greenB, value);   delay(30);}     for(value = 255; value >=0; value-=10)
  {analogWrite(greenB, value);
  delay(30);}
 
  for(value = 180; value >=0; value-=5)
  {analogWrite(blue, value);
  delay(30);}
 
condition();
}
void onePoneC_B()
{  alloff();
  for(value =0; value <=180; value+=5)   {analogWrite(red, value);   delay(30);}   for(value = 0; value <=255; value+=10)   {analogWrite(greenB, value);   delay(30);}     for(value = 255; value >=0; value-=10)
  {analogWrite(greenB, value);
  delay(30);}
 
  for(value = 180; value >=0; value-=5)
  {analogWrite(red, value);
  delay(30);}
 
condition();
}
void onePtwoC()
{  alloff();
  for(value =0; value <=180; value+=5)   {analogWrite(blue, value);   delay(30);}   for(value = 0; value <=255; value+=10)   {analogWrite(greenB, value);   delay(30);}     for(value = 0; value <=255; value+=10)   {analogWrite(green, value);   delay(30);}     for(value = 255; value >=0; value-=10)
  {analogWrite(greenB, value);
  delay(30);}
    
  for(value = 255; value >=0; value-=10)
  {analogWrite(green, value);
  delay(30);}
 
  for(value = 180; value >=0; value-=5)
  {analogWrite(blue, value);
  delay(30);}
 
 condition();
}
void onePtwoC_B()
{  alloff();
  for(value =0; value <=180; value+=5)   {analogWrite(red, value);   delay(30);}   for(value = 0; value <=255; value+=10)   {analogWrite(greenB, value);   delay(30);}     for(value = 0; value <=255; value+=10)   {analogWrite(green, value);   delay(30);}     for(value = 255; value >=0; value-=10)
  {analogWrite(greenB, value);
  delay(30);}
    
  for(value = 255; value >=0; value-=10)
  {analogWrite(green, value);
  delay(30);}
 
  for(value = 180; value >=0; value-=5)
  {analogWrite(red, value);
  delay(30);}
condition();
}

void twoPnoC()
{  alloff();
  for(value =0; value <=200; value+=5)   {analogWrite(blue, value);   delay(30);}     for(value =0; value <=200; value+=5)   {analogWrite(redB, value);   delay(30);}       for(value = 200; value >=0; value-=5)
  {analogWrite(blue, value);
  delay(30);}
 
  for(value = 200; value >=0; value-=5)
  {analogWrite(redB, value);
  delay(30);}
 
condition();
}
void twoPoneC()
{  alloff();
  for(value = 0; value <=180; value+=5)   {analogWrite(blue, value);   delay(30);}     for(value =0; value <=180; value+=5)   {analogWrite(redB, value);   delay(30);}     for(value = 0; value <=255; value+=10)   {analogWrite(green, value);   delay(30);}     for(value = 255; value >=0; value-=10)
  {analogWrite(green, value);
  delay(30);}
   
  for(value = 180; value >=0; value-=5)
  {analogWrite(blue, value);
  delay(30);}
 
  for(value = 180; value >=0; value-=5)
  {analogWrite(redB, value);
  delay(30);}
 
condition();
}
void twoPoneC_B()
{  alloff();
  for(value = 0; value <=180; value+=5)   {analogWrite(blue, value);   delay(30);}     for(value =0; value <=180; value+=5)   {analogWrite(redB, value);   delay(30);}     for(value = 0; value <=255; value+=10)   {analogWrite(green, value);   delay(30);}     for(value = 255; value >=0; value-=10)
  {analogWrite(green, value);
  delay(30);}
   
  for(value = 180; value >=0; value-=5)
  {analogWrite(blue, value);
  delay(30);}
 
  for(value = 180; value >=0; value-=5)
  {analogWrite(redB, value);
  delay(30);}
 
condition();
}
void twoPtwoC()
{  alloff();
  digitalWrite(motor,HIGH);
  digitalWrite(red, HIGH);
  delay(50);
  digitalWrite(red,LOW);
  digitalWrite(red, HIGH);
  delay(50);
  digitalWrite(red,LOW);
  digitalWrite(green,HIGH);
  delay(50);
  digitalWrite(green,LOW);
  digitalWrite(blue,HIGH);
  delay(50);
  digitalWrite(blue,LOW);
  digitalWrite(greenB,HIGH);
  delay(50);
  digitalWrite(greenB,LOW); 
condition();
}

void alloff()
{
  digitalWrite(red,LOW);
  digitalWrite(green,LOW);
  digitalWrite(blue,LOW);
  digitalWrite(redB,LOW);
  digitalWrite(greenB,LOW);
  digitalWrite(motor,LOW);
}
void condition()
{
  if (distanceVal < 150 && lightVal > 80 && distanceValB < 150 && lightValB > 220) {state = 0;}
  if (distanceVal < 150 && lightVal < 80 && distanceValB < 150 && lightValB > 220) {state = 1;}
  if (distanceVal < 150 && lightVal > 80 && distanceValB < 150 && lightValB < 220) {state = 2;}   if (distanceVal < 150 && lightVal < 80 && distanceValB < 150 && lightValB < 220) {state = 3;}   if (distanceVal > 150 && lightVal > 80 && distanceValB < 150 && lightValB > 220) {state = 4;}
  if (distanceVal < 150 && lightVal > 80 && distanceValB > 150 && lightValB > 220) {state = 5;}
  if (distanceVal > 150 && lightVal < 80 && distanceValB < 150 && lightValB > 220) {state = 6;}
  if (distanceVal < 150 && lightVal > 80 && distanceValB > 150 && lightValB < 220) {state = 7;}   if (distanceVal > 150 && lightVal < 80 && distanceValB < 150 && lightValB < 220) {state = 8;}   if (distanceVal < 150 && lightVal < 80 && distanceValB > 150 && lightValB < 220) {state = 9;}   if (distanceVal > 150 && lightVal > 80 && distanceValB > 150 && lightValB > 220) {state = 10;}
  if (distanceVal > 150 && lightVal < 80 && distanceValB > 150 && lightValB > 220) {state = 11;}
  if (distanceVal > 150 && lightVal > 80 && distanceValB > 150 && lightValB < 220) {state = 12;}   if (distanceVal > 150 && lightVal < 80 && distanceValB > 150 && lightValB < 220) {state = 13;}   }[/sourcecode]

Advertisements

November 4, 2007

[Dan D.W. Kang] Project Proposal

Filed under: Dong Woo Kang,Proposals — dwkang @ 10:54 pm

* Description: The term project will be a coffee table that interacts with the users. The basic design of the table consists of two boxes: one large, transparent box on which the coffee cups will be put, and a small , translucent box for the “entertainment” for the users. When the user sits down on the chair, the table will respond by emitting warm and diffusing light. The table will respond differently according to the actions made by the users. (e.g. putting the cup down on the table) The most exciting behavior of the table happens when there are two users sitting at both sides of the table and the cups are placed on the table; the inner box will start spinning.

  

* Bill of Materials: This project will require a large amount of plexi-glass for the both boxes. To enhance the effect of the glowing box, a minimum of 3 light bulbs, along with a several LEDs will be planted on the bottom of the inner box. A D/C motor will be used for the rotation of the inner box. However, depending on the development of the project (that might affect the movement of the inner box), a stepper motor can be used to create a different “stages” of movement. Two types of sensors will be used: I/R sensor and photocell.  

* Bill of Knowledge: The behavior of the table requires a variety of states and responses to those states. Careful programming will be required to assign the appropriate responses for different actions made by the users. The light bulbs, wires, batteries, motors, and other necessary components of the table must be configured and assembled properly.

 

October 16, 2007

[Dan D.W. Kang] Assignment 5: Automation

Filed under: Dong Woo Kang,Exercise 5: Mechanical Movement — dwkang @ 10:36 pm

dscn1086.JPGdscn1085.JPGdscn1083.JPGThis is a “toy” that uses four gears to generate a rotary mechanism.

The two larger gears are attached to the sides, and the two smaller gears are attached on the lower part of the toy.

In order to make the two larger gears rotate in the same direction, I put one extra gear, which reverses the movement of the existing lower gear.

The tricky part about making gears was that you need to be extremely meticulous when you have to decide how many teeth you use for one gear, at what angle you would cut each tooth, and how to position the gear next to one another so that none of the teeth would get jammed up.

I’m still deciding how I’m going to utilize the two larger gears to make a different type of movement other than just “rotation.” Anyhow this is what I have so far.  

Video attached below.

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

October 6, 2007

[Dan D.W. Kang] Assignment Four: Lamp

Filed under: Dong Woo Kang,Exercise 4: Four State Machines — dwkang @ 10:30 pm

*Description

I’ve made some modifications on my previous assignment to make a machine that has four different states, rather than a machine that has one state that has four different interactions. The lamp that I made uses two sensors to respond to its environment; a photocell and I/R sensor.

dscn0870.JPGdscn0868.JPG

4-states_2.jpg

Sleep- The lamp is in “sleep” state when the light is on. The green light is constantly on and it will stay like this as long as the light is there. In this state, even if you come close to the I/R sensor, the lamp will not respond. The only way to wake up the lamp is to turn off the light.

Arousal- When you turn off the light and it is dark enough, the lamp is now awake and ready to respond to its environment. In this state, the yellow light fades in and out. As you come close to the I/R sensor, the light will change its color to red, entering “attract” state.

Attract- The lamp is now in “attract” state. When the I/R sensor detects an object in front of the lamp, the red light will fade in and out. If the object stays in one position for long enough, the lamp will automatically switch to “reward” state.

Reward- The lamp flashes colorful lights in “reward” state. Once the lights start flashing, the lamp is satisfied and it does not detect the proximity of the object anymore. The lamp goes back to “sleep” state when you turn on the light again. Unless that happens, it will stay “happy” and flash its lights forever.

Video clip is attached below:

http://www.youtube.com/watch?v=kocl6r1G-ig

*Code

int lightVal = 0;
int distanceVal = 0;
int lightsensor = 0;
int distancesensor = 1;

int green = 13;
int yellow = 11;
int red = 9;
int blue = 10;

int staytime = 0;
int value = 0;
int state = 1;

void setup() {
pinMode(lightsensor, INPUT);
pinMode(distancesensor, INPUT);
pinMode(red,OUTPUT);
pinMode(yellow,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
Serial.begin(9600); // Set up the serial communication.
}

void loop()
{
lightVal = analogRead(lightsensor);
distanceVal = analogRead(distancesensor);
Serial.print("Raw Sensor value");
Serial.println(lightVal);

if (state == 1) {sleep ();}
else if (state == 2) {arousal ();}
else if (state == 3) {attract ();}
else if (state == 4) {reward ();}
}

void sleep()
{
alloff();
digitalWrite(green, HIGH);
if (lightVal <= 30) {state = 2;}
if (lightVal =150) {state = 3;}
}

void arousal()
{
alloff();
for(value = 0 ; value =0; value-=5)
{analogWrite(yellow, value);
delay(20);}
if (lightVal > 30) {state = 1;}
if (distanceVal >=150) {state = 3;}
}

void attract ()
{ alloff();
for(value = 0 ; value =0; value-=5)
{analogWrite(red, value);
delay(20);}
staytime++;
if (staytime > 10) {
state = 4;
staytime = 0;
}
if (lightVal > 30) {state = 1;}
if (distanceVal 30) {state =1;}
}

void alloff()
{
digitalWrite(red,LOW);
digitalWrite(green,LOW);
digitalWrite(yellow,LOW);
digitalWrite(blue,LOW);
}

void flicker ()
{
digitalWrite(red, HIGH);
delay(50);
digitalWrite(red,LOW);
digitalWrite(red, HIGH);
delay(50);
digitalWrite(red,LOW);
digitalWrite(green,HIGH);
delay(50);
digitalWrite(green,LOW);
digitalWrite(yellow,HIGH);
delay(50);
digitalWrite(yellow,LOW);
digitalWrite(blue,HIGH);
delay(15);
digitalWrite(blue,LOW);
}

void repeatflicker (int n) {
for (int i = 0; i&lt;=n ; i++)
{
flicker();
}
}

void final()
{
digitalWrite(red, HIGH);
delay(500);
digitalWrite(green, HIGH);
delay(500);
digitalWrite(yellow,HIGH);
delay(500);
digitalWrite(blue,HIGH);
delay(500);

digitalWrite(red, HIGH);
digitalWrite(green, HIGH);
digitalWrite(yellow,HIGH);
digitalWrite(blue,HIGH);
}

September 24, 2007

[Dan D.W. Kang] Assignment Four

Filed under: Dong Woo Kang,Exercise 4: Four State Machines — dwkang @ 9:51 pm

*Description

My “state machine” for this assignment essentially uses the same system that I’ve created for assignment 3. This time, however, I re-wrote the code so that it has the four different states and transitions between them.

 

 

The transition of this system is simple. It goes from sleep – arousal – attract – reward, according to the proximity of the object to the sensor. The state can always step back to the previous state (for example from reward to attract) if you simply back away from the sensor.  If the person leaves the chair to the sideway, instead of gradually backing away from the chair, the system will enter the state of “sleep,” repeating the whole process from the start.

Here is how it works:

View A: http://www.youtube.com/watch?v=65ufWzWCrLc

View B: http://www.youtube.com/watch?v=FUAd_VZSnrA

* Configuration

There are seven different LEDs attached to the chair, making the system seem more complicated than it really is. All the red wires from the LEDs are connected to the ground pin and the green wires are connected to the digital pins on Arduino board.  The I/R sensor was used to dectect the distance from the chair to the object, and it is attached at the bottom of the back support of the chair.

 

*Code

int analogValue0 = 0;
int analogPin0 = 0;
int value = 0;
int red1 = 13;
int red2 = 4;
int yellow1 = 12;
int yellow2 = 5;
int green1 = 11;
int green2 = 6;
int blue = 7;

void setup()
{
pinMode(analogPin0, INPUT);
pinMode(red1, OUTPUT);
pinMode(red2, OUTPUT);
pinMode(yellow1, OUTPUT);
pinMode(yellow2, OUTPUT);
pinMode(green1, OUTPUT);
pinMode(green2, OUTPUT);
pinMode(blue, OUTPUT);
Serial.begin(9600);
}

void loop()
{

analogValue0 = analogRead(analogPin0);
Serial.print(”Raw Sensor value;”);
Serial.println(analogValue0);

//sleep
if (analogValue0 =150 && analogValue0 <225)
{
digitalWrite(red1, LOW);
digitalWrite(red2, LOW);
digitalWrite(yellow1,LOW);
digitalWrite(yellow2,LOW);
digitalWrite(blue,LOW);
for(value = 0 ; value =0; value-=5)
{
analogWrite(green1, value);
analogWrite(green2, value);
delay(20);
}

}
//attract

if(analogValue0 >= 225 && analogValue0 = 450)
{
digitalWrite(red1, LOW);
digitalWrite(red2, LOW);
digitalWrite(yellow1, LOW);
digitalWrite(yellow2, LOW);
digitalWrite(green1, LOW);
digitalWrite(green2, LOW);
digitalWrite(blue, LOW);

digitalWrite(red2, HIGH);
delay(50);
digitalWrite(red2, LOW);
digitalWrite(yellow2, HIGH);
delay(50);
digitalWrite(yellow2, LOW);
digitalWrite(green2, HIGH);
delay(50);
digitalWrite(green2, LOW);
digitalWrite(blue, HIGH);
delay(50);
digitalWrite(blue, LOW);
digitalWrite(green1, HIGH);
delay(50);
digitalWrite(green1, LOW);
digitalWrite(yellow1, HIGH);
delay(50);
digitalWrite(yellow1, LOW);
digitalWrite(red1, HIGH);
delay(50);
digitalWrite(red1, LOW);

digitalWrite(red1, HIGH);
delay(50);
digitalWrite(red1, LOW);
digitalWrite(yellow1, HIGH);
delay(50);
digitalWrite(yellow1, LOW);
digitalWrite(green1, HIGH);
delay(50);
digitalWrite(green1, LOW);
digitalWrite(blue, HIGH);
delay(50);
digitalWrite(blue, LOW);
digitalWrite(green2, HIGH);
delay(50);
digitalWrite(green2, LOW);
digitalWrite(yellow2, HIGH);
delay(50);
digitalWrite(yellow2, LOW);
digitalWrite(red2, HIGH);
delay(50);
digitalWrite(red2, LOW);

digitalWrite(red2, HIGH);
delay(50);
digitalWrite(red2, LOW);
digitalWrite(yellow2, HIGH);
delay(50);
digitalWrite(yellow2, LOW);
digitalWrite(green2, HIGH);
delay(50);
digitalWrite(green2, LOW);
digitalWrite(blue, HIGH);
delay(50);
digitalWrite(blue, LOW);
digitalWrite(green1, HIGH);
delay(50);
digitalWrite(green1, LOW);
digitalWrite(yellow1, HIGH);
delay(50);
digitalWrite(yellow1, LOW);
digitalWrite(red1, HIGH);
delay(50);
digitalWrite(red1, LOW);

digitalWrite(red1, HIGH);
delay(50);
digitalWrite(red1, LOW);
digitalWrite(yellow1, HIGH);
delay(50);
digitalWrite(yellow1, LOW);
digitalWrite(green1, HIGH);
delay(50);
digitalWrite(green1, LOW);
digitalWrite(blue, HIGH);
delay(50);
digitalWrite(blue, LOW);
digitalWrite(green2, HIGH);
delay(50);
digitalWrite(green2, LOW);
digitalWrite(yellow2, HIGH);
delay(50);
digitalWrite(yellow2, LOW);
digitalWrite(red2, HIGH);
delay(50);
digitalWrite(red2, LOW);

digitalWrite(red2, HIGH);
delay(50);
digitalWrite(red2, LOW);
digitalWrite(yellow2, HIGH);
delay(50);
digitalWrite(yellow2, LOW);
digitalWrite(green2, HIGH);
delay(50);
digitalWrite(green2, LOW);
digitalWrite(blue, HIGH);
delay(50);
digitalWrite(blue, LOW);
digitalWrite(green1, HIGH);
delay(50);
digitalWrite(green1, LOW);
digitalWrite(yellow1, HIGH);
delay(50);
digitalWrite(yellow1, LOW);
digitalWrite(red1, HIGH);
delay(50);
digitalWrite(red1, LOW);

digitalWrite(red1, HIGH);
delay(50);
digitalWrite(red1, LOW);
digitalWrite(yellow1, HIGH);
delay(50);
digitalWrite(yellow1, LOW);
digitalWrite(green1, HIGH);
delay(50);
digitalWrite(green1, LOW);
digitalWrite(blue, HIGH);
delay(50);
digitalWrite(blue, LOW);
digitalWrite(green2, HIGH);
delay(50);
digitalWrite(green2, LOW);
digitalWrite(yellow2, HIGH);
delay(50);
digitalWrite(yellow2, LOW);
digitalWrite(red2, HIGH);
delay(50);
digitalWrite(red2, LOW);

digitalWrite(red1, HIGH);
delay(500);
digitalWrite(green1, HIGH);
delay(500);
digitalWrite(yellow1, HIGH);
delay(500);
digitalWrite(blue, HIGH);
delay(500);
digitalWrite(green2, HIGH);
delay(500);
digitalWrite(yellow2, HIGH);
delay(500);
digitalWrite(red2, HIGH);
delay(500);

digitalWrite(red1, HIGH);
digitalWrite(yellow1, HIGH);
digitalWrite(green1, HIGH);
digitalWrite(blue, HIGH);
digitalWrite(green2, HIGH);
digitalWrite(yellow2, HIGH);
digitalWrite(red2, HIGH);
delay(2000);

}

}

September 17, 2007

[Dan D.W. Kang] Assignment Three: Four States

Filed under: Assignments,Dong Woo Kang,Exercise 3: Four States — dwkang @ 10:21 pm

For assignment three, I used the sensor that detects distance from the previous assignment. The programming and configuration for each of the four states has a simple code that responds to the approaching object. The code is written so that it creates an appropriate signal that represents the four different states of sleep, arousal, attract, and award.  

Sleep: The red LED is constantly lit up when there is no activity involved in front of the sensor. This red light creates the state of “sleep.” When the sensor detects an approaching object, the red LED will switch off, making the system to wake up and go into the state of “arousal.”

http://www.youtube.com/v/wuxUAAS6oy0

dscn0782.jpg 

    

<Code> 

Arousal: Once the sensor detects the activity of a moving object, the system is fully awake and ready to respond to the movement of the object. The first response that the system shows is the three green LEDs that fade in and out a number of times. The system went into the state of “arousal.”   

http://www.youtube.com/v/xIztHz2seQM

dscn0781.jpg

<Code>

int analogValue0 = 0;

int analogPin0 = 0;int value = 0; int green1 = 6;                           int green2 = 5;int green3 = 3;void setup() { pinMode(analogPin0, INPUT);Serial.begin(9600);} void loop() { analogValue0 = analogRead(analogPin0);Serial.print(“Raw Sensor value;”);Serial.println(analogValue0);if (analogValue0 > 120) for(value = 0 ; value <= 255; value+=5) // fade in (from min to max)   {     analogWrite(green1, value);     analogWrite(green2, value);    analogWrite(green3, value);    delay(20); }   if (analogValue0 > 120)      for(value = 255; value >=0; value-=5)   {     analogWrite(green1, value);     analogWrite(green2, value);    analogWrite(green3, value);    delay(20);   }  if (analogValue0 < 120){  digitalWrite(green1, LOW);  digitalWrite(green2, LOW);  digitalWrite(green3, LOW);  } }

Attract: Now that the system is aware that the object is nearby, it now wants the object to come closer. The three green LEDs stop fading in/out and begin blinking consecutively, creating the state of “attract.”   

http://www.youtube.com/v/_antRCYriM0

 <Code>  

int analogValue0 = 0;int analogPin0 = 0;int green1 = 6;               int green2 = 5;int green3 = 3;void setup()           {  pinMode(analogPin0, INPUT);pinMode(green1, OUTPUT); pinMode(green2, OUTPUT);  pinMode(green3, OUTPUT);  Serial.begin(9600);}void loop(){analogValue0 = analogRead(analogPin0);Serial.print(“Raw Sensor value;”);Serial.println(analogValue0);if (analogValue0 > 200)  {  digitalWrite(green1, HIGH);     delay(500);                   digitalWrite(green1, LOW);     digitalWrite(green2, HIGH);  delay(500);  digitalWrite(green2, LOW);  digitalWrite(green3, HIGH);  delay(500);  digitalWrite(green3, LOW);  }else{  digitalWrite(green1, LOW);  digitalWrite(green2, LOW);  digitalWrite(green3, LOW);}} 

Reward: When the object follows the three green lights and comes close enough to the sensor, the system will go into the state of “Reward.” During this state, the four LEDs, each with different colors, will flash rapidly.  

http://www.youtube.com/v/BHcAvZYzQ9Q

dscn0780.jpg 

<Code>int analogValue0 = 0;int analogPin0 = 0;int red = 13;                 int green = 6;int blue = 11;int yellow = 10; void setup()                     {  pinMode(analogPin0, INPUT);  pinMode(red, OUTPUT);       pinMode(green, OUTPUT);  pinMode(blue, OUTPUT);  pinMode(yellow, OUTPUT);  Serial.begin(9600);} void loop()                   {analogValue0 = analogRead(analogPin0);Serial.print(“Raw Sensor value;”);Serial.println(analogValue0);if (analogValue0 > 400)  {  digitalWrite(yellow, HIGH);     delay(50);                   digitalWrite(yellow, LOW);     delay(50);                   digitalWrite(green, HIGH);  delay(50);  digitalWrite(green, LOW);  delay(50);  digitalWrite(red, HIGH);  delay(50);  digitalWrite(red, LOW);  delay(50);  digitalWrite(yellow, HIGH);  delay(50);  digitalWrite(yellow, LOW);  delay(50);  digitalWrite(blue, HIGH);     delay(30);                  digitalWrite(blue, LOW);   

  delay(50);           

  }else{  digitalWrite(red, LOW);  digitalWrite(blue, LOW);  digitalWrite(yellow, LOW);  digitalWrite(green, LOW);}}       

     

September 11, 2007

Dan D.W. Kang Assignment Two: Part Two- Flood Warning System

Filed under: Dong Woo Kang,Exercise 2: Add a Switch — dwkang @ 3:55 pm

Part Two:

* Description:

For the second part of the assignment, I designed a “flood warning system.” This system will detect the amount of the rainfall and send out a warning signal if the water level gets too high. This system actually uses “water” to switch on the warning system. The signals only use the red LEDs to effectively deliver the message of “warning.” Three small LEDs will blink each time consecutively, then the large LED in the center will flicker. You can watch the video clip to see how it works.

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

dscn0562.jpg

dscn0568.jpg

dscn0570.jpg

 * Code:

The four different blinking LEDs use simple blink programming code. “Delay” value is 300 for the small LEDs and 80 for the big LED. The blink programming for the big LED is duplicated 8 times to create a flickering effect.

  

int LED1 = 13;                // LED connected to digital pin 13

int LED2 = 12;              //LED connected to digital pin 12

int LED3 = 11;               //LED connected to digital pin 11

int BIGLED = 10;               //LED connected to digital pin 10

void setup()                    // run once, when the sketch starts

{

  pinMode(LED1, OUTPUT);      // sets the digital pin as output

  pinMode(LED2, OUTPUT);    // sets the digital pin as output

  pinMode(LED3, OUTPUT);

  pinMode(BIGLED, OUTPUT);

}

void loop()                     // run over and over again

{

  {

  digitalWrite(LED1, HIGH);   // sets the LED on

  delay(300);                  // waits for a second

  digitalWrite(LED1, LOW);    // sets the LED off

  delay(300);                  // waits for a second

  }

  {

  digitalWrite(LED2, HIGH);   // sets the LED on

  delay(300);                  // waits for a second

  digitalWrite(LED2, LOW);    // sets the LED off

  delay(300);                  // waits for a second

  }

  {

  digitalWrite(LED3, HIGH);   // sets the LED on

  delay(300);                  // waits for a second

  digitalWrite(LED3, LOW);    // sets the LED off

  delay(300);                  // waits for a second

  }

  {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(80);                  // waits for a second

  }

    {

  digitalWrite(BIGLED, HIGH);   // sets the LED on

  delay(80);                  // waits for a second

  digitalWrite(BIGLED, LOW);    // sets the LED off

  delay(300);                  // waits for a second

  }

}

   

[Dan D.W. Kang] Assignment Two: Part One

Filed under: Dong Woo Kang,Exercise 2: Add a Switch — dwkang @ 3:45 pm

Part One:

 * Description:

For the first part of this assignment, I created a system that detects an approaching object and responds by turning on three different colors of LED; red, blue and green. The green LED is on when there is nothing in front of the sensor. As an object starts approaching towards the sensor, the green LED will switch off and the blue LED will switch on instantly. The blue LED will remain switched on for a while until the object gets very close to the sensor. This time, the blue LED will switch off and then you will see the light from the red LED. You can watch the video below to see how it works.

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

* Configuration:

The three wires from the sensor are connected to Analog pin0, Power GND, and 5V on Arduino board. Three LEDs are laid out almost exactly the same as the first assignment (Assignment Zero); the shorter leg (-) of each LED is placed on the same row and is connected to GND pin on Arduino board. The longer leg (+) of the red LED is connected to pin 11 on Arduino board, the blue LED to pin 10, and the green LED to pin 9. Each LED uses a resistor to prevent the burn-out.

 dscn0587.jpg  dscn0588.jpg  

 dscn0589.jpg

 

 

 dscn0581.jpg  dscn0579.jpg dscn0584.jpg   * Code:

To have each LED respond at the different distances, analogValue of less than 200 (the object is farther) was assigned for the green LED to switch on. If the analogValue gets higher than 200 (which means the object is closer), “digitalWrite(green, LOW)” is programmed. Same goes for the blue and red LEDs, with different number of analogValue assigned to each one, depending on the distance of the object to the sensor. Serial.begin(9600) / Serialprint (“Raw Sensor value: “) also had to be included to have my laptop read the values from the sensor.

int analogValue0 = 0;

 

int analogPin0 = 0;

  

int red = 11;

int blue = 10;

int green = 9;

  

void setup() {

  pinMode(analogPin0, INPUT);

  pinMode(red,OUTPUT);

  pinMode(blue,OUTPUT);

  pinMode(green,OUTPUT);

    Serial.begin(9600); // Set up the serial communication.

}

void loop() {

  analogValue0 = analogRead(analogPin0);

  Serial.print(“Raw Sensor value: “);

  Serial.println(analogValue0);

 

  if (analogValue0 < 200) {

    digitalWrite(green, HIGH);

  }

  if (analogValue0 > 200) {

    digitalWrite(green, LOW);

  } 

 

  if (analogValue0 > 200) {

    digitalWrite(blue, HIGH);

  }

  if (analogValue0 < 200) {

    digitalWrite(blue, LOW);

  }

  if (analogValue0 > 500) {

    digitalWrite(blue, LOW);

  }

   

  if (analogValue0 > 500) {

    digitalWrite(red, HIGH);

  }

    if (analogValue0 < 500) {

    digitalWrite(red, LOW);

  }

}

September 5, 2007

Exercise One: “The Living” (Dan D.W. Kang)

Filed under: Dong Woo Kang,Exercise 1: What Is? — dwkang @ 9:47 pm

I have two examples of interactive furniture:

lg12.jpg   1. Living Glass

       This is like a window that moves in response to the environment around the occupants in the building. It uses kinetc surface through an array of sensors that are embedded within the surface. There are no motors or mechanical parts in this. The wires run through cast silicone and they contract due to electrical stimulus, causing gills to open and close.  The sensors detect the carbone dioxide level in the air and starts “breating” by opening / closing the gills.

lg00.jpg

lg06.jpg 

lg13.jpg

lg16.jpg

2. River Glow

This is not exactly “furniture,” but still has some interesting features that are worth discussing. The pods float in public waterways and detect the pH level in the water. After examining the water quality, they send a signal visible from the water. LEDs are connected to the pods and change their colors according to the condition of the water.

 rg06.jpg

rg071.jpg

rg08-1.jpg

September 4, 2007

Dan (Dongwoo) Kang: Exercise Zero

Filed under: Assignments,Dong Woo Kang,Exercise 0: Make A Lamp,Students — dwkang @ 12:04 am

layout 2* Effects:

There are three lamps each with the following colors- Blue / Green / Red

Blue and green lamps fade in and out at the same time and the red lamp fades in and out briefly while the light from the blue and green lamps is off. Blue and green lamps have a prolonged effect (10 seconds) whereas the red lamp lights up for a short period of time (1 second).

Once the red lamp goes off, the whole process starts over by blue and green lamps fading in.

You can click on the following youtube link to see how it works:          http://www.youtube.com/watch?v=G_EUT_imGD8  

* Parts used:

           – Three LEDs: Blue / Green / Red

           – Wires

           – Breadboard

           – 3 resistors

           – Arduino Board

           – Straws

* Layout:

The blue lamp gets its power from pin# 10, the red lamp from pin# 11, and the green lamp from pin# 9 of the Arduino board. There are wires that connect the longer leg (+) of each LED to the corresponding pins listed above.

The shorter leg (-) of each LED lamp is connected to the negative column on the breadboard through the resistor. The three resistors then send the power back to the ground pin on the Arduino board through one wire that is placed on the top of the negative column.

dscn0556.jpg

layout 2

* Code:

// Fading LED

// by BARRAGAN <http://people.interaction-ivrea.it/h.barragan&gt;

int value = 0;                            // variable to keep the actual value

int ledpinblue = 10;                           // light connected to digital pin 10

int ledpinred = 11;                       // light connected to digital pin 11

int ledpingreen = 9;                      // light connected to digital pin 9

void setup()

{

  // nothing for setup

}

void loop()

{

  for(value = 0 ; value <= 255; value+=5) // fade in (from min to max)

   {

    analogWrite(ledpinblue, value);           // sets the value (range from 0 to 255)

    analogWrite(ledpingreen, value);

    delay(100);                            // waits for 30 milli seconds to see the dimming effect

  }

  for(value = 255; value >=0; value-=5)   // fade out (from max to min)

  {

    analogWrite(ledpinblue, value);

    analogWrite(ledpingreen, value);

    delay(100);

  } 

for(value = 0 ; value <= 255; value+=5) // fade in (from min to max)

   {

    analogWrite(ledpinred, value);           // sets the value (range from 0 to 255)

    delay(10);                            // waits for 30 milli seconds to see the dimming effect

  }

  for(value = 255; value >=0; value-=5)   // fade out (from max to min)

  {

    analogWrite(ledpinred, value);

    delay(10);

  } 

}

Create a free website or blog at WordPress.com.