Friday, December 26, 2008

iTurn - iPhone and iPod Touch Hack

Since my toaster has been on the Internet Twittering my toasting habits, I have been flooded with email asking what I was going to do next. To be fair, most of the email suggested that I had too much time on my hands. My mom got me an iPod Touch for Christmas (she gave it to me a few days early). I have not had the thing out of my sight since she surprised me with a wonderful gift. She also gave me Batman which I transfered to the iPod. I turned the screen about 44 times a minute while watching The Joker and The Dark Knight try to out smart each other. This got me thinking, "Could I control a motor with the movement of the iPod?" I had my next hack.

The iPhone or iPod Touch has an accelerometer that detects how the device is oriented. As the devices moves off axis (from straight up and down) the screen rotates. I want to use that feedback to control the position of a motor or servo or cause specific events to happen depending on the device's position.

Taking the ioBridge IO-204 module, I connected the servo controller and a servo to one of the channels. On the servo I taped a Best Western hotel pen to show the movement of the servo. I found from hours of testing that the Best Western worked the "Best" and Hampton Inn worked slightly worse.


iTurn setup

On the ioBridge website, I created 3 widgets that corresponded with the orientation of the iPod. "Left" for when tilted towards the left, "Right" when I turned right, and "Forward" when I was holding the iPod normally (straight up and down).

iTurn Widgets and Screen Shot

Warning: The next part involves some light programming. I made a quick HTML file with some JavaScript that detected the orientation of the iPod and called the appropriate widget. The orientation code is below for those of you that are interested in trying this for yourself:

function updateOrientation() {

switch(window.orientation){

case 0: widgetExecute("Upright Widget ID");
break;

case -90: widgetExecute("Right Widget ID");
break;

case 90: widgetExecute("Left Widget ID");
break;


}

} // Visit ioBridge Projects for full documentation

Load up the completed HTML file on your iPhone or iPod Touch and now you can control a servo with the turning of your iPhone. I call it "iTurn" (didn't see that one coming, did you?).

Here is a YouTube video of the iTurn project:

Labels: , , , , ,

Saturday, December 20, 2008

People Watching at the Airport

I travel a lot and find myself watching people at the airport to pass the time waiting for flights to depart. I watch them as they walk by Cinnabon and pretend not to want one. I am fascinated by how people behave -- whether it's good behavior or bad, I still find it interesting. After a canceled flight and Chicago weather, I finally made it back to Pittsburgh International Airport. If you have never been, it's like a mall that opened up an airport. I was waiting for my luggage to come from the airplane. We are all standing around a belt that turns in one direction and carries our luggage from a down ramp. The first thing I noticed is that half of the crowd was on one side of the ramp and the other half was on the other side. So, half of these people are going to be waiting the entire trip around for their luggage and the other half are going to get their luggage first. A lady in her late forties and a scarf had an entirely different agenda. She was going to stand clear and wait for it to start turning and sidle up and grab her bag. I could see the anticipation well up as the horn and spinning light announced our bags were coming. She got up and cut right to the side the belt was turning ignoring the people who were there first. My page came out soon, but I wanted to see how it played out. The lady grew impatient and sighed with the exaggeration of a stage actor. I waited 10 minutes and nearly all of the bags were taken minus a few stragglers -- a taped up duffel and flower print roller were the only ones left spinning. She stormed into the bag claim office. I took my flower print roller and headed to the parking shuttle. On the ride to my car, I thought about the events of the lady and her missing bag. She probably asked for it and had it coming.

Labels: , ,

Sunday, December 07, 2008

Social Networking for My Toaster

My Toaster Twitters

That statement sounds odd. Well, let me explain. My friends would describe me as the kind of person that has a lot of time on their hands. They would be right. That time is never put to productive use, but over Thanksgiving I got the gumption to start a new project. Sometimes, I start little servo, robotic, web-based projects for my own gratification, but I get fed up with all of the time I invest just so I can impress my 3 friends that also have nothing do to over the holidays.

My friend Jason Winters has been working on an module that simplifies the connecting of projects to the internet. He sent me one of his ioBridge modules to beta test and my mind started spinning. My goal this Thanksgiving was to think of a crazy project that would be the most senseless thing someone has ever heard of before.

Again, My Toaster Twitters...

Twitter is a social networking site that allows you to tell the world your current status - kind of like a microscopic blog that gets to the point. You can write, "Hans is going to lunch" or "Hans is tired", etc. It's fun to follow people and see what they can do creatively with just a few characters of updates.

I use my toaster when I am home and I thought that the world may want to know when I'm toasting.

twitter.com/mytoaster

How do you make a toaster twitter?

I grabbed my old bagel / toast toaster and glued a switch to the outside, so when the slider gets pressed down it triggers the switch and when it pops up, the switch opens (couldn't be any more binary then that).


The ioBridge module has a digital input that I can hook the switch up to and monitor that state of toasting or not. Using a terminal board, a pull up resistor (1k), and some alligator clips, I hooked up the resistor from the digital input to the +5v source from the module, and clipped my clips on the resistor and the ground. A few pictures are worth more than my description.



Here is the whole system hooked together:


The Web Stuff

Using the ioBridge website, I created an event widget that monitors the input state of that particular digital input. And when the input is "high", the site sends an email to any address of my liking. And the same for the "low" state. I chose my Twitter Mail address, but really could of hit any social network, email by blog, or even UberNote.



Follow My Toaster on Twitter at twitter.com/mytoaster. I think I proved empirically that I have too much time on my hands.

Labels: , , , , , ,