Left to his own devices…

April 29, 2009

Emily and Gordie do a P Comp Final Project: MEOWZERS! WE’RE FINALLY FINISHED!

Filed under: Physical Computing — admin @ 6:22 pm

Here is the video of our final test of our P Comp final project, a cat entertainment device we’re calling MEOWZERS, a device to tease your cat (in a non-sexual way).

In the video you’ll see us operating the device using a sketch that Emily wrote in Processing that features a cute cat cartoon image that serves as a “cursor” that directs the action of the two servos and triggers the laser pointer we embedded into the mouths of one of the four mouse heads that adorn the cat scratching post we modified. Moving the cat icon vertically activates the servo that controls the movement of a feather teaser, causing it to dip and rise to bait the cat to chase it. Moving the cat icon horizontally activates the servo that spins the crown of the scratching post, causing the mouse heads attached to the four posts emanating from the center post to shake in a wild fashion. Pressing the mouse on the computer triggers the laser pointer we embedded into one of the mouse heads. (Emily did a really cool icon to show this effect on the screen.)

Here’s the video of the project in action:

Here’s the Processing Code:

import processing.serial.*;

Serial port; //Create object from Serial class.*;

PImage Cat1;
PImage Cat2;
void setup() {
imageMode(CENTER);
size (700,700);
Cat1 = loadImage(“Cat.jpg”);
Cat2 = loadImage (“Cat2.jpg”);
frameRate(30);
//Open the port that the board is connected to and use the same speed (9600bps)
port = new Serial(this, Serial.list()[0], 9600);
}

void draw() {
background (255);

float newmouseX = map (mouseX, 0, width, 0, 254);
float newmouseY = map (mouseY, 0, height, 0, 254);
port.write((byte)255); //start byte
port.write((byte)newmouseX);
port.write((byte)newmouseY);
if (mousePressed){
image(Cat2, mouseX, mouseY);
port.write((byte)4);
}
else {
image(Cat1, mouseX, mouseY);
port.write((byte)0);
}
}

And the Arduino code:

#include

Servo servoMotor1;
Servo servoMotor2;

int servo1 = 0; //Data received from the serial port
int servoPin1 = 9; //Set value servoPin1 to pin 9
int servo2 = 0; //Data received from the serial port
int servoPin2 = 10; //Set value servoPin2 to pin 10
int button = 0; //Data received from the serial port
int buttonPin = 2; //Set value buttonPin to pin 2

void setup(){
servoMotor1.attach(servoPin1); //Sets pin as OUTPUT
servoMotor2.attach(servoPin2); //Sets pin as OUTPUT
pinMode(buttonPin, OUTPUT); //Sets pin as OUTPUT
Serial.begin(9600); //Start serial communication at 9600bps
}

void loop()
{
if (Serial.available()>= 4){ //If 4 bytes are available to read,
int inByte = Serial.read ();
if (inByte == 255) {

servo1 = Serial.read(); //read serial and store it as val
servo1 = map(servo1, 0, 254, 179, 0);//map servo1 position to val
servo2 = Serial.read(); //read serial and store it as val
servo2 = map(servo2, 0, 254, 179, 0); //map servo2 position to val
button = Serial.read(); //read serial and store it as val

servoMotor1.write (servo1); //move servo1 to position
servoMotor2.write (servo2); //move servo2 to position
if (button == 4){
digitalWrite (buttonPin, HIGH); //turn on laser pointer
}
else{
digitalWrite (buttonPin, LOW); //turn off laser pointer
delay(25);
}
}
}
}

We consider this project to be a smashing success, particularly given how little experience we had with programming prior to this class. It is said that “success has many fathers”, and that is certainly true with this project as many came forward to assist us whenever we ran into problems. We’re extremely grateful to all those who aided us, and our special thanks goes out to:

Jeremy Rotzstain, whose quick tutorial on Processing made our control device possible;

Adam Parrish, who helped us get our feet wet with Processing with his help session;

Todd Holoubek and Rory Nugent, whose suggestions on the P Comp side were invaluable;

Rob Faludi, whose last minute adjustment to our Arduino code literally calmed our jitters by solving the problem of our shaky servos;

Dan Shiffman and Tom Igoe, who kindly loaned me the texts of their two definitive works (Dan’s Learning Processing and Tom’s Making Things Talk );

Tigger Ryan, who did a wonderful job as our “test cat”;

our classmates, whose creativity, ambition, and brilliance inspired our efforts;

and finally, our teacher Scott Fitzgerald, whose calm demeanor, knowledge, generosity, and incisive feedback made this class so pleasurable despite the many frustrations attendant to it.

I would also like to extend my heartfelt thanks to my partner on this project, Emily Ryan, whose patience and good humor kept us on track even while I was fuming about small stuff (like the clocks being off). I did every project in this class with Emily, and while I may have given her cause at times to regret her choice of partners, she never gave me cause to regret mine. Her easygoing manner made working with her a joy, and her design skills covered my deficiencies in that area and made our projects come alive. I’m sure she has great things ahead of her in this program, particularly if she ever learns to overcome her shyness and be a little more outgoing…

Emily and Gordie (and Tigger!) do a P Comp Final Project-Week 3: Field testing

Filed under: Physical Computing — admin @ 5:10 pm

Here is the video of the field test we did with Emily’s cat Tigger. At his point, we weren’t sure if we would be able to get the device to be triggered by Processing or php (we’re using a pair of potentiometers to activate the servos), but at the very least we knew that we had created something that could amuse a cat. Watch Tigger go crazy on our project to the strains of Frankie Valli and the Four Seasons’ Begging.

April 14, 2009

Emily and Gordie do a P Comp Final Project-Week 2: Progress is slow

Filed under: Physical Computing — Tags: — admin @ 7:39 pm

Progress was slow this weekend, but we did get three of the elements of our cat amusement center to work.

We began on Saturday by heading over to Petland to buy a cat scratching post. Emily chose a fashionable sky-blue model with mouse heads suspended from four rods situated around the top column of the post. Since the top column detaches from the bottom, we decided to put a servo on the top column so it could rotate upon activation:

Next we decided to attach a servo to a dowel that we picked up from Home Depot. Our plan is to mount it to the top of the post and attach the feather toy with some string so the servo can mimic the action of pulling the line up and down to draw the cat ‘s attention. Here’s the servo with the rod in action:

Finally, Emily wired up a ball with LEDs that we plan on attaching to one of the pots in place of one of the mouse heads. Here’s her gluing the ball together and testing it:

We’re still quite a ways from completion. We’re in the process of building a housing for the servos, and trying to figure out the triggering mechanism for the project. Sadly, it probably won’t be a web-based one, because after looking over the TweetMobile code, we both realized that we just don’t have enough programming experience to figure out how to adapt it for our purposes. Right now we’re looking into activating it through a radio transmitter/receiver set-up.

More to come.

April 8, 2009

Emily and Gordie do a Final Project-Week 1: Observation–Cats are Evil

Filed under: Physical Computing — admin @ 2:44 pm

If history has taught us anything, it’s that cats are evil.

From the assassination of Archduke Franz Ferdinand, triggering the start of the First World War…
cat killing a duke

…to the katzen responsible for the carnage of the Second World War…
HItler Cat

…to the master criminals of today spreading their chaos throughout our society…
BatmanVsJoker

…cats have shown themselves to be the enemy of mankind.

Since idle paws are clearly the devil’s workshop, we’ve decided to build a device that would allow cat owners to keep these devious creatures busy while they are away and their cats are home alone plotting other ways to bring ruin to mankind.

We observed one of these vicious creatures in his natural habitat…

…and since they appear to be distracted by simple movement, we intend to build a combination scratching post/cat amusement device.

The device will have a couple of motor driven arms that will dangle and swing a couple of cat toys to hopefully amuse the cat and keep it from hatching more evil schemes.

At the moment, the plan is to permit the owner to activate the device remotely using their Twitter account. How successful we’ll be will depend a lot on how much php two people can pick up in three weeks.

But we must succeed…since the future of mankind may well be at stake!

March 17, 2009

Emily, Lina, and Gordie do a P Comp Mid-Term Project (Epilogue-A New Home)

Filed under: Physical Computing — admin @ 10:23 pm

mousepad

Although the midterm presentation went well, there was some last minute anxiety due to the fragility of the housing that supported the “guts” of the mouse which caused the gears of the motors to lose contact with the encoder wheels of the mouse. So we retired the former housing, the foam and tape contraption which we affectionately nicknamed “Stonehenge”, and replaced it with a sturdier model built of wood, which I think kind of resembles the Flintstones house.

I describe the changes here, and show the pad in operation in its new “home”:

We drilled the wood with two sizes of drill bits (7/8″ for the body of the motors; 5/8″ for the head) to provide a tighter casing for the two motors, and secured them in their holes with rubber corks. We replaced the encoder wheel “gears”, which were sliding up the shaft, with the gears that came with the kit, so they fit the shafts of each motor snugly. We secured the base of the mouse to one block of wood, and then cut up a dowel to form columns to support the top block which houses the motors. While the bottom of the columns are secured with wood screws to the base of the new housing, the top is for now unsecured, which allows us to show the inner workings of the project.

With the new housing for the project in place, here’s a tribute to its short-lived predecessor:

March 11, 2009

Emily, Lina, and Gordie do a P Comp Mid-Term Project (Part 3-IT LIVES!)

Filed under: Physical Computing — admin @ 10:21 pm

This week Emily, Lina, and I endeavored to complete our proposed P Comp project of hacking an old PC mouse to permit somoene to operate the device using a footpad.

We met early on Saturday on Canal Street and shopped for some material to use for the footpad. We went to a fabric store where Emily’s desire to use an animal print led us to a cow pattern print where the cow’s “spots” were in the shape of little (Mickey) mouse heads. We knew once we saw it that we had to go for this material. It inspired us to build the pad in the shape of a mouse’s head, with the face divided into quadrants holding the sensors controlling the left/right and up/down movement of the mouse, and the right and left ears serving as the right and left click buttons.

The other key was Lina’s decision to use relays to operate the click buttons on the mouse. We had discussed using transistors, but Lina was familiar with relays and they were a lot easier to wire up on the board.

The relays were the right call, as you can see here as we use them to simulate the right/left click action of the mouse. (Notice how I was really working the gum in the video!):

The next challenge was to simulate the x- and y-axes movement of the cursor on the screen. We initially thought to pull the encoder wheels off the mouse and attach them directly to the axle of the motors, but that didn’t work all that well, as you can see here:

The problem was that the encoders really had to sit in their housing in order to properly activate the movement function of the two axes, but the size of the motors prevented us from allowing them to placed where they normally would be if we left them attached directly to the motor axles as seen in the video.

Eventually, we solved the problem with the motors by taking the parts from another mouse, putting its encoder wheels in the housing provided by the mouse, and then cutting the encoder wheels from the first mouse down and using them as gears to intersect with the now properly housed encoder wheels. Here’s Lina showing Mustafa the new direction we were taking with the problem of the motors:

It wound up being the right solution:

The left and right clicks were working, even after we transferred the sensors to the “mouse pad”. (Note the time in the early morning, which explains why we’re all so groggy):

The last challenge was to build the housing for the guts of the mouse to hold the motors. We built a makeshift “Stonehenge” that was not an aesthetic triumph, but it did work!

The project was particularly grueling because of all of the late nights we had to put in on it. But the burden was lessened by the help of so many people on the project, chiefly Lina’s husband Andres, Anaid (the Angel of P Comp!), who provided us with so much help with parts and suggestions (particularly, schooling us on the perf board), Todd, who was constantly around with great suggestions, Oscar, who help us solve the problem of powering the project, Rory, John Dimatos, and of course, Scott, our teacher, who gave generously of his time with extended office hours on Monday.

My thanks go out to all above, and especially to my two project partners, Lina Giraldo and Emily Ryan, for all their great work and patience throughout the process. It was very tense at times, and there were a few flare-ups (Lina stated it best when she wrote in an e-mail that we were learning as much about working in groups as we were about P Comp), but we came through the process with a functioning project that more than a few people told us was ambitious enough to be a final project. That felt great to hear. Most importantly, despite a last minute problem due to some jostling in transporting the project to it show area, thanks to some last minute tinkering by Lina–and the grace of God–it worked when it needed to–which is when we were presenting.

As anyone who has ever taken P Comp will tell you, that feeling, when something you sweated over for many hours performs when the audience is around it, is hard to top!

Thanks to the awesome Andrew Jordan, we have some footage of our mousepad in action on that day:

March 4, 2009

Emily, Lina, and Gordie do More Serial Communication and a P Comp Mid-Term Project (Part 2- Prototype)

Filed under: Physical Computing — admin @ 3:47 pm

Emily, Lina, and I worked on this week’s labs as well as our mid-term project prototype.

Here we are reading the serial data:

Here we’re organizing the serial output with the “punctuation” method:

We’re dribbling the virtual Processing ball using the potentiometers:

We got the serial monitor to do its best Lionel Ritchie impersonation and say “hello” here:

After modifying the code, we got the Arduino and Processing to “shake hands”, and play with a ball:

And here is the prototype of our mid-term project in action controlling the Processing ball, which serves as a virtual cursor in this case:

My project partners seem way too happy about the amount of wiring we had ahead of us in assembling the footpad prototype…but I could not wish for a merrier duo to work with!:
Way too happy about wiring

This is the layout of the prototype of the footpad:

A peek at the footpad

And here it is in action:

This is an onscreen representation of our virtual “cursor” in action:

Note the cursor is initially centered, and moved to the left and the right, and up and down, by the analog sensors. Lina programmed the left click and right click buttons to change the color of the ball and the color of the background respectively.

We now need to master using motors to operate the gear wheels controlling the x- and y-axes on a PC mouse, and using transistors to serve as digital switches to activate the right and left click buttons. Good thing motors and transistors are scheduled to be covered in class this week!

February 25, 2009

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

Filed under: Physical Computing — Tags: , , , — admin @ 4:18 pm

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!

February 24, 2009

Emily and Gordie Examine Serial Communication with Processing

Filed under: Physical Computing — Tags: , , — admin @ 4:21 pm

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

February 18, 2009

Emily and Gordie make Music with Ardy

Filed under: Physical Computing — Tags: , , — admin @ 12:49 pm

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!

Older Posts »

Powered by WordPress