Print

Home Monitor on a Cell Phone

by David Fox
07/23/2001

David Fox won the Motorola-Nextel Developer Challenge at JavaOne by whipping up a program that lets you control lights and appliances at home via cell phone, and stream webcam images to its tiny screen. Oh, and, he did it in six hours, and drove away in a BMW Z3 for his efforts. Here's how he did it.

Probably there's something wrong with me, but I'm telling you the truth: I was in it for the fun, not the BMW.

I live in New York, and have never even owned a car. Somehow, though, I was lucky enough to come home from JavaOne with a toylike, two-seater convertible. This is how it happened.

Before the Contest: Planning the App

The contest was simple enough -- write an application, any application, for the new Motorola i85s cell phone. Oh, and do it, from design to prototype to build to deploy, in six hours or less.

The challenge was part of this year's JavaOne, sponsored by Motorola, the phone maker, and Nextel, the exclusive carrier service. Twenty-five computers were set up, with twenty-five cell phones attached. At the back of the room were a platter full of sandwiches and brownies, a silver bowl full of soda and beer, and a bunch of Java techies to help answer questions. There was also a chair set up for deep-tissue massages. First prize was a new BMW Z3 convertible and two i85s with a year of free service.

So as challenges go, this was no triathlon or Everest climb. Some people, I'm sure, were just there for the free massage and food. But having competed in a similar competition the previous year, I knew that endurance was still an issue. It was far too easy to fall into the trap of coding monstrously for two or three hours and then getting frazzled.

Like many programmers I know, once I get in the zone of coding, time has no meaning. I can go for hours, and in some cases days, without distractions like food, water, sunlight, hygiene, or human contact.

But I knew that I had to be careful of burning out too quickly. I had to pace myself… I told myself that I'd spend 55 minutes of every hour in the trenches, and be sure to take 5 minutes off to refocus my eyes, crack my knuckles, pound down a few brownies, and pace around the room.

Now, the i85s is something of a trailblazer -- the first United-States available phone to support Java 2 Micro Edition, or, as it is called by its friends, J2ME. Luckily, I'd played around with J2ME before, in my role as a multiplayer game developer. I knew a little about its far reaches, and its limitations. I've tried in the past to create big, entertaining experiences on those tiny screens. But it's very difficult to port, say, Tomb Raider or Quake onto a cell phone. I did believe, however, that there was a lot of potential for text-based games and games that use the strengths of an always-on, always-with-the-player wireless connection.

Figure 1. A screen shot from the mobile phone emulator application shows an image of the home map.

For example, the request might look something like this:

http://www.myhouse.com/x10controlservet?lighta=off&heaterb=on

When I found out about the challenge, I began asking myself what I could do that would actually be fun, sexy, useful, and possible to pull off in six hours. Naturally, my first thought was to do a game. But it just so happened that I was tinkering around with a home automation system that day. Now, I don't mean to make my apartment sound like something out of The Jetsons, but over the years I've set up a few X10 <http://www.x10.com> Firecracker modules into my lamps and appliances, allowing me to turn things on or off from any room in the house. I've also played around with wireless webcams from X10 and other companies -- cameras that grab frames of video and stream them to the PC. It's fun stuff, though it's often more for the purposes of impressing friends than anything else.

For the past few months, a side project of mine has been to play with servers such as JShape X10, a program that interfaces with X10 Firecracker modules. JShape's server also comes with a WAP front end, which allows you to turn lights on and off from a cell phone. But controlling so much information on a small, slow phone with a limited language like WAP just isn't too appealing.

Then the idea hit. With the advent of the i85s and J2ME, not only could the light-and-appliance interface look snazzier and be much more responsive, but I wondered if it would be possible to go a step further and use J2ME's graphical capabilities to actually stream the frames from a webcam across the Internet and directly onto the phone. Not only would you be able to flick on your A/C on your way home from the office, not only could you turn off all your downstairs lights from upstairs and save on energy bills, but you could spy on the nanny, or keep an eye on the teenager during your European vacation, or catch burglars in the act, or (and I don't by any means recommend this) keep tabs on a wayward spouse. I would call it Home Monitor.

Pages: 1, 2, 3

Next Pagearrow