Tuesday, February 24, 2009

Week 5-Processing is cool!

This week, Gordie and I braved the strange new world of Processing. Before getting any visuals, 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 "garbage data" 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 are our first attempts at using processing to graph serial communication with the potentiometer:

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. I went with a pink and lime green color scheme for her graph as a tribute to my old job, PartyCat, while Gordie the Red Sox Fan chose red and blue as a tribute.

Wednesday, February 18, 2009

Week 4 Programming a Servo & Getting my Wires Crossed

This week we learned how to program a MicroController
So this week Gordie 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.
Here Gordie working the MicroController



My servo had a little bit of the shakes due to some shady wiring on my part, here's I am testing my microcontroller seems a little nervous



Thankfully Todd helped me sort out my breadboard (I was shorting out my board due to the incorrect wires) and lived to tell the tale. Here's my servo being much more relaxed


Video thumbnail. Click to play
Click To Play

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 super cool.


We tried the other melody program, but that resulted in only some odd tones. I 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, Radiohead's "Idioteque" which was cool but not exactly what we had in mind.
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!

Sunday, February 8, 2009

Week 3 Learning About Electricity : IE How to burn up LEDS and melt a breadboard

This week we learned about Voltage and how to measure the voltage of the components on the breadboard. Here I am measuring the voltage, make sure and remember red to red and black to black, just like when you're jumping a car battery! Here's Gordie checking out his 12 volt power supply

Next we made a basic LED circuit by adding a switch and some LEDs into the mix. Here's my HOT LED circuit


Then Gordie really made it hot by almost blowing up an LED, check out his smoking breadboard! Sadly Gordie did permanently disfigure himself using the 12 Volt power supply for too long so we switched it to a lower 9 Volt supply


Next we turned the lights up and down with the Potentiometer.
As you turn the potentiometer from one end to the other, measure the voltage at the center position. The pot is acting as a voltage divider, dividing the 5V into two parts. As the voltage feeding the LED goes up or down, the LED gets brighter or dimmer. No code here, just great videos.

Wednesday, February 4, 2009

Week 2 Making a LOVE-O-METER

This week Lina, Gordie & I made a Love-O-Meter in addition to our Super Bowl Observation assignment. It's a continuation of the love-fest we started with Valentine Rat. Here's a video of Me using a P.O.T to dim the LEDS. It was fun!

Video thumbnail. Click to play
Click To Play

I also got a chance to sharpen my soldering iron skills to solder the wires to the POT and here's a pic from the Pcomp Lab

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 took 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. Check out these lips:


and Gordie thankfully took over the cutting of the foam board which gets all over everything when you use the cutter in the shop.

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 <>= 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's Gordie doing a test with some flex sensors before we put the whole machine together.

Video thumbnail. Click to play
Click To Play

Then we put everything together and threw in everything but the kitchen to make the LOVE-O-METER gorgeous. Here's Lina testing out the final masterpiece.


Tuesday, February 3, 2009

Observing Technology in Public....Translation Watching The SuperBowl at a Bar!

This week part of the assignment was to observe technology and its users so we decided to hit up a bar in the Village, Down The Hatch, and watch the SuperBowl. It was a great time for everyone french fries, cherry sam adams, and football! We observed tons of people using technology during an event that 10 years ago would have people strictly interacting with their televisions. Here's a pic of Andres + Gordie after the Cardinals scored a touchdown interacting with a more traditional form of communication, the High Five!

ABC and the advertising interests that be were promoted interacting with the television and their billion dollar commercial spots using an old fashioned form of technology, the 3D glasses


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.
Here's some people we stalked and took pics of. I also think people were updating their facebook and twitters, I found this great chart about the twittering during the event.




Older forms of technology were on display, such as the calculator, seen here being used to figure out the day receipts:
It was a great time and we enjoyed the fun atmosphere and good times. Here's some videos of us watching the big game and the crowd interacting with technology and dancing during the half time show.