Making Furniture Interactive

December 11, 2007

Troll Carpet writeup

Filed under: Final Project,Ronit Slyper — Ronit @ 3:38 pm

Please see my project page here.

Advertisements

November 4, 2007

Carpet

Filed under: Final Project,Proposals,Ronit Slyper — Ronit @ 8:06 pm

I will build an interactive carpet platform, sandwich style: carpet, electronics, foam, more carpet. I’m going for localized interactivity using lilypad arduinos. Each arduino will have at least one form of sensor input and one form of output. Input=pressure sensors built from conductive foam. Output=voice chips.

October 27, 2007

Servo car

princess.jpgprincess_top.jpg

For the motorized portion of the assignment, I decided, heck with creativity, I just want to build a self-controlled car. I used a battery to power the arduino, a Parallax Ping Ultrasonic Range Finder, a servo (HS311), and a battery+motor little plastic car without steering that I had lying around. My final product was held together with:

  • Masking tape
  • 3M tabs
  • a bent wire hanger
  • cable ties
  • electrical tape
  • gravity

Good times. The wiring was straightforward – it turns out that neither the servo nor the range finder need external powering (I did the TIP120 thing with my cabinet project, though), and are run off the arduino output pins. After significant coding distress I looked for and obtained a servo library (I posted a link to it) to separate the servo timing from the range finder timing.

With this project I gained a new appreciation for stereo vision. With one stationary servo, the most I could do was wall-following for walls with gradual changes. The code keeps the car attempting to maintain a fixed distance from the wall.

#include
// debug
int ledPin = 3;

// ultrasonic range finder
int signalPin = 4;                // sensor signal pin connected to wiring pin 0
int elapsedtime = 0;
int last_elapsedtime = 0;

// servo
int servoPin = 9;     // Control pin for servo motor
int minPulse = 800;   // Minimum servo position (microseconds)
int maxPulse = 1800;  // Maximum servo position (microseconds)
int angle = 90;        // Amount to pulse the servo
int last_angle = 90;
ServoTimer1 st;

void setup() {
  Serial.begin(9600);
  st.attach(9);
  st.setMinimumPulse(minPulse);
  st.setMaximumPulse(maxPulse);
  st.write(angle);
  pinMode(ledPin, OUTPUT);
}

void loop() {
  elapsedtime = 0;
  pinMode(signalPin, OUTPUT);     // set signalPin as OUTPUT

  // Send 0-1-0 pulse to activate the sensor
  digitalWrite(signalPin, LOW);
  delayMicroseconds(2);
  digitalWrite(signalPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(signalPin, LOW);  

  // Listen to pulse
  pinMode(signalPin, INPUT);      // set signalPin as INPUT
  elapsedtime = pulseIn(signalPin, HIGH);  // get the length of the pusle while it is HIGH

  // the goal here will be to keep it at a steady 800
  // map 400 to 2000     to     170 to 10
  int med = 2000;
  if (elapsedtime < med)
      if (elapsedtime  med)
      if (elapsedtime > 2 * med)
        angle = 20;
      else
        angle = 60;
  if (elapsedtime == med)
      angle = 90;

  if (abs(angle - last_angle) > 1) {
    last_angle = angle;
    st.write(angle);
  }

  // debug led
  if (elapsedtime == med)
    digitalWrite(ledPin, HIGH);
  else
    digitalWrite(ledPin, LOW);

  // print value through Serial
  Serial.print("angle ");
  Serial.print(last_angle);
  Serial.print("    ");
  Serial.println(elapsedtime, DEC);
  delay(100);
}

October 18, 2007

Servo library

Filed under: Resources,Ronit Slyper — Ronit @ 8:19 am

I found this servo library essential for controlling a servo while timing anything else on the arduino at the same time. It is here.

October 15, 2007

Assignment: Automaton

Filed under: Exercise 5: Mechanical Movement,Ronit Slyper — Ronit @ 11:02 am

I built a frustrated coder, inspired by the coding animation on my homepage.

It looks like this:view.JPG and for size reference: size.JPG. Truly a wooden monstrosity, but it was my first time in the woodshop. And the mechanism: cam.jpg. The two outside hands (levers) type rapidly when the dowel is turned; the head rises then eventually thumps against the keyboard in frustration. C++ code is pasted to the inside of the enclosure.

September 19, 2007

Circuit-drawing software

Filed under: Resources,Ronit Slyper — Ronit @ 9:38 pm

I thought some people might find the free software Dia to be useful in future projects. It’s a diagram-drawing program, and does a great job of helping you draw out circuits in only a few minutes – often easier than explaining in English which wires go where 🙂 . (For linux, Windows, and Mac via macports.)

Thought on Iain Banks’s “Descendant”

Filed under: Readings,Ronit Slyper — Ronit @ 9:24 pm

So, a thought on this reading…

The thing about the story that really sticks in my mind, a few days after having read it, is the camera. The protagonist has all this advanced suit technology, yet derives the most comfort from a simple still camera. It’s intentionally discordant – the suit is/appears nearly human, but not human enough, and therefore provides an odd lack of comfort to the protagonist, who only interacts with it in formal, somewhat stilted dialog. The reader, too, is torn between distaste and empathy for the suit – the author varies our views of it, never letting us settle on one feeling. This strange mix of horror/kinship has been termed the uncanny valley, a phenomenon where objects that appear too humanlike assume an aura of zombie-ness that humans find discomfiting. Thus the camera, with its static, yet familiar, pictures, provides more comfort than the more advanced technology.

September 16, 2007

A Theft-Aware Cabinet

My goal with this assignment was to get something mechanical working. The result was so amusing that I posted a video here, (downloadable and playable by mplayer on a mac).

The Hardware

  • I built a cabinet out of foamcore. It is very hard to cut foamcore in a straight line. The bottom was hollow; I used mounting tape to stick the Arduino and breadboard onto it.chest.jpgtrickbottom.jpg
  • I ran 3 leds up the back of the cabinet, one to each shelf.leds_in_back.jpg
  • A piezo buzzer from RadioShack was mounted onto the bottom with tape.
  • A hobby-motor circuit was constructed on the breadboard, using the tutorial here. Two AA batteries served as the battery source.underneath.jpg
  • A pair of IR emitter/detector LEDs were obtained from RadioShack, added to the breadboard, then poked up through the bottom shelf. The emitter is on a simple power-resister-emitter-ground circuit; it gives off IR. I used a camera to see that it was glowing. The detector connects to an analog pin; I tested what the pin’s value was when the detector was covered vs. open, and found a threshold of 400 worked well.ir.jpg
  • The wiring:wiring1.jpg

What It Does

An object is placed over the detector. The doors to the cabinet are open and the LEDs cycle pleasantly. But! If one steals the object, the LEDs flash warningly and a buzzer goes off. If the object is returned in time (i.e. the detector’s value goes back below the threshold), everything returns to normal. If not, the doors close and the buzzer cycles unendingly. One images that an Indiana Jones attack would be most effective…

The states machine appears in the following diagram:statemachine.jpg

The Software

/* chest of drawers */
/*
0 sleep - LEDs blinking (sleep -> arousal via IR)
1 arousal - LEDSs flash (arousal -> sleep via IR returns, arousal -> attract via IR remains)
2 attract - motor goes (attract -> reward via time)
3 reward - buzzer (sink)
*/

int led1 = 4;
int led2 = 2;
int led3 = 3;
int motor = 9;
int buzzer = 12;
int detector = 0;
int detector_threshold = 400;
int state = 0;
int stateCounter = 0;

void setup() {
pinMode(led1, OUTPUT); // declare the ledPin as as OUTPUT
pinMode(led2, OUTPUT); // declare the ledPin as as OUTPUT
pinMode(led3, OUTPUT); // declare the ledPin as as OUTPUT
pinMode(buzzer, OUTPUT);
}

void loop() {
int detector_value = analogRead(detector);
stateCounter++;
if (state == 3) {
// do nothing
} else if (state == 2) {
state = 3;
} else if (detector_value > detector_threshold) {
if (state == 0) {
state = 1;
stateCounter = 0;
} else if (state == 1 &amp;&amp; stateCounter > 10) {
state = 2;
stateCounter = 0;
}
} else if (detector_value &lt; detector_threshold) {
if (state == 1) {
state = 0;
stateCounter = 0;
digitalWrite(buzzer, 0);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
}
}

if (state == 0) {
int s = stateCounter % 6;
if (s==0)
digitalWrite(led1, HIGH);
if (s==1)
digitalWrite(led2, HIGH);
if (s==2)
digitalWrite(led3, HIGH);
if (s==3)
digitalWrite(led1, LOW);
if (s==4)
digitalWrite(led2, LOW);
if (s==5)
digitalWrite(led3, LOW);
delay(500);
}
if (state == 1) {
int s = stateCounter % 2;
if (s==0) {
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(buzzer, HIGH);
} else if (s==1) {
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(buzzer, LOW);
}
delay(300);
}

if (state == 2) {
analogWrite(motor, 255);
delay(6000);
analogWrite(motor, 0);
}

if (state == 3) {
digitalWrite(buzzer, HIGH);
delay(1000);
digitalWrite(buzzer, LOW);
delay(4000);
}
}

September 10, 2007

Candle Lamp and Switch of Frustration

Filed under: Exercise 2: Add a Switch,Ronit Slyper — Ronit @ 11:18 pm

Candle Lamp

I built a lamp that acted as a candle – you blow on it and it goes out; you blow on it again and it goes back on (don’t all candles do that? 🙂 ). Steps:

1. Build the circuit using a microphone. The microphone wasn’t sensitive enough for what I wanted – to have the lamp respond to music – so I used a preamp circuit adapted from here. Still not sensitive enough, tired of going to RadioShack, so I went with a candle theme. (A piezo element had the same problem)

.circuitry1.jpgwiring.jpg

2. The code kept a running average of the mic’s output, looked for a change in voltage, and toggled the LED.

/* Candle
* by Ronit
*/

int ledPin = 13;      // led connected to control pin 13
byte val = 0;         // variable to store the value read from the sensor pin
int blowSensor = 2;
int window[100];
int avg;
int window_index;
int candle = 0;     // start out off

void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT
for (int i = 0, window_index = 0; i &lt; 100; i++)
window[i] = 0;
Serial.begin(9600);       // use the serial port
}

void loop() {
val = analogRead(blowSensor);    // read the sensor and store it in the variable "val"
-
if (val + 20 &lt; avg) {
if (candle==0) candle = 1; else candle = 0;
if (candle==0) digitalWrite(ledPin, LOW); else digitalWrite(ledPin, HIGH);
delay(1000);
}

if (candle==0)
digitalWrite(ledPin, LOW);
else
digitalWrite(ledPin, HIGH);

avg -= window[window_index];
window[window_index] = val;
avg += window[window_index];
Serial.println(val,DEC);
Serial.print("avg ");
Serial.println(avg, DEC);
delay(100);
}

3. House the candle.flame.jpgflame_lit.jpg

Switch of Frustration

Ever wish you could bang your head against the wall, a light would go off, and an idea would pop into your head? I accomplished the first two. An LED was connected from digital Pin 13 to ground with a break in the circuit taped to the wall. Conductive tape was unobtrusively placed on the forehead of the frustrated subject.switch_setup.jpgwall.jpgswitch_action_shot.jpg

September 4, 2007

lamp

Filed under: Exercise 0: Make A Lamp,Ronit Slyper — Ronit @ 4:32 pm

Steps

  1. I began by sticking a glowing LED into every blown glass piece I’ve made. Those of a transparent color looked bad because you could see the circuitry inside, so I finally settled on this piece:
    Items of the Lamp, which inside is hollow like so:Inside of Glass Thing.
  2. Next it was time to solder, so the LEDs could reach inside the lamp. I soldered wires onto the ends of 5 LEDs (the novelty wore off fairly quickly). Soldering
  3. Setting up. The LEDs were positioned to line up with the glass thing’s four eyes, plus one LED near the top. Five wires ran from the Arduino, to the prototyping board, and attached to 5 resistors, which went through the LEDs and then to ground, as shown in the wiring diagram. The four eyes’ wires were digital; the other was analog.Circuitrywiring
  4. .

  5. The code pulses the red light, then open’s the glass figure’s “eyes”, has it blink a bit, then plays with different eye-blinking patterns.
    /*
    * Lamp
    * by Ronit Slyper
    *
    * 2 - bottom right
    * 3 - bottom left
    * 4 - top right
    * 5 - top left
    * 9 - top red, PWM
    */int timer = 100;                   // The higher the number, the slower the timing.
    int pins[] = { 2, 3, 4, 5 }; // an array of pin numbers
    int num_pins = 4;                  // the number of pins (i.e. the length of the array)
    int pwmPin = 9;
    int mode = 0;
    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
    }void loop()
    {
    int shortdelay = 40;
    int longdelay = 1000;
    int i, j;
    // begin code
    if (mode==0) {                  // red warning light
    for (j = 0; j &lt; 5; j++) {
    for (i = 0; i =0; i-=5) {
    analogWrite(pwmPin, i);
    delay(shortdelay/2);
    }
    } // end foreach j
    } else if (mode==1) {                    // cute blinky thing
    digitalWrite(2, HIGH);
    delay(longdelay);
    digitalWrite(3, HIGH);
    delay(longdelay);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    delay(longdelay);
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    delay(longdelay * 3);
    digitalWrite(4, HIGH);
    delay(longdelay);
    digitalWrite(5, HIGH);
    delay(longdelay);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    delay(longdelay);
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH);
    delay(longdelay * 4);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    } else if (mode==2) {
    for (i = 0; i &lt; 5; i++) {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    delay(longdelay * 2);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH);
    delay(longdelay * 2);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    }
    } else if (mode==3) {
    for (i = 0; i &lt; 5; i++) {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    delay(shortdelay);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH);
    delay(shortdelay);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    analogWrite(pwmPin, 51 * i + 51);
    delay(shortdelay);
    analogWrite(pwmPin, 0);
    }
    } else if (mode==4) {
    for (i = 0; i &lt; 20; i++) {
    digitalWrite(2, HIGH);
    digitalWrite(5, HIGH);
    delay(longdelay);
    digitalWrite(2, LOW);
    digitalWrite(5, LOW);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
    delay(longdelay);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    }
    } else if (mode==5) {
    for (i = 0; i &lt; 5; i++) {
    analogWrite(pwmPin, 255);
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH);
    delay(longdelay);
    analogWrite(pwmPin, 0);
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
    }
    } else if (mode==6) {
    delay(longdelay);
    }
    delay(shortdelay);
    mode++;
    mode %= 7;
    }
    
  6. The results looked really cool in the extreme dark: Lighted Lamp
Next Page »

Create a free website or blog at WordPress.com.