Making Things Interactive

April 29, 2008

Course Feedback Assignment

Filed under: Assignments,Final Writing Assignment,Lingshui Wang — lingshui @ 5:07 pm

Personally I feel as if the class was very well taught and I learned a lot. Having come into this experience with no prior experience and ending the class being able to build and understand projects of the magnitude that we did was very exciting. I never could’ve guessed that I would have achieved this with just a semester.

Some things to make better…well I feel as if we never really go around to the “after class helpsessions” on Thursday. I mean, yes some people did stay after class for a few minutes sometimes to get some help, but we really never had an official worksession at which we were given the opportunity to explain our projects and receive help on a one on one basis. That might be partly our fault because we never really pushed hard for the helpsession and not many of us ever really brought in our projects that we needed help on. I did enjoy having the option of visiting Mark in the CoDe lab though, that was definitely helpful working in that environment. I feel maybe if official helpsessions are incorporated, they should be held there instead of in that classroom because of the various resources available in the CoDe lab.

This is definitely helpful in my future work, already I’ve incorporated things I’ve learned in MTI to my final presentation for my final project this semester. Aside from making models, I have achieved a better understanding of how to make spaces more interactive and therefore (in my opinion) a lot more dynamic and experiential.

April 18, 2008

Interactive Hovercraft

Filed under: Assignments,Final Project,Lingshui Wang — lingshui @ 11:13 am

Currently I have a working hovercraft which can hold the weight of an arduino, power pack, and various inputs and outputs. I am looking to improve this to hold more weight (a.k.a. strip down the weight of the hovercraft). I am having a bit of a problem with the interactive bit of it but should have it up and running very soon. Still hopeful about creating movement with the hovercraft, but right now it seems I’ll have to settle for something simpler.

Schematic

Code coming as soon as I fix it

March 27, 2008

State Machine with LEDs and buzzers

Filed under: 8: State Machine,Assignments,Lingshui Wang — lingshui @ 12:31 am

So I made a state machine consisting of 4 LEDs and a buzzer. There are 4 active states, sOff (self-explanatory), sAttract(flash lights quickly to attract passerby to it), sFirst(the first script it will run – which in this case consists of pulsing 4 lights), and sSecond(the second script – composed of pulsing 4 lights and buzzing a buzzer, this state is only activated once state one has been triggered 4 times previously).

Board Layout Picture 1
Board Layout Picture 2
Schematic

Here’s the code:

note: the compiler keeps telling me that “attractScript” was not declared, even though I clearly have it defined underneath void loop as “void attractScript”, what am I doing wrong?


const int sOff = 0;                                                    //set the case states...
const int sAttract = 1;
const int sFirst = 2;
const int sSecond = 3;

int currentState = sOff;                                               //set currentState and nextState
int nextState = sAttract;
int powerPin = 4;                                                      //on and off switch
int rangeFinder = 0;                                                   //sensor to change states
int ledA = 11;                                                         //LEDs
int ledB = 10;
int ledC = 9;
int ledD = 6;
int buzzer = 12;                                                       //buzzer
int firstCount = 0;                                                    //setup counting variables
int secondCount = 0;

void setup()
{
  pinMode(powerPin, INPUT);                                            //setting rangefinder, power pin, LEDs and buzzer
  pinMode(rangeFinder, INPUT);
  pinMode(ledA, OUTPUT);
  pinMode(ledB, OUTPUT);
  pinMode(ledC, OUTPUT);
  pinMode(ledD, OUTPUT);
  pinMode(buzzer, OUTPUT);
  Serial.begin(9600);                                                  //begin serial library at 9600 baud
}

void loop()
{
  switch(currentState)                                                 //start state machine
    {
      case sOff:                                                       //state "off"
      Serial.println("off");
      firstCount = 0;                                                  //reset counters for both state 1 and state 2
      secondCount = 0;
      if (digitalRead(powerPin) == HIGH)                               //when power pin is on....
      {
        currentState = nextState;                                      //proceed away from sOff and onto sAttract
      }
      break;
      case sAttract:                                                   //state "attract"
      Serial.println("attract");
      if (digitalRead(powerPin) == LOW)                                //if power pin is off...
      {
        currentState = sOff;                                           //turn off state machine
        nextState = sAttract;
      }
      else if (analogRead(rangeFinder) <= 50)                          //however if someone activates the machine...
      {
        currentState = sFirst;                                         //proceed to first state
      }
      else
      {
        attractScript();                                               //otherwise continue attracting passerby
      }
      break;
      case sFirst:                                                     //state "primary"
      Serial.println("first");
      if (digitalRead(powerPin) == LOW)                                //check power is on
      {
        currentState = sOff;
        nextState = sAttract;
      }
      else if ((firstCount == 4) && (analogRead(rangeFinder) <= 50))   //if state "primary" activated 4 times previously
      {
        currentState = sSecond;                                        //proceed onto state "secondary"
      }
      else if ((firstCount < 4) && (analogRead(rangeFinder) <= 50))    //if state "primary" activated less than 4 times
      {
        PulseLed(ledA);                                                //proceed with state "primary" scripts
        PulseLed(ledB);
        PulseLed(ledC);
        PulseLed(ledD);
        firstCount ++;						                           //count times state "primary" has been triggered
        secondCount = 0;					                           //reset state "secondary" count
      }
      else							                                   //if passerby leaves before state "secondary"
      {
        currentState = sAttract;                                       //return to state sAttract
      }
      break;
      case sSecond:                                                    //state "secondary"
      Serial.println("second");                                        //check if power is on
      if (digitalRead(powerPin) == LOW)
      {
        currentState = sOff;
        nextState = sAttract;
      }
      else if ((secondCount == 1) && (analogRead(rangeFinder) <= 50))  //if state "secondary" has been activated
      {
        currentState = sFirst;                                         //proceed back to state "primary"
      }
      else if ((secondCount < 1) && (analogRead(rangeFinder) <= 50))   //if state "secondary" hasnt' been activated
      {
        PulseLed(ledA);                                                //proceed onto secondary script
        PulseLed(ledB);
        PulseLed(ledC);
        PulseLed(ledD);
        buzzerScript();
        secondCount ++;						                           //start "secondary" count
        firstCount = 0;						                           //reset "primary" count
      }
      else
      {
        currentState = sAttract;                                       //if passerby leaves, go back to sAttract
      }
      break;
      default:                                                         //if default state is activated, then error
      Serial.println("ERROR: default state");
      currentState = sOff;
      nextState = sAttract;
      break;
   }
)
void PulseLed(int pin)                                                 //set pattern for pulsing LEDs
{
  for (int i=0; i<=255; i++)
  {
    analogWrite(pin, i);
    delay(4);
  }
  for (int i=255; i>=0; i--)
  {
    analogWrite(pin, i);
    delay(4);
  }
}

void attractScript()                                                   //set light pattern for state "attract"
{
  digitalWrite(ledA, HIGH);
  delay(500);
  digitalWrite(ledA, LOW);
  digitalWrite(ledB, HIGH);
  delay(500);
  digitalWrite(ledB, LOW);
  digitalWrite(ledC, HIGH);
  delay(500);
  digitalWrite(ledC, LOW);
  digitalWrite(ledD, HIGH);
  delay(500);
  digitalWrite(ledD, LOW);
}

void buzzerScript()                                                    //set script for how buzzer works
{
  digitalWrite(buzzer, HIGH);
  delay(2000);
  digitalWrite(buzzer, LOW);
  delay(500);
}

March 25, 2008

Final Project Proposal

Filed under: Lingshui Wang — lingshui @ 7:14 pm

Concept: A hovercraft works by concentrating a pocket of air underneath it and trapping it with a “skirt” of some kind so that air pressure builds up underneath the hovercraft, which allows it to float over a ground surface. In this project I am proposing to create a miniature hovercraft using pc fans and lightweight casing material. Hopefully (if I am able to get the hovercraft to lift off…), I can then steer the hovercraft depending on outside influences.

Parts List:

  1. 4 (or 8 – additional fans for steering) pc cooling fans
  2. lightweight casing material
  3. 24 volt power supply (.5 amps?)
  4. Garbage bags (for the skirt)

Technical Concept: There are a few projects online which have done similar things, with varying results, it seems about 50/50 when people either get it to work or it doesn’t lift off the ground at all. Additionally, pc cooling fans usually run at 12V, boosting the voltage up to 24V should increase RPMs and therefore increase the rate of air movement (thus resulting in -hopefully- enough air pressure to create lift). If lift is achieved, then proximity sensors (ultrasonic, photovoltaic, infrared) could be used to steer hovecrafts around obstacles and preserve hovercraft stability and orientation on slanted surfaces by altering fan power. The arduino compiler should be able to fulfill all programming needs that I have for this project.

Documentation / References:

State Diagram

March 19, 2008

State Machines

Filed under: 8: State Machine,Assignments,Lingshui Wang — lingshui @ 10:56 pm

So in conjunction with my project idea, here’s the state machine that could be used for that project. The visual should be easy enough once I get to know how to use the multiplexers, but the audio might take a bit longer to understand what parts to use and how to operate those parts using the arduino (if an audio component is at all even possible with this project).

March 6, 2008

Midterm – Light Piano

Filed under: 7: Mid-Term Project,Lingshui Wang — lingshui @ 2:09 pm

So, I built a prototype for this out of some chipboard, wires, LEDs, and 3 potentiometers. I was working with dimming and lighting the LEDs in arrays depending on the state of the potentiometer. Right now, as I am new to working with brightness etc (and my analog pins don’t seem to want to transmit voltage to the LEDs for some strange reason…), the potentiometers are basically still acting as simple switches, with the dimming and lighting on LEDs on a timed script depending on the buttonstate of the potentiometer. Here’s the source code, I’m currently working on a new one to see if I can get the lights to match up with the potentiometer values.

int left1 = 3; //setting LED and potentiometer pins
int left2 = 5;
int leftSense = 0;
int right1 = 6;
int right2 = 9;
int rightSense = 1;
int bot1 = 10;
int bot2 = 11;
int botSense = 2;
int brightness = 0; //setting brightness values
int brightness1 = 0;
int brightness2 = 0;
int brightness3 = 0;
int brightness4 = 0;
int brightness5 = 0;
int val; //setting potentiometer values
int val2;
int val3;

void setup()
{
Serial.begin (9600); //serial library for troubleshooting
pinMode(left1, OUTPUT); //setting inputs and outputs
pinMode(left2, OUTPUT);
pinMode(leftSense, INPUT);
pinMode(right1, OUTPUT);
pinMode(right2, OUTPUT);
pinMode(rightSense, INPUT);
pinMode(bot1, OUTPUT);
pinMode(bot2, OUTPUT);
pinMode(botSense, INPUT);
}

void loop()
{
val = analogRead(leftSense); //define “val”
val2 = analogRead(rightSense);
val3 = analogRead(botSense);
Serial.println (val); //print values for troubleshooting
Serial.println (val2);
Serial.println (val3);
if (val >= 500) //switch value over one half…
{
if (brightness < 255) //if brightness of array 1 is not maxed... { brightness ++; //increase brightness for array 1 brightness1 --; //decrease brightness for array 2 analogWrite(left1, brightness); analogWrite(left2, brightness1); delay(5); } else if (brightness == 255) //however, if brightness of array 1 is maxed... { analogWrite(left1, 255); //stay constant at array 1 on, array 2 off analogWrite(left2, 0); brightness1 = 0; //reset brightness values so if switch is turned back, smooth transition } } else if (val < 500) //however, if switch value below one half... { if (brightness1 < 255) //brightness of array 2 not maxed... { brightness --; //array 1 dim brightness1 ++; //array 2 light analogWrite(left1, brightness); analogWrite(left2, brightness1); delay(5);} else if (brightness1 == 255) //however, if brightness of array 2 is maxed... { analogWrite(left1, 0); //stay constant at array 1 off, array 2 on analogWrite(left2, 255); brightness = 0; //set value back to 0 to provide smooth transition } } if (val2 >= 500) //rinse and repeat for other sides…
{
if (brightness2 < 255) { brightness2 ++; brightness3 --; analogWrite(right1, brightness2); analogWrite(right2, brightness3); delay(5); } else if (brightness2 == 255) { analogWrite(right1, 255); analogWrite(right2, 0); brightness3 = 0; } } else if (val2 < 500) { if (brightness3 < 255) { brightness2 --; brightness3 ++; analogWrite(right1, brightness2); analogWrite(right2, brightness3); delay(5);} else if (brightness3 == 255) { analogWrite(right1, 0); analogWrite(right2, 255); brightness2 = 0; } } if (val3 >= 500)
{
if (brightness4 < 255) { brightness4 ++; brightness5 --; analogWrite(bot1, brightness4); analogWrite(bot2, brightness5); delay(5); } else if (brightness4 == 255) { analogWrite(bot1, 255); analogWrite(bot2, 0); brightness5 = 0; } } else if (val3 < 500) { if (brightness5 < 255) { brightness4 --; brightness5 ++; analogWrite(bot1, brightness4); analogWrite(bot2, brightness5); delay(5);} else if (brightness5 == 255) { analogWrite(bot1, 0); analogWrite(bot2, 255); brightness4 = 0; } } }[/sourcecode] Schematic:

parts list:

27 LEDs

3 potetiometers / distance sensors

wire + solder

casing

February 28, 2008

Mid Term Project Proposal

Filed under: Assignments,Lingshui Wang — lingshui @ 1:21 am

My project is a multi-surface “air piano”. This project will read the x, y, and z coordinates (simultaneously) of an object within the local coordinates of a pre-determined “trigger zone” and then light up, fade, and intensify attached LEDs accordingly. These LEDs will run on a predetermined program (most probably a tracking program where the LEDs closest to the object will intensify and the farther ones will dim). I was also thinking of running a background script in the LEDs where there would be a few random “anomalies” running through the LED pattern with undefinable links to the object in the “trigger zone”. In essence, I’m looking to create a night sky like feel with the LEDs.

Here’s a simple picture documenting how it might work (the black circles are sensors – either IR or ultrasonic- the colored dots are LEDs, the panels would ideally be made out of plexiglass or some other translucent material for the final – but for now it’s going to have to be cardboard, chipboard, or some other readily available material):

Diagram Here

So here’s a rough schematic for one wall (since all 3 walls would be technically similar or identical). I’ve yet to figure out how to use a row-column scanner for the LEDs, so I feel like for this midterm I’ll just hook them up individually or the arduino, or try to learn processing in order to recreate a similar effect on my laptop screen:

Schematic Here

A simple sketch outline for the programming would be as follows:

-Link sensor to analog in, leds to analog out -Set sensors to read different x, y, and z coordinates (ex. x sensor reads close, y sensor reads far, z sensor reads close) -Light up LEDs according to what the x,y,z coordinate readings are (ex. light up lights 3,4,5 which are close to the x and z sensors but far from the y sensor) -Dim surrounding lights which may not be in direct area of effect (ex. light up lights 2 and 6 at half power since they’re surrounding lights 3,4,5) -Turn off lights which are far from area of effect (ex. turn off lights 1 and 7 since they’re far from area of effect). -Twinkle the LEDs all “randomly” based on a time script no matter whether they are on or off (thus if they’re on, then they twinkle, but if not then the “area of effect” script overrules the “twinkle” script and the LEDs stay off).

Something similar I found…but not the same as what I’m thinking:
Youtube
Another Youtube

February 26, 2008

Interesting site

Filed under: Course Materials,Lingshui Wang,References — lingshui @ 2:32 pm

Hey guys, I was looking around one day for inspiration on a midterm / final idea when i came across this site called “makezine”.  I’m not sure if someone already linked to this site, but anyways, it’s got some really interesting stuff, not all of it’s arduino related but most of it includes a micro-controller.  Google brought me to page 33 of the blog, but you can start at page one:

Here’s the site, check it out if you need some inspiration.

http://blog.makezine.com/archive/diy_projects/33.html

Solenoid working! Yay!

Filed under: 6: More Motion,Assignments,Lingshui Wang — lingshui @ 12:34 am

Finally got a solenoid working, used a TIP 3055 transistor. linked it up with a 3V buzzer to be both activated by a rangefinder on a 2 second loop script. Here’s a schematic, a script, and a video:

int buzzer = 13;                    //buzzer set to digital 13
int rangeFinder = 0;                //rangefinder set to analog 0
int solenoid = 8;                   //solenoid set to digital 8
int val;

void setup ()
{
  Serial.begin (9600);              //serial library set up for troubleshooting
  pinMode (buzzer, OUTPUT);         //buzzer set to output
  pinMode (rangeFinder, INPUT);     //rangefinder set to input
  pinMode (solenoid, OUTPUT);       //solenoid set to output
}

void loop ()
{
  val = analogRead (rangeFinder);   //set definition for "val"
  Serial.print("switch input: ");
  Serial.println(val);
    if (val  50)                    //if object is far...
    {
	digitalWrite(buzzer, LOW);   //do nothing
    	digitalWrite(solenoid, LOW);
    }
}

February 18, 2008

Work with solenoids

Filed under: 6: More Motion,Assignments,Lingshui Wang — lingshui @ 11:57 pm

So, 2 other classmates and I (with the help of an ece friend) took a look at the solenoids to try to get them to work. 3 hours and one blown transistor later, we discovered that the circuit was somehow trying to send current back through the base of the transistor into the arduino instead of through the collector to ground (using a PNP transistor) and the arduino wasn’t letting current back through the pin, thus not enough power was going through the circuit to power a solenoid, but enough was going through to power a LED. We discovered this by isolating the arduino and taking it out of the circuit, hence the blown transistor (the solenoid DID run for a rotation, but then blew the transistor). Anyways, if anyone has had any luck with the solenoid, please tell us!Here’s a few schematic diagrams:

These were tested using a simple time delay program seen here:

void setup ()
{pinMode (8, OUTPUT);    //solenoid connected to digital 8
}

void loop ()
{digitalWrite (8, HIGH);    //turn on
delay (1000);               //wait 1 sec
digitalWrite (8, LOW);      //turn off
delay(1000);                //wait 1 sec
}
}

So this is what I attempted to do earlier in the night, combining a rangefinder I had with a solenoid, using the schematic provided to me for the solenoid and using the rangefinder in a separate circuit (the rangefinder was giving accurate readings):

int rangeFinder = 0;    //rangefinder connected to analog 0
int sole = 3;           //solenoid connected to digital 3
int val;
int val2;
int buttonState;
int soleMode = 0;

void setup()
  {
    Serial.begin(9600);
    pinMode(rangeFinder, INPUT);            //rangefinder input
    pinMode(sole, OUTPUT);                  //solenoid output
    buttonState = analogRead(rangeFinder);
  }

void loop(){
  val = analogRead(rangeFinder);
  delay(10);
  val2 = analogRead(rangeFinder);
  Serial.print("Read switch input: ");
  Serial.println(analogRead(rangeFinder));
  if (val == val2) {                        //is the rangefinder getting an accurate reading?
  if (val < 50) {                           //if rangefinder senses somethign close
    digitalWrite(sole, HIGH);               //run solenoid
    delay(250);
    digitalWrite(sole, LOW);
    delay(250);
  }
  else if ((val == 50) && (val > 50))       //if nothing's close
  {
    digitalWrite(sole, LOW);                //solenoid remains off
  }}}
Next Page »

Create a free website or blog at WordPress.com.