Making Furniture Interactive

October 16, 2007

Bug

Filed under: Derk Wolmuth,Exercise 4: Four State Machines — derkbw @ 2:40 pm

This work was finally shown at the  Brew House Gallery as part of Rossum’s “The Uncanny Valley” Robotic/Art show.

Consisting of a breakbeam sensor, 3 large relays, and  two 650 watt spotlights. The work was triggered by an IR proximity sensor. The random analog data from the Vibra tab sensor, which the cockroach should have actuated did not end up occuring.

Advertisements

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

LED digit clock 2

Filed under: Exercise 4: Four State Machines,Marc Manzke — marcmanzke @ 9:01 pm

LED digit clock is a nixie-style clock with sound activated state machine. Eight LEDs are embedded in a machined block of acrylic. The block is braced against overturning moment with a short section of aluminum angle which is tapped with socket head bolts. Hot and ground are then routed from each LED to the arduino which also powers a small op amp and microphone.

Coding the clock necessitated a series of 10 code arrays to govern the physical outputs of 0 through 9. Other functions output the values of hour, minute and second counters to the physical array. The four states of the clock are a default counting state which blinks the entire array on the minute every minute. The second is a slightly more elaborate display on the hour. Left alone the clock will attempt to attract attention via these two states. If one asks the clock what time it is, the microphone / op amp assembly triggers a recognition sequence to indicate reaction to the audio stimuli. This state is immediately followed by outputting the actual time in sequential hour:minute format. The clock then returns to its default minute counting state. Will post code on another page.

digits diagram

setup

digit 4

(more…)

October 5, 2007

LED digit clock

Filed under: Exercise 4: Four State Machines,Marc Manzke — marcmanzke @ 9:32 pm

digit clock teaserLED digit clock is operational, it has run for several hours accurately. full documentation to come ASAP.

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…)

Imran’s Exercise 4 – milo

Filed under: Exercise 4: Four State Machines,Imran Sobh — imranixd @ 1:11 am

The set-up
I made a mini-robot named milo. He has 2 eye LEDs, 4 stomach LEDs, a piezo sensor in the back of his head, a photosensor in his mouth, and a DC motor in the top of his head. Feed him light to give him energy, then let him release it through is propeller.

Sleep: In this state milo’s eyes glow faintly while he sleeps, if you open the back of his head and touch the piezo sensor he wakes up and goes to the arousal state.

Arousal: In this state milo is alert and blinking his eyes. If you leave him for too long he will go back to sleep, otherwise feed him light to get to the next state

Attract: In this state milo is filling up with the light you feed him as shown by the lights on his body. If you stop filling before the maximum amount, he drains the light and returns to the arousal state. Otherwise filling him to the maximum amount allows you to move on to the reward state.

Reward: You can only get to this state when milo is fully charged with light. Once he is full, if you press on the piezo in the back of his head, he will discharge the energy by spinning his head-propeller and return to the arousal state.

(more…)

October 4, 2007

spika.4 moods

Filed under: Beste Nazilli,Exercise 4: Four State Machines — botto @ 11:15 pm

So as you can see from the video that Spika my dog 🙂 have 4 states.

There is a photocell to sense the shadow as you come closer, all the modes are using the same sensor , as output I used a servo motor and LEDs. I want to remind that I burned a servo motor during the preparation. But I think it was b/c of the code.As it is fixed, I guess it works fine. It is not still in the way that I want to ( as physical apperacne) but it works well.

1st mode :Asleep //does nothing( waits for intearction let’s say:))
2nd mode:Awake –>just came a liitle bit close// makes small shakes by his head and LEDs on the body starts to blink
3rd mode:Friendly –> as enough as a friend closeness// start to shake his head remarkably ( 90 degrees)
4rd mode:Angry –> you are too closeee // starts to shake his head more randomly ( aggresively) compare to the friendly mode and starts to make a buzz alarm noise.

So in every mode , it is possible for Spika to go to any of the modes, as long as the photosensor have the values that set up for the values.

here is the code:

int timer = 255;                   // The higher the number, the slower the timing.
int pins[] = {
13, 12, 8, 7, 4, 2 };       // an array of pin numbers
int num_pins = 6;                  // the number of pins (i.e. the length of the array)
int value = 0;
int angrycounter = 0;
int happycounter = 0;
int sleepcounter = 0;
int lightReading;

int servoPin = 9;            // R/C  Servo connected to digital pin
int switchPin = 10;            //  digital input pin for a switch
int buzzerPin = 11;
int myAngle;                 // angle of the servo (roughly in degrees) 0-180
int pulseWidth;              // function variable
boolean switchState = false;    // the state of the switch

int closed = 0;
int opening = 1;
int open = 2;
int closing = 3;

int mouthState = closed;

int asleep = 0;
int awake = 1;
int friendly = 2;
int angry = 3;

int spikaState = asleep;

//ldr stuff
int LDRpin = 0;
int startLDRreading;
//piezo stuff
int speakerOut = 11;
byte names[] = {'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C'};
//int tones[] = {1915, 1700, 1519, 1432, 1275, 1136, 1014, 956};
int tones[] = {1915, 1700, 1519, 1432, 1275, 1136, 1014, 300};
byte melody[] = "4C4C4C4C4C8p8p4C4C4C4C4C";
// count length: 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
//                                10                  20                  30
int count = 0;
int count2 = 0;
int count3 = 0;
int MAX_COUNT = 12;
int statePin = LOW;

void servoPulse(int servoPin, int myAngle) {
pulseWidth = (myAngle * 11) + 500;  // converts angle to microseconds
digitalWrite(servoPin, HIGH);       // set servo high
delayMicroseconds(pulseWidth);      // wait a very small amount
digitalWrite(servoPin, LOW);        // set servo low
delay(20);                          // refresh cycle of typical servos (20 ms)
}

void buzzer() {
analogWrite(speakerOut, 0);
for (count = 0; count &lt; MAX_COUNT; count++) {
statePin = !statePin;
for (count3 = 0; count3 &lt;= (melody[count*2] - 48) * 30; count3++) {
for (count2=0;count2&lt;8;count2++) {
if (names[count2] == melody[count*2 + 1]) {
analogWrite(speakerOut,200);
delayMicroseconds(tones[count2]);
analogWrite(speakerOut, 0);
delayMicroseconds(tones[count2]);
}
if (melody[count*2 + 1] == 'p') {
// make a pause of a certain size
analogWrite(speakerOut, 0);
delayMicroseconds(500);
}
}
}
}
}

void LEDs()
{
int i;

for (i = 0; i &lt; num_pins; i++) {

for(value = 0 ; value = num_pins; i++) {
for(value = 255; value &gt;=0; value-=5)   // fade out (from max to min)
{
analogWrite(pins[i], value);
delay(10);
}
}
}

void setup()
{
int i;

for (i = 0; i &lt; num_pins; i++)   // the array elements are numbered from 0 to num_pins - 1
pinMode(pins[i], OUTPUT);      // set each pin as an output
pinMode(servoPin, OUTPUT);          // set servoPin pin as output
pinMode(switchPin, INPUT);         // set the switch pin to be an input
Serial.begin(9600);

//take the average of 10 readings and store as our LDR start val used for calibration
for(int i =0 ; i 50){
spikaState = awake;
angrycounter=0;
sleepcounter=0;
happycounter=0;
}
}

//awake

if (spikaState == awake){
Serial.println("spika awake");
servoPulse(servoPin, random(10,30));
LEDs();
lightReading = analogRead(LDRpin) - startLDRreading ;
if(lightReading&gt;150){
angrycounter++;
//sleepcounter--;
//happycounter--;
} else if(lightReading&gt;60){
happycounter++;
// angrycounter--;
//sleepcounter--;
} else if(lightReading&gt;50){
spikaState = friendly;
} else if(lightReading60 &amp;&amp; lightReading 200){
angrycounter++;
}
*/

if (happycounter &gt;5){
spikaState = friendly;
angrycounter=0;
sleepcounter=0;
happycounter=0;
}

if (angrycounter &gt;5){
spikaState = angry;
angrycounter=0;
sleepcounter=0;
happycounter=0;
}

if (sleepcounter &gt;5){
spikaState = asleep;
angrycounter=0;
sleepcounter=0;
happycounter=0;
}
}

// friendly

if (spikaState == friendly){
Serial.println("spika friendly");

for (myAngle=0; myAngle150){
angrycounter++;
//sleepcounter--;
//happycounter--;
} else if(lightReading&gt;60){
happycounter++;
//angrycounter--;
//sleepcounter--;
} else if(lightReading200){
angrycounter++;
} else if(lightReading&gt;60){
happycounter++;
}

if (lightReading&gt;100){
angrycounter++;
}
*/

if (angrycounter &gt;10){
spikaState = angry;
angrycounter=0;
sleepcounter=0;
happycounter=0;
}
if (sleepcounter &gt;10){
spikaState = awake;
angrycounter=0;
sleepcounter=0;
happycounter=0;
}

}

//angry

if (spikaState == angry){
lightReading = analogRead(LDRpin) - startLDRreading ;
Serial.println("spika angry");
if(lightReading&lt;150){
sleepcounter++;
//happycounter--;
//angrycounter--;
}
for (myAngle=0; myAngle5){
spikaState = friendly;
angrycounter=0;
sleepcounter=0;
happycounter=0;
}
}
}

October 3, 2007

Kipum Lee’s Final 4 States

Filed under: Exercise 4: Four State Machines,Kipum Lee — Kip @ 11:57 pm

I have 3 sensors and 4 states.

1st State: One yellow LED is lit, w/ the light intensity proportional to the amount of light entering sensor 1 (on board).

2nd State: With the press of the red switch, the yellow LED starts to blink. Covering the other sensor on the yellow straw will bring the LED back to the 1st State.

3rd State: From the 2nd State, covering sensor 1 on the board will make it go to the 3rd State where the 3 red LED start to have a light show. Once again, covering the sensor on the yellow straw will bring the yellow LED back to the 1st State.

4th State: To go to the 4th State, simple press the red switch from the 3rd State. To go back to the 1st State, cover the sensor on the yellow straw.

Also, to go immediately to the 4th State from the 1st State, cover both photosensors (on yellow straw as well as the one on the board).

(more…)

frenzy box

Filed under: Exercise 4: Four State Machines,Joe Iloreta — jilore @ 11:42 pm

I put my LED contraption into an translucent box, and tried to make the LED sequences a little more behavior-like.

Sleep = fade in/out

Arouse = knock sensed by piezo

Attract = frenzy of lights that continue blinking until…

Reward = placing hand closer and closer to top (photocell) will put the box back to sleep

Interactive LEDs

Filed under: Exercise 4: Four State Machines,Jamin Hegeman — Jamin Hegeman @ 5:57 pm

This project has two main states.

Sleep: By default, the program is asleep.

Awake: If the photocell gets dark, it awakens. The four LEDs fade in and out in series. After a few series without being interacted with, it goes back to sleep.

There are two other sub-states.

Attract: If it’s asleep and you don’t wake it up for a while, all the LEDs blink to attract your attention.

Reward: If it’s awake and you continue to play with it (cover the photocell) it rewards you with flashing LEDs.

(more…)

Next Page »

Create a free website or blog at WordPress.com.