2 for the hack of 1
Right before Christmas, We got a couple new toys in the lab, so we decided to figure out both of them at the same time.
The first is called Little Printer, and is a small, very well designed thermal printer for your desk and comes from Berg in the U.K. With it, you can subscribe to different feeds that occur weekly (like the monster of the week) or daily (like what was the most popular photo of my instagram friends yesterday.) But the real power in the printer is a beta api method that allows you to send HTML directly to the printer.
The second toy is called the Twine. It’s a small box that allows you easy access to “the internet of things.” You can track data about your surroundings including temperature and orientation. These data points can trigger events to send an email, an SMS a phone call, or even post to a web server. The Twine also has an expansion port that allows you to add other sensors to track. And all this can be setup through a simple to use web interface.
As we were concepting what to build with these things, people kept coming in and out of the lab asking what we were up to. Then it hit us, we were going to create the most inefficient security system known to man!
We started with a magnetic switch and the Twine. Every time someone opened the lab door, the switch would activate, and it would send a request to a computer running in our lab. (We are behind a firewall, like most of you reading this, so in order for the Twine to reach the computer, we used Local Tunnel temporarily to make the computer available for testing.)
On the computer we were running a small nodejs server that listens for the request /takePhoto from Twine. When it receives one, it will:
- Take a picture with the attached web cam Gray-scale, resize, raise the contrast and dither the image FTP the image to another web server Send a post to the Little Printer cloud service
And within 30 seconds of someone opening the door, we would get a printout of the perpetrator.
There are of course hundreds of better ways to accomplish this, but we managed to get all of that up and running and learned a ton about our new equipment, all in less than 5 hours of work.
You can grab the node server we wrote here.
Originally published at themartinlab.tumblr.com.