Friday, January 9, 2015

New Toy

One of the things on my list of long-term projects is a DIY book scanner. There are a ridiculous number of paper books in my house, and I'm getting old enough to think about downsizing the living quarters at some point. Lots of people have done impressive things in the field, like this one. Being who I am, though, I want a system where the hardware is simpler and smaller, even if that means that the software has to be somewhat more competent. The rough rule-of-thumb of "put everything possible into software" served me well for 25 years in a high-tech field, and I'm not about to give it up.

The usual camera people put into a DIY scanner is either an old smartphone or an old snapshot grade digital camera.  Those are cool, particularly if there's one or both readily at hand.  My own experience with them, at least with a book scanner in mind, is getting them to take the picture when I want it, and to get the picture out of the camera into a computer where it can be worked on.  One a different tack, I've also been wanting to spend some time playing with a Raspberry Pi computer.  Hoping to get two birds with one stone, I purchased a Pi (model B+), a micro-SD card that would let me set up Raspbian easily, and a five mega-pixel camera module.

After going through the old electronics box, I plugged a monitor into the HDMI port, a keyboard and mouse into two of the USB ports, plugged in an Ethernet cable to tie it to the switch in my office and powered it up.  Looked like... Linux.  I felt like the little girl from Jurassic Park: "It's a UNIX system.  I know this!"  The second day I put all of the old electronics back in the box and just ran "ssh -Y" with the appropriate options from my Mac. I haven't gone very far with the camera yet, besides configuring the Pi to use it and verifying that it works. On the other hand, I have spent some time entertaining myself by porting a variety of small software that I've written over the years to the Pi.  Just to see how things went. And "porting" implies that the process was harder than it actually was.

After fooling around for a bit, I copied part of my collection of cartogram software over to it. One of the core pieces is written in C – after downloading a couple of needed libraries (using the provided Debian aptitude and apt-get commands), those just compiled. My front- and back-end code that sets things up for those core number-crunching programs is written in Perl – had to download the GD module, but that also just worked. Copied over some data and map files and ran things and – cartograms! Things ran pretty slowly, but the chip doesn't have the kind of heavy-duty double-precision floating point hardware support that "real" processors provide.

I'm looking forward to seeing how much of the job can be done on the Pi.