Making Furniture Interactive

October 5, 2007

Spinner Game (FSM)

My FSM project was a spinner game similar to the ones found at arcades. Pressing the button when the spinning lights get to a certain point increases your “score” and missing decreases it. If your score gets to 5, you are rewarded with a smiley face :0)

I thought this would be fairly simple to code but it actually ended up requiring a lot of research. I ended up using the Metro library, which is basically just a nice method that does all the millis() arithmetic for you.

:::pics, code, and fsm diagram after the break:::

(more…)

October 1, 2007

wooosh, face, wooosh, face…

Filed under: Exercise 3: Four States,Tiago Rorke — Tiago Rorke @ 10:44 pm

I drew little pictures like these in photoshop, then wrote a program in processing to analyse the pixels and turn them into arrays. I then copy and pasted the arrays into arduino.

Arduino Code

Processing Code

September 19, 2007

Exercise 2: Four States

Filed under: Exercise 3: Four States,Uncategorized — architk @ 10:55 pm

img_5225.jpg

img_5234.jpg

This exercise has given me time to recap everything I have learned so far in terms of programming and electrical wiring. I now need to think about and work on the fabrication part. I cleaned up the wires  which previously were all tangled up with jumper wire kit I bought from Radioshack. It was very neat and easy to understand the wiring.

In this exercise, I used photosensor again to create different states. The photosensor responds to the amount of light present in the surrounding area. I used three LEDs (Red, Yellow, Blue) and put short straws on top of the LEDs to maximize the dynamic glow in the dark. At first I struggled with the sensor to work because I put it in wrong direction. I understood now how the breadboard works and how I should place like photosensors and resistors.

Sleep is the state when there is no light turned on. Complete darkness. Attract is when the red light glows with limited light present. When I turn the switch of a lamp on, the lamp will illuminate the room and the red Led would change to yellow and to blue very fast. This is arousal. Reward is three lights blinking simultaneously.

img_5229.jpgimg_5227.jpgimg_5228.jpg

sourcecode language=’css’
int analogValue0 = 0;
int analogPin0 = 0;
int ledPinRed = 13;
int ledPinYellow = 11;
int ledPinGreen = 7;

void setup() {
  pinMode(analogPin0, INPUT);
  pinMode(ledPinRed,OUTPUT);
  pinMode(ledPinYellow,OUTPUT);
  pinMode(ledPinGreen,OUTPUT);
    Serial.begin(9600); // Set up the serial communication.
}

void loop() {
  analogValue0 = analogRead(analogPin0);
  Serial.print(“Raw Sensor value: “);
  Serial.println(analogValue0);
 
  if (analogValue0 > 400) {
    digitalWrite(ledPinGreen, HIGH);
  }
  else {
    digitalWrite(ledPinGreen, LOW);
  }
  if (analogValue0 > 125&&analogValue0 < 400) {
    digitalWrite(ledPinYellow, HIGH);
  }
  else {
    digitalWrite(ledPinYellow, LOW);
  }
  if (analogValue0 < 125) {
    digitalWrite(ledPinRed, HIGH);
  }
  else {
    digitalWrite(ledPinRed, LOW);
  }
}
/sourcecode

Assignment 3 | Study for State Machine

Filed under: Exercise 3: Four States,Matt Thompson — Mattt Thompson @ 7:05 am

After toying around with a few ideas for this assignment, I found myself coming back to the same kind of idea about how furniture could behave that kind of reminded me of my ex-girlfriend. I liked the idea of a piece that was just seductive enough to attract a user to engage with it, but then somehow trap the user if they tried to move on. It would be nothing special in the first place, which would make being stuck with it that much more infuriating.

(more…)

Exercise 3: Light Box

Filed under: Exercise 3: Four States,Joe Iloreta — jilore @ 1:28 am

Its not exactly a piece of furniture yet, but I tried to look at how the play of light could tell one how to behave with this object and its four states.

LEDs are placed on two sides of a plane that divide a small box out of which light projects. I vary the pulse of the light as well as location along the four states, using a piezo transducer and photocell as sensors.

Sleep is the well-understood fade-in/out.

Arouse is achieved by knocking (piezo code) near the box and waking it up.

Attract and Reward was supposed to be achieved by 1) blinking yellow lights that formed a “runway” for someone to put a pen in (btw now the box is a pen holder) and 2) placing the pen in the box and switching on a bright light below triggered by a photocell. The yellow LEDs that blink towards the slot for the pen do not show up on the video.

I didn’t achieve quite the lifelike quality that I wanted and it wasn’t quite as dramatic as I liked but has given me direction in terms of how to make this a little more interesting, suprising or dynamic in terms of lighting different hues in space. Like that game “Simon” but not quite.

Kipum Lee’s Exercise 3

Filed under: Exercise 3: Four States,Kipum Lee — Kip @ 1:11 am

Playing around with the photosensor, I made the sensitivity change the state of an orange LED from “sleep” to “arousal” by simply changing from “off” to a “fading in.” When more light was obstructed from the sensor, this triggered a blue LED (on the straw) to start blinking.

Another state I played around with is just LED’s lighting up in consecutive order. I’m not sure as to how I’m going to tie it into the other 3 states, but I’m just happy that they’re working for now.

CODE:
//Kipum Lee
//Exercise 3

int value = 0; // variable to keep the actual value
int ledpin = 9; // light connected to digital pin 9

int state = 1; // 1=sleep, 2=attract, 3=arousal, 4=reward

int ledMeter1 = 7;
int ledMeter2 = 5;
int ledMeter3 = 4;
int ledMeter4 = 3;

//for state 4
int potPin = 2; // select the input pin for the potentiometer
int val = 0; // variable to store the value coming from the sensor
int onoff = 0; // 0=fading off, 1=fading on, 2=blink
int state4Pin = 10;

void setup()
{
pinMode(ledpin, OUTPUT); // turns on LED in pin #9 PWM
pinMode(ledMeter1, OUTPUT); // turns on LED in pin #7
pinMode(ledMeter2, OUTPUT); // turns on LED in pin #5
pinMode(ledMeter3, OUTPUT); // turns on LED in pin #4
pinMode(ledMeter4, OUTPUT); // turns on LED in pin #3
pinMode(state4Pin, OUTPUT); // turns on LED in pin #10 PWM
}

void loop()
{
state = 4; // manually turning on state 4

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

//state: sleep = 1
void sleep()
{
for(value = 0 ; value =0; value-=5) // fade out (from max to min)
{
analogWrite(ledpin, value);
delay(30);
}
}

//state: attract = 2 // blinking
void attract()
{
for(int i=0; i< 3;i++)
{
analogWrite(ledpin, 255);
delay(300);
analogWrite(ledpin, 0);
delay(300);
}

}

//state: arouse = 3
void arouse()
{
digitalWrite(ledMeter1, HIGH);
delay(300);
digitalWrite(ledMeter2, HIGH);
delay(300);
digitalWrite(ledMeter3, HIGH);
delay(300);
digitalWrite(ledMeter4, HIGH);
delay(600);

digitalWrite(ledMeter4, LOW);
delay(300);
digitalWrite(ledMeter3, LOW);
delay(300);
digitalWrite(ledMeter2, LOW);
delay(300);
digitalWrite(ledMeter1, LOW);
delay(600);
}

//state: reward = 4
void reward() {
val = analogRead(potPin); // read the value from the sensor
if(val < 90 && onoff == 0) { //turns on LED when light is off. change to make it turn on with light
for(value = 0 ; value = 100 && onoff == 1) { // “&&” means all these have to be true
for(value = 255; value >=0; value-=15) // fade out (from max to min in multiples of 15)
{
analogWrite(ledpin, value);
delay(20); // waits for 20 milli seconds to see the dimming effect
}
onoff = 0; // 0 = turns off LED
}
else if (val < 30 && onoff == 1) {
for(int i=0; i< 3;i++)
{
analogWrite(state4Pin, 255);
delay(300);
analogWrite(state4Pin, 0);
delay(300);
}
onoff = 1;
}
}

Blinkidy

Filed under: Exercise 3: Four States,Jamin Hegeman — Jamin Hegeman @ 12:25 am

I made three LEDs glow or blink given different light conditions. Not sure if it completes the assignment, but I was happy to get it working. Sleep is nothing happening. Attract is when the white light glows when it starts to sense darkness. Arousal occurs as you get closer: the green LED blinks. The reward is touching the photocell, which illuminates the red LED.


int potPin = 2;    // select the input pin for the potentiometer
int ledPin = 3;   // select the pin for the LED
int ledPin2 = 10;
int ledPin3 = 6;
int inPin = 7;   // choose the input pin (for a pushbutton)

int val = 0;
int buttonVal = 0;       // variable to store the value coming from the sensor
int value = 0;     // variable to keep the actual value
int state = 0;
int state2 = 0;
int sensitivity = 80;
int sensitivity2 = 12;
int sensitivity3 = 8;

void setup() {
pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
Serial.begin(9600);
fadeIn(ledPin3);
}

void loop() {
val = analogRead(potPin);    // read the value from the sensor
if(val < sensitivity &amp;&amp; state == 0) {
fadeIn(ledPin);
state = 1;
}
else if(val >= sensitivity &amp;&amp; state == 1) {
fadeOut(ledPin);
state = 0;
}
if(val < sensitivity2 &amp;&amp; state2 == 0 &amp;&amp; state == 1) {
fadeIn(ledPin2);
state2 = 1;
}
else if(val >= sensitivity2 &amp;&amp; state2 == 1 &amp;&amp; state == 0) {
fadeOut(ledPin2);
state2 = 0;
}
if(val < sensitivity3 &amp;&amp; state == 0) {
fadeIn(ledPin3);
}
else if(val >= sensitivity3 &amp;&amp; state == 1) {
fadeOut(ledPin3);
}

Serial.println(val);
}

void fadeIn(int pin) {
//Serial.println(pin);
for(value = 0 ; value <= 255; value+=5) // fade in (from min to max)
{
analogWrite(pin, value);           // sets the value (range from 0 to 255)
delay(10);                            // waits for 30 milli seconds to see the dimming effect
}
}

void fadeOut(int pin) {
//Serial.println(pin);
for(value = 255; value >=0; value-=5)   // fade out (from max to min)
{
analogWrite(pin, value);
delay(10);
}
}

Imran’s Exercise 3 – Fill Up

Filed under: Exercise 3: Four States,Imran Sobh,Students — imranixd @ 12:21 am

The idea behind my project is using light as a virtual energy source. Using a photosensor, I shine a bright light on it and have the row of LEDs light up as an energy meter. Based on the amount of “energy” you can power something, or simply have another LED light up as long as there is energy left.

I focused on getting the circuit and programming working for this part of the project. I have the four states as separate functions and just started stringing together some of the states to get the filling up behavior.

Sleep In terms of the four states, the first one is a fading LED that gives it a sense that it is alive, but in a dormant state, I might make it fade a little slower for the final one.

Arousal For the second state, the same LED is now blinking quickly to make it seem more alert and awake. In this state it’s now possible to “fill up” the circuit with energy.

Attract This is the filling up state, where the more you fill, the more energy you get.

Reward The final state flashes like crazy once the energy is full, there is another part to this where you can drain the energy, at first it was going to be an LED, but I wanted the output to be a different type of energy.

For part two, I will venture into using a motor in the reward state, I also need to make all the transitions between the states and decide what else will trigger what happens… as well as focus on creating a physical object for it to reside inside of.


// Fading LED
// by BARRAGAN <http:> </http:>

int value = 0;                            // variable to keep the actual value
int ledpin = 9;                           // light connected to digital pin 9
//int buttonPin = ;
int state = 2; // 1=sleep, 2=attract, 3=arousal, 4=award;

int ledMeter1 = 7;
int ledMeter2 = 6;
int ledMeter3 = 5;
int ledMeter4 = 4;

int outputLED = 3;

int photoPin = 2;

int photoVal = 0;
int gasoline = 0;

void setup()
{
Serial.begin(9600);
pinMode(ledpin, OUTPUT);

pinMode(ledMeter1, OUTPUT);
pinMode(ledMeter2, OUTPUT);
pinMode(ledMeter3, OUTPUT);
pinMode(ledMeter4, OUTPUT);

pinMode(photoPin, INPUT);
pinMode(outputLED, OUTPUT);
}

void loop()
{
photoVal = analogRead(photoPin);

//Serial.println(photoVal, DEC);
Serial.println(gasoline);

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

}

void sleep()
{
for(value = 0 ; value <= 255; value+=5) // fade in (from min to max)
{
analogWrite(ledpin, value);           // sets the value (range from 0 to 255)
delay(30);                            // waits for 30 milli seconds to see the dimming effect
}
for(value = 255; value >=0; value-=5)   // fade out (from max to min)
{
analogWrite(ledpin, value);
delay(30);
}
}

void attract()
{
for(int i=0; i< 3;i++)
{
analogWrite(ledpin, 255);
delay(300);
analogWrite(ledpin, 0);
delay(300);
}

if(analogRead(photoPin) > 500 &amp;&amp; gasoline &lt; 100)
{
gasoline++;
}
arouse();

}

void arouse()
{
if(gasoline == 1) {digitalWrite(ledMeter1, HIGH);}
if(gasoline == 2) {digitalWrite(ledMeter2, HIGH);}
if(gasoline == 3) {digitalWrite(ledMeter3, HIGH);}
if(gasoline == 4 ) {digitalWrite(ledMeter4, HIGH);
state=4;}
/* delay(300);
digitalWrite(ledMeter2, HIGH);
delay(300);
digitalWrite(ledMeter3, HIGH);
delay(300);
digitalWrite(ledMeter4, HIGH);
/*
delay(600);

digitalWrite(ledMeter4, LOW);
delay(300);
digitalWrite(ledMeter3, LOW);
delay(300);
digitalWrite(ledMeter2, LOW);
delay(300);
digitalWrite(ledMeter1, LOW);
delay(600);*/

}

void reward()
{

digitalWrite(outputLED, HIGH);
digitalWrite(ledpin, 0);
delay(50);
digitalWrite(outputLED, LOW);
digitalWrite(ledpin, 255);
delay(50);

}

September 18, 2007

MJLevy, Part 3(ish)

Filed under: Exercise 3: Four States,Mike Levy — mjlevy @ 8:06 am

lovestory

So I was racking my brains about what kind of object I wanted to make and how it would act. I began with a whole brainstorming session about how objects have agency and books want to be read and pianos want to be played, and how objects in general want to be used by humans so they can fulfill their purpose in life. But then at some point I realized that I was going about this in a purely human-centered way, thinking only about how people interact with their items, and now how items interact with themselves.

So what I’ve created (or have the back end code to create) is a Love Story Between a Minute Hand and an Hour Hand, one of the untold love stories of our time. For the sake of debugging, I have the mode changes based on the position of the second hand, that way I can see things happening much faster.

Here’s the clock I built in processing to find the positions of the given clock hands.

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);}}       

     

Next Page »

Create a free website or blog at WordPress.com.