Getting Gadgets to Yak for You
Machines get smarter but most still won't talk to each other. There's a DIY way around that problem.
Hummingbirds: Day after day in warm weather they would zing up to the feeder outside my office window, and every time I saw one out of the corner of my eye I thought how nice it would be to get some good pictures. Nice, but not quite worth sitting motionless behind a lens for great chunks of time to get the perfect shot.
So I attached a remote-control button to a camera clamped to the windowsill. But hummingbirds are skittish, and every time my hand left the keyboard to reach for that button the birds flitted off. Then I removed the camera from the clamp and replaced it with a webcam. This was nice, because the webcam software (Oculus) includes motion-detection routines, meaning it will take pictures only when a bird buzzes the feeder. Two new problems emerged: The image-processing activity brought everything else running on my com-puter to an amble, and the resolution was just about good enough to tell the difference between a rubythroat and a really big hornet.
I started thinking about getting an embedded Web server. Actually, what I started thinking about was a device to trigger my SLR camera every time the webcam said there was a bird at the feeder. That turned out to be the embedded server.
To picture the server, think of sites like Google or Yahoo, which employ thousands of high-end CPUs ganged together to answer hundreds of millions of queries a day from all over the world, the equipment occupying whole floors of specially constructed office buildings. Then imagine the opposite, a few $2 chips wired together and a few hundred bytes of software: All it takes to create a tiny server that will answer simple http requests. We’re talking about a tiny machine here: A few years back, Hariharasubrahmanian Shrikumar, a graduate student at the University of Massachusetts, built a server in a space slightly larger than the head of a match. The biggest single component in these widgets is typically the modular RJ-45 plug for the Ethernet connector that attaches the server to the rest of cyberspace.
In the best of all possible worlds, I wouldn’t need a microserver at all. Networks and communication protocols would already be perfectly tuned for exchanging information between intelligent devices-thermostats, coffeepots, Coke machines, air conditioners, parking meters, sump pumps and so on. Right now we have digital Babel. Committees full of very smart people have been trying to build a perfect solution to the universal gadget- yakking problem for years, and there’s no end of the trying in sight. So meanwhile, it’s much easier just to embed the aforementioned Web server-a device that legions of techies already know how to make and how to talk to-into whatever widget or appliance needs to acquire communication skills.
Oh, and they’re fun. You can hang a circuitboard on your home Ethernet, point your browser at its IP address, click your mouse and watch LEDs on the board blink on and off (this is a geek’s idea of fun). You can wire it to turn the volume on your stereo up or down, or get back text and pictures telling you the status of home appliances, weather stations or doorbells. Geeks around the world have found almost endless excuses to rationalize building or buying a microserver: monitoring the temperature and humidity in their basements, building Web-enabled robots for school, controlling the color and brightness of their office lighting and so on. Engineers are using them for everything from controlling electronic test equipment and machine tools to mapping flow rates in municipal sewer systems.
If you’re not quite up to the soldering and machine-code hacking required to build your own from scratch, there are a bunch of preconfigured micro Web servers out there, including Picoweb, TINI, Rabbit, mCdimm, the iButton family and Siteplayer. I picked Siteplayer for my birdcam because it appeared to require the least wiring, and because Tom Igoe, who teaches physical computing at New York University, offered moral support and a copy of his course notes. (One link on his fan page-point your browser to 22.214.171.124-activates a Site-player-controlled fan in his office.)
Tom is right: Anyone who can follow simple instructions and twist a few wires together can set the Site-player up to do something at least arguably useful. It took more time to get a hand-me-down Windows laptop to play nicely with the other devices on my house network than it did to go to Radio Shack and pick out components to isolate the Siteplayer from the current spikes of the camera’s motor drive. Wiring up a circuit to connect the Siteplayer to the camera remote-control plug and fire the shutter was the shortest job of all.
The software side? Just a simple matter of programming. Change a few settings in Oculus, write a half-dozen lines of Applescript, and next steal some HTML code from one of the Siteplayer example files and download it to the little server board. Then, when Oculus detects something moving in the webcam’s field of view, it captures an image, discards it and runs a script that tells Mozilla, my browser, to fetch the link that activates Siteplayer. Siteplayer responds to the http request by twiddling the output port that’s connected to the motor drive, and click-bzzz!-another hummingbird gets startled out of its diminutive wits. Every 24 or 36 frames, the motor drive makes a horrible grinding noise, alerting me to rewind the film and put in a new roll.
My birdcam microserver is nowhere close to being an eccentric use for this technology. Jack Schoof, president of Netmedia, which makes the modules, says that one of the perks of his job is being first to hear some of the strange things people do with his product. Among his personal favorites is the guy who buys case lots to use as easy-to-program detonators for complicated movie pyrotechnics. (Schoof likes this idea because every fireball you see on the screen blows a module to bits and creates demand for another.) So even as I cringe while contemplating whether I should use protocols developed for sharing subatomic physics data to set the timer for my microwave oven, I marvel at the strange uses http can be twisted into, not because it’s best for the job, but simply because it’s everywhere, already speaking a universal language.