Wednesday, December 3, 2008

Iphone as a Universe Controller: Part 1

Why have a universal remote control when you can have a universe controller? I was fortunate enough to get to beta test some of ioBridge's forthcoming hardware. Their hardware lets you connect just about anything to the internet. The possibilites with these things are just about limitless. I am convinced I can control just about anything in my house with this little board and my iPhone. The company has a number of premade "smart boards." The modules also have input/output pins so you can get any of your microcontroller projects online. I wanted to put together a few simple progects based on their smart boards. I got a x10, light sensor, and a servo smart board. I made a little gizmo with each one. In this write up I'm going to talk about the gizmo I made with their servo smart board. In my next post I'm going to demonstrate how to control you home lights. Then I will post about how the ioBridge module can be used to lock your computer and update your twitter feed automatically when you leave the office.

I have a dog that stays home alone while I am at school. I thought it would be nice to be able to check up on my dog Cooper during the day, and even better if I could give him a delicious doggie treat. With the ioBridge module, a servo smart board, and some random parts around the house I was able to put together a dog watching, treat giver that is all controlled with my iPhone over the internet. The whole project took about an hour and because of iobridge's simple internet interface no programing was required.

Here is a video (youtube link) of the finished project. Below the video are my detailed instruction about the project.

Finished project in action

Here's what I used:

ioBridge I/O module

ioBridge servo smart board

servo

old CD spindle case

cardboard scrap

large syringe plunger

scrap wood

webcam (just used for visual confirmation that treat was delievered)

ioBridge servo smart board

I started by cutting a hole in the top of the old CD case for the axel of the servo to fit through. With some scrap wood I mounted the servo above the case.

Old CD spindle case with servo attached to top. The windows in the side are for loading the dispenser with treats

I cut the plunger to a length about a quarter of an inch shorter then the interior of the old cd case. After super gluing the servo's detachable wheel to the top of the plunger I glued square cardboard scrap to half of the plunger at 45 degree angles. I made some triagnles out of wood and used them to keep each of the fins seperated by 45 degrees. While the glue dried I cut a pie shaped wedge in the board that was the same size as the wedges created by gluing the cardboard at 45 degree angles around the plunger.

Syringe plunger with cardboard fins attached at 45 degree angles

Bottom platform with hole cut for treat to drop through

Once the glue dried I attached the plunger to the servo and connected the servo to the ioBridge I/O modeule via the servo smart board.

View of bottom of housing with plunger assembly attached to servo

Assembled device

I followed the simple ioBridge instructions for getting their board online for the first time. Using the ioBridge web interface it was simple to create a widget that controlled the servo. At the end of the widget wizard it automatically saved the buttons that controlled the position of the servo in my ioBridge dashboard (the dashboard is your home page once you log into the ioBridge website). The wizard also outputs javascript incase you want to embed the controls in your own page as I did.

Screen shot of widget builder

With all the javascript their site gave me it was no time before I had a webpage that I could access from my iPhone. I could have just pasted the javascript they gave me into notepad and saved it as an html and had controls that would control my device, but I wanted a little something more. I optimized it to be viewed on my iPhone and embedded a feed from a streaming webcam I placed over Cooper's kennel. Now I could see what my dog is up to when I'm away. I saved the website to my iPhone's home screen, and in less than an hour and a half from starting the project I had a web app on my phone from which I could view my dog and give him delicious, steak flavored treats.

Icon on iPhone home screen and then view of the web app I created using the ioBridge generated javascript. The picture of my dog is from a streaming webcam.

There is a lot of software that will stream a webcam, including places online like justin.tv. My biggest requirement was that I wanted to view the feed on my iphone, which meant no flash viewer. I went with webcamxp.

I get it...Universe Controller, NOT Universal Controller. Very nice project. Is this possible because it's the iPhone or because the bridge module? It looks like the io board is at the heart of the setup.

The iobridge module is def at the heart of the setup. Before the iobridge, getting something on the internet to interact with the physical world was very very difficult, and this project took no time at all.

I just used an iphone because it's an internet connection I always have with me, but any connection would work.

webcamxp gives me a website that is http://your_ipaddress:8080. After setting up port forwarding for port 8080 it is possible to view that page from anywhere. I took the code from the page webcamxp generates and embedded it into my iphone viewer.

The site is hosted on my personal website (but not on this blog). To view it on your iphone it has to be hosted somewhere since I don't think there is a way to save html files to your iphone, at least not one that isn't jailbroken. If you want to use a computer to view the page there is nothing stopping you from making the needed html and just saving it to your local computer. If you open the file with IE/firefox it will look like any website should. The video is being generated by the software webcamxp.

What I do to feed my dog when im not at home is a much more simple, however, it's obvious that I dont have as much control as you have.

What I do is to pick a plastic bag, open a very very small hole and fill it with water.

I tie up the bag in a high place and I let the drops fall for 15 minutes.

Then I look at the clock, if its 8am, I know my dog's lunch is at 1pm, so there are still 5 hours until that.

Then I use a pulley system for putting the meal one one side and on the other I put the bag which I fill with the quantity of water that keeps the system ballanced (I know that in this balance the food will be in the reach of my dog in about a half hour).

The quantity of water I will have to add to the balance is (5x4)-2=18

This is 5 hours by 4 quaters per hour minus 2 quarters that make the half hour of the balance.

I have to add 18 times the quantity I measured on the first step (the water felt in 15min).

This will ensure that my dog get its food sometime around 1pm.

Its important to say that the time of the balance to reach the dog is determined by the heigh and the size of the hole, so the quarters that it take may vary.

Also I use a drop per minute way to know how much water do I have to add for each hour remaining (you can do this by simple measures).

Hope I helped somebody and congrats for that invention of "feed your dog from anywhere, anytime".

The site is hosted on my personal website (but not on this blog). To view it on your iphone it has to be hosted somewhere since I don't think there is a way to save html files to your iphone, at least not one that isn't jailbroken. If you want to use a computer to view the page there is nothing stopping you from making the needed html and just saving it to your local computer. If you open the file with IE/firefox it will look like any website should. The video is being generated by the software webcamxp.

I get it...Universe Controller, NOT Universal Controller. Very nice project. Is this possible because it's the iPhone or because the bridge module? It looks like the io board is at the heart of the setup.

I recently came across your blog and have been reading along. I think I will leave my first comment. I don’t know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.