Making Things Interactive

May 1, 2008

Course Review

Filed under: Assignments,Final Writing Assignment,Thomas Hendrickson — tphendrickson @ 10:53 pm

Mostly everything in the course was incredibly new to me and constantly challenged me. At times it could be very frustrating, mostly the hardware aspects, but also a design process that was different than what I have been taught. Still, I took a lot from this course and felt a lot of satisfaction from what I was able to produce.

My main criticisms of how the course was taught were what I expressed in class today. The Lady Ada tutorials in the beginning of class were extremely helpful. Once things progressed from there, I found it very hard to follow other tutorials and trying to remember class examples concerning hardware. I think if there were proven, helpful sources that were readily available when homework was assigned. This could have saved me countless hours of searching for concrete examples and help.

Other than that, I felt like it was a very enjoyable course, and hope that I can apply what I learned in the future. Hopefully there will be opportunities to employ creative design in construction management.

Advertisements

April 15, 2008

Final Project: Light Plant

Filed under: Assignments,Thomas Hendrickson — tphendrickson @ 11:54 am

My last midterm project (the interactive indo board) was cumbersome and hard to set up/transport, so for this project I wanted to make something that was easy to install and simple to set up. I thought of something that could sit in a room that people could interact with but not take up too much room or be too distracting, like an interactive decoration. So my idea was to have something that reflected a plant’s behavior, that would sense light and react.

A photosensor gets a reading of what the light is in the surrounding environment initially, and then calibrates an activation value based on this reading. When the light reaches a value that is higher than the activation value, the servo rotates a fabricated wooden gear and wooden column with a hexagonal top rises. LEDs protruding from the column light up, and the photosensor is at the top, all soldered to longer jumper wires. There are four cases to the code:

Case 1: Light is sensed as above the activation and the column is down.

  • The servo rotates the column up.
  • The LEDs light up.

Case 2: Light is sensed as above the activation value and the column is up.

  • The servo does not rotate.
  • The LEDs stay light.

Case 3: Light is sensed as below the activation value and the column is up.

  • The servo rotates the column down.
  • The LEDs turn off.

Case 4: Light is sensed as below the activation value and the column is down.

  • The servo does not rotate.
  • the LEDs stay off.

Code:

Servo servo1;

int ledPin1 = 13;
int photoPin = 0;
int ledPin2 = 2;
int ledPin3 = 3;
int ledPin4 = 4;
int ledPin5 = 5;
int readIn = 0;
int initialRead = 0;
int activateVal = 0;
int status = 0;

void setup()
{
Serial.begin(19200);

servo1.attach(15);
servo1.setMinimumPulse(800);
servo1.setMaximumPulse(2000);

pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
pinMode(ledPin3, OUTPUT);
pinMode(ledPin4, OUTPUT);
pinMode(ledPin5, OUTPUT);
pinMode(photoPin, INPUT);

blink(); //blinks the status LED
initialRead = analogRead(photoPin); //gets initial reading for photosensor
activateVal = (initialRead * 2) + 5; //the activation value will be double the initial
blink();

}

void loop()
{
Servo::refresh();

readIn = analogRead(photoPin);

//Case 1: Light Turned On (Servo move up, LEDs on)
if ((readIn >= activateVal))
{
servo1.write(0);
status = 1;
digitalWrite(ledPin1, HIGH);
lightLeds();
}

//Case 2: Light Turned Off (Servo move down, LEDs off)
if ((readIn < activateVal) &amp;&amp; (status == 1)) { servo1.write(90); status = 0; digitalWrite(ledPin1, LOW); turnOffLeds(); } //Case 3: Lighting the same and off (Servo off, LEDs off) if ((readIn < activateVal) &amp;&amp; (status == 0)) { status = 0; digitalWrite(ledPin1, LOW); turnOffLeds(); } //Case 4: Lighting the same and on (Servo off, LEDs on) if ((readIn >= activateVal) &amp;&amp; (status == 1))
{
status = 1;
digitalWrite(ledPin1, HIGH);
lightLeds();
}

Servo::refresh();

}

void blink()
{
digitalWrite(ledPin1, HIGH);
delay(100);
digitalWrite(ledPin1, LOW);
delay(100);

}

void lightLeds()
{
for (int i = 2; i < 6; i++) { digitalWrite(i, HIGH); } } void turnOffLeds() { for (int i = 2; i < 6; i++) { digitalWrite(i, LOW); } }[/sourcecode] The code should read '#include ' which was an imported package used to code the servo's rotation.

The wiring before soldering the LEDs and photosensor.

The servo attached to the gear.

The wiring after soldering.

The final product after hiding the hardware.

Parts List:

  • 5 1 kilo ohm resistors
  • 4 LEDs
  • 1 photosensor
  • 1 Hi-Tec Standard Servo
  • Breadboard
  • Arduino
  • Jumper wire
  • Bass wood, PCM board, balsa wood
  • Flowerpot

Here is the youtube link, but I couldn’t rotate the video after it was imported:

March 27, 2008

State Machine: Light Motor

Filed under: 8: State Machine,Assignments,Thomas Hendrickson — tphendrickson @ 1:06 pm

I created a circuit with a motor that will turn on if the amount of light surrounding it increases. I calibrated a photosensor to accomplish this, which also will help in my final project.

State Diagram:

Circuit Photo:

Code:

 


int motorPin = 4;
int ledPin = 13;
int photoPin = 0;
int readIn = 0;
int initialRead = 0;
int activateVal = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
  pinMode(motorPin, OUTPUT);
  pinMode(photoPin, INPUT);

  blink();     //blinks the status LED
  initialRead = analogRead(photoPin); //gets initial reading for photosensor
  activateVal = initialRead * 2;      //the activation value will be double the initial
  blink();   

}

void loop()
{
    readIn = analogRead(photoPin);    //gets the current sensor reading

    while (readIn >= activateVal)     //while loop turns on motor and status LED if current reading
    {                                 //is greater than the activation value
      digitalWrite(ledPin, HIGH);
      digitalWrite(motorPin, HIGH);

      readIn = analogRead(photoPin);  //checks the current value
    }

    digitalWrite(ledPin, LOW);        //turns off motor and LED if current value is not great enough
    digitalWrite(motorPin, LOW);

}

void blink()
{
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
    delay(1000);
}

March 25, 2008

Final Project Proposal (Revised)

Filed under: Assignments,Thomas Hendrickson — tphendrickson @ 7:01 pm

Since my original post wasn’t very detailed at all, I drew a sketch of what I envisioned the final product to look like, along with a schematic.

I finalized on having something like a flowerpot, where a fabricated plant extends out of the pot via a servo motor if a photosensor senses the surrounding light as “high.” The values for high and low light would be determined through calibration. If the light value is sensed as “low” after “high”, the servo motor would move the plant down, and the plant would hide. The plant would remain in that state until sensing the light as “high” again.

March 24, 2008

Final Project Proposal: Interactive Plants

Filed under: Assignments,Thomas Hendrickson — tphendrickson @ 7:54 pm

I wanted to experiment with some sort of interactive household item, and I felt something that resembled plant life could be the most fun to work with. I want to create something that interacts with the lighting around it and produces a reaction that is attractive to users/viewers.

My original idea was to have plant petals/leaves closed up when there was no light, and when a light was turned on it would blossom and LEDs inside would light up and possibly pulse. This blossoming action could be done with separate servo motors, and the code would need to calibrate the photosensor before any action could be taken.

I was also thinking of having the servo motors protrude plants when the light is turned on to emulate plants growing. This concept I like more because I think it could be very feasible to set up and really make resemble plant growth. LEDs could also be a part of the plant growth.

March 20, 2008

State Machine: Garmin

Filed under: 8: State Machine,Assignments,Thomas Hendrickson — tphendrickson @ 12:27 pm

I did a state machine for my garmin, which is just a car GPS device thing.

March 6, 2008

Midterm – Interactive Indo Board

Filed under: 7: Mid-Term Project,Assignments,Thomas Hendrickson — tphendrickson @ 9:33 pm

For my midterm project I remained with my original idea of adding interactive elements to my indo board. I originally had thought that my additions would reflect how many times the board was tipped, but realized that it is much more challenging (and more of a workout) to focus on keeping the board as flat as possible.

I used 18 LEDs in 9 columns of 2, in three different colors. Each column is controlled by a digital output on the arduino. The outputs are based on the status of two separate rolling ball tilt switches that are attached to the indo board. Each tilt switch reads if the board is tilted a certain amount on either side. If kept completely horizontal, the tilt switches are activated at 30 degrees, so the switches must be altered a little (bent less horizontal) so that it is feasible to keep the board level long enough to light up the LEDs.

The switches each complete a circuit that act as inputs to the arduino, and the LEDs light up (green to yellow to red) based on how long the switches are NOT activated. When the switches are not activated, that implies that the indo board is balanced. Each LED column lights up a second after the last one has lit up. A ‘while’ statement in the code checks that both switches are not activated, a counter increments every half second however long the switches are not activated, and a series of ‘if’ statements light up the LEDs based on the counter value.


int runPin = 13;      //arduino LED light
int ledPin_1 = 12;    //LED pins
int ledPin_2 = 11;
int ledPin_3 = 10;
int ledPin_4 = 9;
int ledPin_5 = 8;
int ledPin_6 = 7;
int ledPin_7 = 6;
int ledPin_8 = 5;
int ledPin_9 = 4;
int switchPin_1 = 2;  //tilt switch inputs
int switchPin_2 = 3;
int switchStatus_1;
int switchStatus_2;
int counter;   

void setup()
{
  Serial.begin(9600);
  pinMode(ledPin_1, OUTPUT);
  pinMode(ledPin_2, OUTPUT);
  pinMode(ledPin_3, OUTPUT);
  pinMode(ledPin_4, OUTPUT);
  pinMode(runPin, OUTPUT);
  pinMode(switchPin_1, INPUT);
  pinMode(switchPin_2, INPUT);

}

void loop()
{
    counter = 0;

    digitalWrite(runPin, LOW);    //everything is turned off at the start of the loop
    digitalWrite(ledPin_1, LOW);
    digitalWrite(ledPin_2, LOW);
    digitalWrite(ledPin_3, LOW);
    digitalWrite(ledPin_4, LOW);
    digitalWrite(ledPin_5, LOW);
    digitalWrite(ledPin_6, LOW);
    digitalWrite(ledPin_7, LOW);
    digitalWrite(ledPin_8, LOW);
    digitalWrite(ledPin_9, LOW);

    switchStatus_1 = digitalRead(switchPin_1);
    switchStatus_2 = digitalRead(switchPin_2);

    while ((switchStatus_1 == LOW) && (switchStatus_2 == LOW))  //both switches are not activated for the LEDs to light up
    {
      digitalWrite(runPin, HIGH);      //checks that the while loop is working

      if (counter > 1)
      {
        digitalWrite(ledPin_1, HIGH);

        if (counter > 2)
        {
          digitalWrite(ledPin_2, HIGH);

          if (counter > 3)
          {
            digitalWrite(ledPin_3, HIGH);

            if (counter > 4)
            {
               digitalWrite(ledPin_4, HIGH);
            }

              if (counter > 5)
              {
               digitalWrite(ledPin_5, HIGH);
              }

                if (counter > 6)
                {
                 digitalWrite(ledPin_6, HIGH);
                }

                  if (counter > 7)
                  {
                   digitalWrite(ledPin_7, HIGH);
                  }

                    if (counter > 8)
                    {
                     digitalWrite(ledPin_8, HIGH);
                    }

                      if (counter > 9)
                      {
                       digitalWrite(ledPin_9, HIGH);
                      }
          }
        }
      }

        counter++;      //the counter increments
        switchStatus_1 = digitalRead(switchPin_1);
        switchStatus_2 = digitalRead(switchPin_2);

        delay(500);    //the while loop is delayed half a second before starting again

    }

}

After the circuits and code are completed, I cut about 4, 8 foot wires to keep the LEDs away from the indo board. The switches were placed on a smaller breadboard and duct taped down to the indo board, making sure the breadboard was level.Materials:

  • 11 1K Ohm resistors
  • 6 green LEDs
  • 6 yellow LEDs
  • 6 red LEDs
  • Jumper wire
  • 2 rolling ball tilt switches
  • Arduino

    February 27, 2008

    Midterm Project Proposal

    Filed under: Thomas Hendrickson — tphendrickson @ 10:33 pm

    I wanted to stick with my original idea of the interactive Indo Board, and think that I could make a functioning product soon using a gravity switch to read the state of the board. The gravity switch would be the input, reading on/off, and multiple LEDs would act as the outputs.

    A lot of the point when working out or training with the Indo Board is to try and keep it level for prolonged periods of time. The board is always tipped when it is not being used or the user is getting on, so the gravity switch would start out reading as “on.” When the switch is off, and the board is level, the multiple LEDs will light up sequentially by how long the board is level. This is achieved by a counter in the program, most likely with a while loop. The status of the switch would be checked before the counter was incremented, and each light would be light or made brighter based on the value of the counter. If the arduino runs this while hooked up with the computer, the program could print out to the user a reading of the longest time the board remained level.

    The schematic and state diagram are based on the assumption that I would be using something like 4 LEDs. The output for the LEDs would be analog to create a smooth transition as the lights become brighter and brighter.

    February 20, 2008

    Assignment 5, 6: Solar Power

    Filed under: 5: Making Motion,6: More Motion,Assignments,Thomas Hendrickson — tphendrickson @ 7:52 pm

    So after a ton of trying, troubleshooting, finding help from friends, I finally got a transistor connection to work and got two DC motors running together off of a code. One motor spins a sun and after it powers up the plants (a 6 second delay from a incremented counter), the flowers spin on the other motor.

    here is the code:

    
    int sunPin = 7;        //sun motor pin
    int flowerPin = 5;     //flower motor pin
    int ledPin = 13;       //led runs as a check
    int counter = 0;       //counts how long program has been running</code>
    
    void setup()
    {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);
    pinMode(sunPin, OUTPUT);
    pinMode(flowerPin, OUTPUT);
    
    }
    
    void loop()
    {
    
    digitalWrite(sunPin, HIGH);    //turns on sun immediately
    
    if (counter == 6)              //checks counter value
    {
    digitalWrite(flowerPin, HIGH);  //if counter high enough, turns on led and flower
    digitalWrite(ledPin, HIGH);
    }
    
    else
    {
    counter++;      //if not long enough, counter is incremented
    delay(1000);    //1 second delay
    }
    
    }

    February 4, 2008

    Switch Counter

    Filed under: 4: Counting Sensor Input,Assignments,Thomas Hendrickson — tphendrickson @ 6:25 pm

    So after a while of not getting my wiring/coding correct, I finally was able to put together a simple switch that increments a counter and flashes an LED everytime the switch is activated.

    The counter value is displayed everytime the switch is activated. This simple switch could be replaced with any other sensor, such as an impact sensor that counts how many people walk on a rug.

    
    int ledPin = 13;              //designates LED pin
    int switchPin = 4;            //designates probe pin
    int delayAmount = 700;
    int switchStatus = 0;         //starts the switch status at LOW
    int counter = 0;              //the counter is set at 0
    
    void setup()
    {
    Serial.begin(9600);
    pinMode(ledPin, OUTPUT);    //LED is the output
    pinMode(switchPin, INPUT);  //the switch feeds in the information
    }
    
    void loop()
    {
    
    switchStatus = digitalRead(switchPin);  //switch gets an initial value
    
    if (switchStatus == HIGH)    //this if statement checks to increment the counter
    {
    counter++;
    Serial.print("The circuit has been completed ");
    Serial.print(counter);
    Serial.println(" times.");
    
    }
    
    while (switchStatus == HIGH)  //this while loop keeps the LED blinking while switch is activated
    {
    
    digitalWrite(ledPin, HIGH);
    delay(delayAmount);
    digitalWrite(ledPin, LOW);
    delay(delayAmount);
    switchStatus = digitalRead(switchPin);   //the switch status is checked before flashing the LED again
    
    }
    
    }
    Next Page »

    Create a free website or blog at WordPress.com.