Showing posts with label itp. Show all posts
Showing posts with label itp. Show all posts

Sep 17, 2008

Phys Comm Observation Project

For our observation assignment, EJ & I found a T-shaped intersection at Broadway and Bond street at 11:30 on a Monday morning.  We wanted to see how people interacted with a ubiquitous urban technology--the street light.

The street light cycle followed this rough pattern:

Walking Man: 17 seconds (It's safe to cross the street)
Blinking Hand: 10 seconds (Take caution when crossing)
Red Hand: 1 minute (Do not cross)


During any given cycle, we would observe up to 7 people crossing Broadway, with the majority of them crossing during the Blinking or Red Hand stages. Crossing Bond, where pedestrians competed with less traffic, we saw up to 15 people cross during a given cycle.

Here's how the system is designed to work:
Pedestrian approaches intersection, looks up to read the signal, and if the white walking man is illuminated, cross the street. Otherwise he waits through the cycle until it is safe to cross.

Here's how it actually works:
Pedestrian approaches intersection. About forty percent look to the signal to see where they are in the cycle, but most look immediately to oncoming traffic to judge whether it's safe or not. Everyone looks at traffic at some point, either not trusting or not caring what the signal tells them to do.

Waiting patiently to cross.


GO!


Inevitably, some pedestrians misjudge the speed of oncoming traffic and put themselves in precarious situations. This was especially true when pedestrians were interacting with some other technology at the same time--cell phones, iPods, etc--and didn't pay enough attention to the signal or traffic.


The only person we witnessed actually obeying the signal was a woman with stroller. She waited patiently until it was both safe to cross and legal to cross before stepping into the street.


The information that the signal gives pedestrians is related to the red-yellow-green signals given to oncoming traffic. It doesn't take into consideration that automobile traffic routinely ignores those signals. When the system breaks down for people in cars, it breaks down for people on foot.

And since at this intersection drivers routinely ignore the signals, pedestrians have to gather their own information. They're becoming the sensor that the traffic light is missing. If the traffic light sensed the speed and presence of oncoming traffic and relayed that information into a walk/don't walk sign, the technology would work much better.

Sep 11, 2008

Help Make Mr. Piggy Smile


Here's my first bid of code in Processing, written for ICM. I'm having trouble with curves and arcs, so Mister Piggy is a pretty serious dude for now. Someday he will smile.

the pig: http://itp.nyu.edu/~jj891/ICM/week1/index.html

the code:
size(200,200);
background(0,0,255);
smooth();
rectMode(CENTER);
//piggy head
stroke(0);
fill(245,80,120);
ellipse(100,85,150,125);
//piggy nose
stroke(0);
fill(255,100,100);
ellipse(100,100,40,30);
//piggy nostrils
stroke(0);
fill(0);
ellipse(95,100,10,10);
ellipse(105,100,10,10);
//piggy eyes
stroke(0);
fill(255);
ellipse(70,70,30,20);
ellipse(130,70,30,20);
//piggy pupils
fill(0);
ellipse(70,75,7,7);
ellipse(130,75,7,7);
//piggy bow tie
fill(255,255,0);
stroke(0);
triangle(60,140,95,160,60,180);
triangle(140,140,105,160,140,180);
ellipse(100,160,20,15);
//piggy smile
//someday!

Sep 10, 2008

Phys Comp Lab 1

The first lab assignment can be found here.

Basically, I was asked to connect a digital input circuit and digital output circuit to a microcontroller. In this case, the digital input is a switch. The digital output: two LEDs. Closing the switch lights one LED, opening it lights the other. Here's an open switch:



The white wires are the switch. Touching them together gives you this:



Pretty simple. Super fun. The next part of the assignment was to get creative with the actual switch as well as the digital input, with the goal of making a combination lock.

I found two items on the ITP junk shelf that I decided to use as the basis for my switch. First was an LED connected to two pushpins:


The other was this cable, which likely has a name, and can generally be found connecting stuff on your motherboard or something green and circuity:



The wire allowed me to make a switch that was fancy looking, but actually really simple. I created five switches and wired them from the bottom of this white cable (after using a multimeter to make sure each end point did in fact connect somewhere on the opposite end) to the ground on my breadboard. I then soldered a pushpin to a wire and connected that to my power source. When I insert the pin in one end of the white cable, it closes that particular switch. So, in effect I'm using one roving power source for five different switches. This solves the problem of people closing two switches at the same time (the equivalent of pressing two buttons) and also looks cool.




Now I wanted to make a combination. That's all programming. I decided that if you closed switches 1, 4 and 5, in that order, a green light would turn on. After each of the first two correct guesses, a green light would brink to let you know you were on the right path. If you messed up a long the way, a red light would flicker. After a couple of seconds, the sequence would restart so you could try again.

I got super stuck until I copied some code from Zoe Fraade. And then I got super stuck until Craig Kapp helped me figure it out. He sat down next to me and generated most of this code, explaining point by point why the way I'd done things wasn't the most simple way to get from point a to point b. Thanks, Craig. I'll figure this stuff out eventually.

Pin in switch one (the green light flashes briefly).


Pin in switch four (the green light flashes briefly).


Pin in switch five (the green light stays on!).


I also wanted to include a red light if you put the pin in the wrong spot. Here, the red light goes off if you put the pin in the first switch after having put it in the first and fourth. More simply: if you think switch one is the final key instead of switch five:


One problem: I tried to figure out the code to make a red light flash if you put the pin into switch two or three at any time. But I couldn't figure it out before class. In the code below, nothing at all happens if you put the pin into switch two or three:
Pin in switch one, after being in switch four.


There are a couple of other problems as well. The reset mechanism is pretty untidy, for example. And there's no good way of telling the user how many switches are in the password. (That's not a problem I diagnosed myself; it came from class discussion of other projects).

Anyway, here's my code. I'll try to revisit it when I learn a little more about variables and loops and subroutines and other things that are, right now, totally over my head.

 

// declare variables:
int switchPin1 = 1; // digital input pin for switch 1
int switchPin2 = 2; // digital input pin for switch 1
int switchPin3 = 3; // digital input pin for switch 1
int switchPin4 = 4; // digital input pin for switch 1
int switchPin5 = 5; // digital input pin for switch 1

int greenLEDpin = 8; // digital output pin for an LED
int redLEDpin = 9; // digital output pin for an LED

int switchState1 = 0; // the state of the switch1
int switchState2 = 0;
int switchState3 = 0;
int switchState4 = 0;
int switchState5 = 0;

int myprogress = 0; //this counts the progress you've made in getting the right combo
int switchon = 1; //this is an idea that craig had, which he forgot to explain or incorporate later. ask him later.


int conditionsFilled = 0; //Keeps track of how many conditions so far have been filled

void setup() {
pinMode(switchPin1, INPUT); // set the switch pin to be an input
pinMode(switchPin2, INPUT); // set the switch pin to be an input
pinMode(switchPin3, INPUT); // set the switch pin to be an input
pinMode(switchPin4, INPUT); // set the switch pin to be an input
pinMode(switchPin5, INPUT); // set the switch pin to be an input

pinMode(greenLEDpin, OUTPUT); // set the yellow LED pin to be an output
pinMode(redLEDpin, OUTPUT); // set the red LED pin to be an output
}

void loop() {
// read the switch inputs:

switchState1=digitalRead(switchPin1); //Sets the inputs to variables that won't take so long to type
switchState2=digitalRead(switchPin2);
switchState3=digitalRead(switchPin3);
switchState4=digitalRead(switchPin4);
switchState5=digitalRead(switchPin5);

//beginning mode



// condition 1
if (switchState1 == 1 && myprogress == 0) //if first switch is on, and nothing else has happened...
{
myprogress = 1; //switch myprogress to one
digitalWrite(greenLEDpin, 1); //blink the green light
delay(1000);
digitalWrite(greenLEDpin, 0);
}
else if (switchState1 == 1 && myprogress != 0) //if switch 1 is on but you've already started down the path
{
myprogress = 0;
digitalWrite (redLEDpin, 1);
delay (1000);
digitalWrite (redLEDpin, 0);
}

// condition 2
if (switchState4 == 1 && myprogress == 1)
{
myprogress = 2;
digitalWrite(greenLEDpin, 1);
delay(1000);
digitalWrite(greenLEDpin, 0);
}
else if (switchState4 == 1 && myprogress != 1)
{
myprogress = 0;
digitalWrite (redLEDpin, 1);
delay (1000);
digitalWrite (redLEDpin, 0);
}

// condition 3
if (switchState5 == 1 && myprogress == 2)
{
myprogress = 3;
digitalWrite(greenLEDpin, 1);
delay(1000);
digitalWrite(greenLEDpin, 0);
digitalWrite(redLEDpin, 0);
}
else if (switchState5 == 1 && myprogress != 2)
{
myprogress = 0;
digitalWrite (redLEDpin, 1);
delay (1000);
digitalWrite (redLEDpin, 0);
}
// goal!
if (myprogress == 3)
{
digitalWrite(greenLEDpin, 1);
delay (5000);
digitalWrite(greenLEDpin, 0);
myprogress = 0;
}

// else {
// digitalWrite(redLEDpin, 1);
// delay(100);
//digitalWrite(redLEDpin, 0);
//delay(100);
//digitalWrite(redLEDpin, 1);


// myprogress == 0;


// }


/*
if (switchState2 == 1 || switchState3 == 1)
{
conditionsFilled = 0; //These aren't part of the password, so they're always wrong. Try again, McGyver.

digitalWrite (redLEDpin, 1); //just so they feel really bad about it
delay (200);
digitalWrite (redLEDpin, 0);
delay (200);
digitalWrite (redLEDpin, 1);
delay (200);
digitalWrite (redLEDpin, 0);
delay (200);
digitalWrite (redLEDpin, 1); //so the red light stays on.
}

*/

}