Archive for April, 2009

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

Wednesday, April 29th, 2009

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

Wednesday, April 29th, 2009

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.

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

Tuesday, April 14th, 2009

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.

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

Wednesday, April 8th, 2009

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!