old laptop -> digital picture frame

What I wanted:
A digital picture frame that mounted on the wall so that all that was visible was the screen. It should have a copy of all the pictures I want to display on it on its drive, but stored only at the maximum resolution of its screen (in this case, 800×600). I should be able to use rsync to remotely synchronize the copy on its drive with my generated copy on my main machine (that’s generated from the full-res versions using a perl script I wrote called ImageSync a while back).

What I had:
I bought a 12″ laptop off craigslist for $100 2 years ago. It’s got a 475 MHz amd k6. The battery that came with it was no good, so I bought another for $75. When I plugged it in, it wasn’t even recognized. I thought it was the laptop that was broken and I took too much time trying several methods to get it to charge and be recognized, but now I wish I’d returned the battery for a refund. This laptop served me well as a second small desktop computer for a while, but last summer, I bought a desknote (a laptop sans a battery) without a processor, hard drive or memory for $230 (which took desktop-sized processors and ram but a laptop-sized hard drive, all of which I had already). So the old laptop has been sitting in a box under the bed for the last year. I finally decided to do something with it. The screen had no blemishes except for a lighting inconsistency at the top, so it was good for displaying pictures. The whole doesn’t-recognize-a-battery thing meant it wasn’t a good portable, so it would be happy hanging on a wall.

What I did:
So yesterday, I got it out and put some Damn Small Linux on it (a linux distribution that fits on a 50 MB cd-r). It booted fine, so I installed it on a spare 2 gig laptop hard drive I had and then set to work on getting the screen turned around. I wanted it to eventually look like just a regular picture frame, so it couldn’t be in normal laptop mode where if you can see the screen, you can also see the keyboard. To turn the screen around, I had to unscrew the display at the hinges, remove the brackets holding the hinges to the case, move them to the outside backside/underside of the case and then re-attach the hinged display to that, effectively putting keyboard and screen on opposite sides.

For the first bracket, I decided to cut the plastic on the underside so the metal bracket would fit in the smaller hole that existed on the underside of the laptop. This was unwise. It cracked the plastic in several places, making weak the part I needed strongest (to hold the display in an awkward position it wasn’t designed to handle). So, on the other side, I took a metal file and filed the bracket down a couple of millimeters and it is oodles stronger. To repair my mistake on the first one, I took a strip of aluminum and drilled three holes in it and screwed it in over the parallel port and put a third screw into the bracket to that it would have something to grip besides the 3 broken strips of plastic that were left. Here’s a picture of the aluminum bracket:
aluminum bracket

Below is one of the hinge brackets mounted mirrored to its original position (this is the second one I did where I filed the metal instead of ruining the plastic):
hinge bracket

The following picture is of the whole display mounted on the opposite side from where one is normally mounted on a laptop (you can see the aluminum bracket on the left in the picture below):
mounted display

Today, I opened the case up slightly to check that nothing important was in the way and I drilled 2 holes through from the battery compartment to the wrist rest area so that I could mount this digital picture frame on the wall. Square drive. Single-wall construction. Didn’t use a level, so it’s a bit crooked. Here’s how it looks right now:
mounted digital picture frame

software:
With all the hardware finished (except the sleek, finished wooden case I’ll probably never build for it), all that remained was the software. I’d found a program to display images on the frame buffer so that I wouldn’t have to start x windows (which takes time to load and uses up ram and is a bother to have automatically log in, etc) called fbi (probably initials meaning Frame Buffer Imagesomething). It took a while to get that compiled from Damn Small Linux. It needed no fewer than 5 other programs compiled and installed before it would compile and install. A pain, but straightforward at least. Download, unpack, ./configure, make, sudo make install. That’s it. The tricky bit was figuring out how to get it to start properly when the computer started up.

Fbi is neat because if there’s a picture that’s rotated the wrong way, you just hit R or L and it rotates it right or left. It auto-loads the next picture so there’s no visible flicker or delay between displayed pictures. It was a nice find.

gory details:
I thought I could just put it in /etc/init.d/rc.local or whatnot (whatnot=/opt/bootlocal.sh) and have it start when the bootup script was finished booting the computer. But then I realized that if it crashes or someone hits the quit button, it would be a pain to re-start the program (since the digital picture frame is now mounted with the keyboard facing the wall). So I knew /etc/inittab was the place to put it. If it went in there, init (the program in linux that runs all other programs) would make sure it was still running and if not (for whatever reason), restart it. Trouble with that was (and it took me a couple hours searching google to figure this out and try various ways to circumvent it) was that fbi (the picture viewer program) detached from the console immediately upon being run, init detected this, and re-ran fbi even though fbi hadn’t quit. This happens rather quickly (being a computer) and soon, you have 10 copies of the program running and more coming and it’s quickly steamrolling away from you. Luckily, some poor soul in unix/linux history ran into just this problem long ago and decided that if a program was respawning too quickly like this, something was wrong and it would stop itself from running any more copies and give you 5 minutes to figure out what went wrong and fix it. After a little thought (banging my head on the wall), I decided to write a quick bash script that produced a list of all running programs [ps], see if any of them were fbi [| grep fbi], and then only re-run fbi if it wasn’t running, which is only slightly different from the test init does (that in this case doesn’t work). So init runs my script (use init q to tell init to re-read /etc/inittab) and makes sure my script is always running. My script generates a list of all the files in the directory the pictures are kept, waits 60 seconds, checks to see if fbi is running, and if not, re-runs it and then quits. Fbi reads the list of files and starts displaying them with a 4 second delay between advancing to the next picture. If the user quits fbi or it program crashes, my script (which keeps being started by init) will re-run it, so at most, the screen will be non-picture for about 60 seconds.

notes:
I picked Damn Small Linux because I’d used it before and knew it detected hardware well and installed properly on a hard drive. Last summer, I installed it on another, crappier, older laptop with a functioning battery so that my girlfriend could bring it to her summer field school on the Big Island and have a computer for internet access. It doesn’t do wpa (wireless protected access), which meant that she could only use the internet for the first 2 weeks she was there while she was near an unencrypted network, the second 2 weeks being near a network that was wpa-only. Sadly, wpa is what my wifi network uses for security, and so a significant part of the effort for this project went into looking for a linux distribution that did do wpa as automatically as possible (my patience for figuring out how to do stuff on the command-line in linux wanes with each year that passes). I found a reference that said puppy linux did wpa, so I downloaded that and installed it and it seemed like it was almost working and then it didn’t. I also tried slax. That booted up fine, but then I read the documentation on the website for it and it said it really wasn’t the sort of distribution you installed on a hard drive. I tried geexbox, which is supposed to be a linux cd you boot up and have it play media files from your server, but this shit didn’t even boot up on the computer I tried it on. Just got some vertical colored stripes on the screen. Fucking linux. I want my money back. 🙂 So, I’m stuck with damn small linux because it works well enough to get the pictures displayed.

The walls here aren’t really yellow; they’re white. I had to set custom white-balance on a white-ish picture being illuminated from the ccfl backlight of the digital picture frame so the image would look nice in the image of the image on the digital picture frame. The side-effect was that the walls appear yellow because for some reason the fluorescents in the kitchen aren’t the same color temperature as the one in the laptop.

todo:
My algorithm is wrong. It shouldn’t re-create the list of files every 60 seconds (it does this at least this frequently). It has 96 megs of ram in it, so the whole dir structure is cached, but it’s still not a good way to do it. I’d think about it more, but the damn thing’s mounted to the wall with the keyboard facing the wall. It works well enough right now (it’s displaying my pictures right now for the last few months, even the ones I took of it while assembling it). If I had a spare pcmcia ethernet card (I have only one and it’s being used by another project right now) or a working wpa wifi setup or I disabled wpa on my wifi network (which I stubbornly refuse to do), I could tinker with it via ssh…

Another thing I need to work on is that there should be controls to pause the automatic slideshow advance or dim the display or tell the computer to shut down, etc. I had a ps2 numeric keypad in my box of computer parts that would have been perfect for this, but 2 weeks ago, I threw it away because I thought I’d never do anything with it.

Hanalei valley on Kau’ai

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: