Archive for February, 2009

Emily, Lina, and Gordie do a P Comp Mid-term Project (Part 1-Observation and Proposal)

Wednesday, February 25th, 2009

Here is the PowerPoint presentation Emily Ryan, Lina Giraldo, and I did for our proposed mid-term project for Introduction to Physical Computing. In short, we propose to create an interface, either using foot pedals or a sensor foot map, that will replace some of the functions of the mouse and the keyboard to alleviate repetitive stress injuries such as carpal tunnel syndrome.

All this good…and dancing too!

Emily and Gordie Examine Serial Communication with Processing

Tuesday, February 24th, 2009

This week, Emily and I braved the strange new world of Processing.   But first, we tackled the initial stage of the assignment, which was recreating the earlier lab in which we programmed the arduino to receive input from a potentiometer that was connected to it.   The result was a series of crazy symbols, which can been seen here:

Here is the code:

int analogPin = 0;
int analogValue = 0;

void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
}

void loop()
{
  // read analog input, divide by 4 to make the range 0-255:
  analogValue = analogRead(analogPin);
  analogValue = analogValue / 4;
  Serial.print(analogValue, BYTE);
  // pause for 10 milliseconds:
  delay(10);
}

Here is Emily, getting similar wackness from her pot:

Here are our first attempts at using processing to graph serial communication with the potentiometer:

There’s kind of a Cloverfield moment towards the end of the video, but it still delivers all the action any fan of graphing serial communication with Processing could want!

Here’s the code, with appropriate props given to the great Tom Igoe:

/*
Sensor Graphing Sketch

 This sketch takes raw bytes from the serial port at 9600 baud and graphs them.

 Created 20 April 2005
 Updated 5 August 2008
 by Tom Igoe
 */

import processing.serial.*;

Serial myPort;        // The serial port
int graphXPos = 1;    // the horizontal position of the graph:  

void setup () {
  size(400, 300);        // window size

  // List all the available serial ports
  println(Serial.list());
  // I know that the fisrt port in the serial list on my mac
  // is usually my Arduino module, so I open Serial.list()[0].
  // Open whatever port is the one you're using.
  myPort = new Serial(this, Serial.list()[0], 9600);

  // set inital background:
  background(48,31,65);
}
void draw () {
  // nothing happens in draw.  It all happens in SerialEvent()
}

void serialEvent (Serial myPort) {
  // get the byte:
  int inByte = myPort.read();
    // print it:
  println(inByte);
  // set the drawing color. Pick a pretty color:
  stroke(123,128,158);
  // draw the line:
  line(graphXPos, height, graphXPos, height - inByte);

  // at the edge of the screen, go back to the beginning:
  if (graphXPos >= width) {
    graphXPos = 0;
    // clear the screen:
    background(48,31,65);
  }
  else {
    // increment the horizontal position for the next reading:
    graphXPos++;
  }
}

The only modifications we made to the program were in the choices of our colors. Emily went with a pink and lime green color scheme for her graph, while I chose red and blue as a tribute to dear old Penn (and the Red Sox).

So we each have now dipped our toes in the ocean that is Processing, but I guess we won’t find out if we’ll sink or swim in it until we take ICM next fall.

I can’t speak for Emily, but I’m planning on this guy serving as my lifeguard:

shiffman

Emily and Gordie make Music with Ardy

Wednesday, February 18th, 2009

So this week Emily and I worked on getting the arduino to activate a servo motor using an analog input device. We chose a flex sensor, since we had purchased them for an earlier project we did together.

Here’s a video of me making like the late, great Jam Master Jay (of RunDMC…shame on you if you didn’t know that!) “scratching” the servo:

Emily had a rougher time at first. Apparently, her servo had had too much coffee that morning and was experiencing the shakes:

It turned out there was a minor problem with the wiring that the always helpful Todd Holoubek, who was passing through the lab, helped us straighten out. (Thanks Todd!)

Afterwards, we hooked up an 8 ohm speaker to the arduino unit and programmed it to play a melody. The moment the unit started putting out its music was truly sweet!

We tried the other melody program, but that resulted in only some odd tones. Emily looked up the key progressions for “Twinkle, Twinkle, Little Star”, and we tried to program the arduino to play it, but what came out went more like, “bwaaaaaaaaaaaaaaaaaaaaaaaaaaah, bwaaaaaaaaaaaaaaaaaaaaaaah, bwaaaaaaaaaaaaaaaaaaaaaaaah, bwaaaaaaaaaaaaaaaaaaaaaaah.”
(Not much of a tune, but probably a pretty good foghorn signal.)

So we still have a ways to go in mastering the use of the arduino as a musical device. Perhaps that could be our mid-term project!

Emily and Gordie have a blistering time with Electricity

Wednesday, February 11th, 2009

I worked on this week’s P Comp assignment with Emily, and we learned that electricity can be dangerous if you aren’t careful with it. Apparently I messed up the placement of my power regulator on my breadboard, and as a consequence, soon after I connected the 12 V power supply to the board, I smelled something burning. I disconnected the power supply and then instinctively grabbed the power regulator, since it was still melting my breadboard. YeeeeOOOOOOOUCH! The tip of my right index finger was scorched like a piece of overcooked bacon.

Here we are measuring the voltage on a LED:

Here we are measuring the voltage with the LED connected to a potentiometer:



Here we are testing voltage in a series:



I guess I learned the lesson that Frankenstein’s Monster left for us all: “FIRE BAD! FIRE BURNS!”

Cynthia and Gordie play with Legos

Thursday, February 5th, 2009

Here is the video of the conveyor belt that Cynthia Hilmoe and I built with Legos for Mechanisms and Things that Move. We had a problem implementing the MinCD suggestion by the cartoon character in the instruction booklet, but that may be due to the fact that we had to use smaller rubber bands than the kit recommended because the recommended rubber bands were too stretched out due to wear to work. The instructions suggest replacing the wheel on the drive shaft of the mechanism with a smaller stud. After doing this, we were able to still use the crank to operate the conveyor belt, but it took a great deal more effort.

Emily, Lina, and Gordie Make a Love Machine

Wednesday, February 4th, 2009

This past week I worked with Emily and Lina on the lab assignments as well as the observation assignment. Here is the video of my triumphal moment in which I used a potentiometer as a dimmer switch for a LED:

Note my props to Emily and Lina for their help in soldering the pot. We decided to each do a connection on the pot so we all could gain experience in the valuable (and fun!) practice of using a soldering iron.

Here’s the code for this lab:

int potPin = 0; // Analog input pin that the potentiometer is attached to
int potValue = 0; // value read from the pot
int led = 9; // PWM pin that the LED is on. n.b. PWM 0 is on digital pin 9

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
potValue = analogRead(potPin); // read the pot value
analogWrite(led, potValue/4); // PWM the LED with the pot value (divided by 4 to fit in a byte)
Serial.println(potValue); // print the pot value back to the debugger pane
delay(10); // wait 10 milliseconds before the next loop
}

Next the three of us worked on making a Love-O-Meter. We decided to arrange a series of three sets of four LEDs in parallel and code them to respond to pressure put on a FSR by a pair of plastic lips set into a foamboard. The way the machine works is that someone kisses the lips, and the sensor would record the amount of force applied to the lips by the kisser, and then rate them either “Smooth” (the softest level, indicated by the green LEDs), “Hot Stuff” (the middle level, indicated by lighting both the green and the yellow LEDs) or a deliverer of “Total Ecstasy” (the top level, indicated by lighting the green, yellow, and red sets of LEDs).

Here’s the code:

int potPin = 0; // Analog input pin that the potentiometer is attached to
int potValue = 0; // value read from the pot
int Greenled = 9; // PWM pin that the GreenLED is on. n.b. PWM 0 is on digital pin 9
int Yellowled = 10; // PWM pin that the YellowLED is on.
int Redled = 11; // PWM pin that the redLED is on.

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
pinMode(Greenled,OUTPUT);
pinMode(Yellowled,OUTPUT);
pinMode(Redled,OUTPUT);
}

void loop() {
potValue = analogRead(potPin); // read the pot value
Serial.println(potValue);

if(100 <= potValue && potValue < 441)
{
digitalWrite(Greenled,HIGH); //turn on the Green LEDs
digitalWrite(Yellowled,LOW); // turn off the Yellow LEDs
digitalWrite(Redled,LOW); // turn off the Red LEDs
}
else if(441 <= potValue && potValue < 782)
{
digitalWrite(Greenled,HIGH); // turn on the Green LEDs
digitalWrite(Yellowled,HIGH); // turn on the Yellow LEDs
digitalWrite(Redled,LOW); // turn off the Red LEDs
}
else if(potValue >= 782)
{
digitalWrite(Greenled,HIGH); // turn n the Green LEDs
digitalWrite(Yellowled,HIGH); // turn on the Yellow LEDs
digitalWrite(Redled,HIGH); // turn on the Red LEDs
}
else
{
digitalWrite(Greenled,LOW); // turn off the Green LEDs
digitalWrite(Yellowled,LOW); // turn off the Yellow LEDs
digitalWrite(Redled,LOW); // turn off the Red LEDs
}

}

Here is a test of the connection, before we put the machine together:

And here’s the machine in action, with Lina showing just how hot a kisser she is:

Muy caliente!

Emily, Lina, and Gordie go to the Super Bowl and Observe Technology in Action

Wednesday, February 4th, 2009

I worked on this week’s P Comp’s assignments with Lina Giraldo and Emily Ryan. The first thing we tackled (pun intended) was the observation assignment, for which we decided to go to a bar and observe people using technology as they watched the Super Bowl. We went to Down the Hatch where we found a nice sized crowd enjoying the evening’s big event. We were joined by Lina’s husband Andres, whom I found to be every bit as gracious and wonderful as she is.

After the Cardinals scored a TD, here I am introducing Andres to a different form of “digital” communication: The High Five.

HighFive

To be honest, I was mostly focused on the game–(I was pretty much the only football fan in the group)–but we did observe quite a bit of technology being used by people throughout our time there.
The most frequently used piece of technology was the cell phone. Whether texting or calling, people had their cell phones out practically every moment there was a slow moment in the game. It’s likely they were contacting others not at the event to share some observation about the game or the scene they were at, but I also imagine that they were texting to communicate with those in their company when the noise in the bar got too loud to permit a normal conversation, or when they wanted to share a thoughts they would have been embarrassed to shout out in a public place. (Maybe like, “Who are these weird people watching us while we send text messages to each other?”)
texting

Older forms of technology were on display, such as the calculator, seen here being used to figure out the day receipts:
calculator

And of course, the beer tap, without which we would have been surrounded by a lot fewer people in that establishment.
BarTap

And finally, the center of attention (well, after the beer tap, that is), the television, one of the several in the bar, all set to the day’s Big Game:

I’m not exactly sure what I was supposed to learn from the exercise, but I did learn that Andres is every bit as awesome as Lina; Lina, Andres, and Emily are great people to hang out with and watch a Super Bowl; Down the Hatch is a fine establishment with good drink specials, excellent fries and incredibly delicious deep-fried macaroni and cheese nuggets (served with an amazing Atomic Sauce!); drinking Sam Adams Cherry Wheat Beer is the taste equivalent of drinking a regular Sam Adams while sucking on a cherry Lifesaver; and the Cardinals have a terrible pass defense…

..oh yes, and no matter where one goes in this big city of ours, technology is in use all around us…
as well as anywhere in this country.

Emily found this graph of the most used words in Twitter “tweets” during the Super Bowl.

I have to say I’m not a Twitterer, but I still found this graph interesting. The Super Bowl has survived as the one uniting television cultural touchstone left in our society since cable, Tivo, and the internet carved up the national audience and unyoked them from the broadcast schedules of the major networks. Following this interactive map is like retroactively eavesdropping on the national conversation during a time in which the vast majority of us were all doing the same thing–which is something that rarely happens in this day and age.

And can you believe that catch and run Larry Fitzgerald made to give the Cardinals the late lead?

Or the leaping one that Santonio Holmes made to give the Steelers the game?

From the sizes of their names on this graph at the times they each made their respective game-changing plays, I was clearly not alone in my amazement at their efforts.