My own microprinter
on Mar.02, 2009
Inspired by Jeremy Keith’s post about PaperCamp, I though I’d build my own little microprinter.
Easy enough: my girlfriend owns a shop that has a lot of old junk in the attic. So do I. These are times where that comes in handy. Her old Epson TM 88 receipt printer was only a phone call away. She’s switched to a more modern USB-based printer and this serial port one is of no use to her.
My attic sports a whole selection of boxes with random cables, adapters and gadgets. A targus serial-to-usb convertor was in one of them.
I connected both on my macbook pro and sure enough, the printer was immediately recognised and some legacy Epson 9-pin printer drivers (roughly) do the job. This wasn’t good enough though. Since working at XS4ALL in the mid-90s, I learned to ban any printer directly connected to a computer. 5 minutes later, I couldn’t help but smiling when the second test print rolled out the Epson, which was now connected to my Airport Extreme / Time Capsule base station (still through the serial-to-usb convertor, which was now connected to a – i again refer to my attic – usb hub, to still allow an extra external harddrive to be connected).
Some 20 minutes later, I had a rough “good morning” generator, including the weather (through the weather.com API) and the latest tweets (through the twitter API).
The code is quick and dirty, I’ll have to clean it up one day (the same day I’ll clear out the attic), but it works:
function get_forecasts($location) {
$url = "http://xoap.weather.com/weather/local/".$location."?cc=*&dayf=5&link=xoap&prod=xoap&par=1100278982&key=[mykey]";
$xml = simplexml_load_file($url);
$forecasts = $xml->dayf[0];
$firstday = $forecasts->day[0];
echo $firstday->attributes()->t;;
echo $firstday->part[0]->t[0];
echo round(f2c($firstday->hi[0]));
echo round(f2c($firstday->low[0]));
echo " sun: ".$firstday->sunr[0];
echo $firstday->suns[0];
}
get_forecasts("BEXX0008");//ghent, Belgium
All that’s left for me to do is to set up the new fileserver (I’ve been preparing one for the last month or so, to replace the 4-year old “riogrande” server, also in the attic) to print this “good morning” greeting every day at – say – 7am. I’d like to combine it with my daily schedule (iCal) and todo list (through TaskPaper, easily done).
Thanks for the tip, Jeremy! I haven’t spent a dime and I’m one great gadget richer!
March 2nd, 2009 on 3:18 pm
[...] Original post by Kenneth’s Blog [...]