Archive for the 'hardware' Tag  

Computer hardware-modification and info.

Old Laptop –> Digital Picture Frame

November 16th, 2004

Filed under: Computers and Technology

Tags: , ,

Introduction

With the rapid increase of computer power and the growing software power-requirements that go with them, it is often easy to find old Pentium 100, 133, and 166 (or similar generation) laptops for little if any cost. Machines of this generation generally ran MS Windows 95, which can’t cope with new hardware such as wireless PC cards and such, limiting their usefulness. While machines are woefully underpowered for running a new version of MS Windows, they will often run just fine with Linux.

Sidenote: If you wish to use one of these old laptops as a “desktop computer” running Linux, then you would probably be best to use a light-weight window-manager such as ffwm or windowmaker instead of the KDE or Gnome window-managers that come as the defaults in most Linux distrobutions. Using a less resourse-intensive window manager can make these old computers quite usable, even “snappy”.

The laptop I am using for this Linux picture frame project is an old Dell Inspiron 3000 with a Pentium chip that I got for free since the battery had died and the keyboard didn’t work. It turns out that the keyboard works fine in Linux, just not in the MS Windows 95 that had been installed on the machine.

Even if you can’t find one of these for free, they can usually be had for VERY cheap. To save even more cost, look for ones with broken keyboards/dead batteries, broken touchpad, etc. Just plug in a PS/2 keyboard and mouse for the install, then access the machine through the network (ssh) after that.

The one addition I made to my laptop is a Xircom “Cardbus Ethernet 10/100 + Modem 56” PCMCIA ethernet card. All you generally need is an ethernet card that will work with Linux, for the purposes of the picture frame, speed isn’t much of an issue.

Software Overview

When searching around for info on turning a laptop into a digital picture frame, the tutorials I found all focused on modifying the hardware (removing extra plastic, mounting the screen, etc) and made just a passing mention to the software setup involved. This tutorial will start with software for several reasons:

  1. Its a lot easier to install Linux on a computer with a keyboard and mouse than on a stripped down motherboard/screen packed into a picture frame.
  2. You might as well set up Linux and make sure that all of your hardware and software is working well together before modding the hardware. This helps isolate problems.

Operating System
I chose to put Xandros Desktop on my laptop for this project. I had initially tried a Knoppix hard-drive install of “straight” Debian, but had some problems with the network card or something. I don’t quite remember what the problem was, but I tried Xandros as well as replaced my network card with the above mentioned Xircom one. Xandros happend to be the distro that was on the machine when I got networking up, so I didn’t bother to change it.

The nice thing about Xandros is the good hardware detection, this can make for more painless OS installs if nothing else. The big caveat however is that my Xandros installation take up about 1G, half of my laptop’s little 2GB hard drive. A stripped down Debian install would leave more room with less manual cleanup.

You can use any Linux distribution to build your digital pictureframe, but the placement of a few of the initialization scripts may be different on a distribution such as Fedora or SUSE which are not based on Debian (as are Knoppix and Xandros Desktop).

Displaying the Pictures
I chose to use the “feh” image viewer for displaying a slideshow of the photos. “feh” has several big advantages:

  • Full-screen mode
  • Reliable image stretching
  • lots and lots of options for delays, sizing, ordering, etc
  • can be run from the command-line without needing a window manager (I’m not sure if this true of other slideshow programs or not)

Starting/Stopping the Slideshow
I wrote a few little-tiny bash scripts to call the slideshow and initiallize it. Their paths and contents are listed below in the like-named section.

Setting up the Display Software

Assuming that you have successfully installed and are running Linux on the laptop, install the “feh” program from LinuxBrit.co.uk. Also install the “unclutter” program to hide the mouse cursor after several seconds of inactivity.

In Debian, one would just use:
apt-get install feh unclutter

Make a script to start feh with the images from a certain directory
As mentioned in the use case above, I want to have feh automatically started with all the images in a folder. To be able to do that with one command, i put the following script at /usr/local/bin/slideshow.sh:

#!/bin/bash
# This file is located at /usr/local/bin/slideshow.sh
#
# Copyright 2004 Adam Franco
# Licensed under the GNU GPL v1.2+ (http://www.gnu.org/licenses/gpl.html)

killall feh unclutter

unclutter &

feh -zZFr -D 300 /home/afranco/Photos/

The options I used are as follows:

-z — randomize the order of images

-Z — zoom images to fit the window

-F — make the window full-screen

-r — recursively search the target directory for images

-D — Delay (in seconds) between images
Be sure to change “afranco/Photos/” to your actual image location.

If you now call “slideshow.sh” from a console in an X-session, feh should run.

Running slideshow.sh from the command-line without an X-session.

I wanted to be able to start the slideshow on boot, and to be able to restart/stop it with the cron schedualer or manually from a remote terminal. Even though I could set the KDE environment to automatically log in and start feh from within the X-session, that wouldn’t allow for easy enough control.

To start/restart the slideshow, I put the following script at /usr/local/bin/reloadslideshow.sh:

#!/bin/bash
# I put this file at /usr/local/bin/reloadslideshow.sh
#
# Copyright 2004 Adam Franco
# Licensed under the GNU GPL v1.2+ (http://www.gnu.org/licenses/gpl.html)

# make sure none of our parts are running and are in the way.
killall feh unclutter X kdm;

#run the slideshow
/usr/bin/X11/xinit /usr/local/bin/slideshow.sh &

In Xandros (and other distros that use a graphical login screen like “kdm”) it is important to free up the X-window so that you can put the slideshow there. This is accomplished by killing kdm and X. To prevent the graphical login screen from apearing at all on boot, remove all links that contain “kdm” from /etc/rc2.d/ and /etc/rc3.d/.

Starting the Slideshow on Boot

To start the slideshow on boot, I first made an init script in /etc/init.d/ to control the starting and stopping of the slideshow. Looking back, I could have put the scripts listed above right in this init script, but that wasn’t how I approached it, so I will leave it. Feel free to put the commands from the above scripts right into the init script instead.

The init script at /etc/init.d/picframe:

#!/bin/sh
# Start/stop the pictureframe
#
# Copyright 2004 Adam Franco
# Licensed under the GNU GPL v1.2+ (http://www.gnu.org/licenses/gpl.html)

test -f /usr/local/bin/reloadslideshow.sh || exit 0

export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin
export HOME=/root

case “$1” in
start) echo -n “Starting pictureframe”
# pass something to the mouse to wake up the display if its asleep
echo “Hello there mousey.” > /dev/mouse
echo “Hello there mousey.” > /dev/mouse
sleep 5
echo “Hello there mousey.” > /dev/mouse
setterm -blank 0
# The XF86Config-4 should have Option “BlankTime” “0”
# start the slideshow
/usr/local/bin/reloadslideshow.sh

;;
stop) echo -n “Stoping pictureframe”
killall feh X

# make sure the display will go to sleep
setterm -blank 1

;;
restart) echo -n “Restarting pictureframe”
/usr/local/bin/reloadslideshow.sh

;;
*) echo “Usage: /etc/init.d/picframe start|stop|restart”
exit 1
;;
esac
exit 0

Now that the init script is in place, the slideshow can be started with the command:

/etc/init.d/picframe start

and stopped with:

/etc/init.d/picframe stop

To get the start the slideshow on boot, make a link in either/both of /etc/rc2.d/ or /etc/rc3.d/. All of the links in /etc/rc2.d/ are called with “start” when booting into runlevel 2 or higher. The links in /etc/rc3.d/ are called with “start” when booting into runlevel 3 or higher. The runlevel is set in /etc/inittab. Anyway, I am running the machine at runlevel 3 and I made a link called “S99picframe” that links to my init scrip. The command to do this is:

ln -s /etc/init.d/picframe /etc/rc3.d/S99picframe

You can reorder the call sequence in the /etc/rcX.d/ directories, by renaming the links (they are executed in alpha-numeric order). The slideshow should now start on boot.

Starting and stopping on schedual with cron

I wished to save both power and screen-life by turning off the screen when I am asleep/not home. To do so, I put the following lines in my crontab:

0 2 * * * /etc/init.d/picframe stop > /dev/null
0 17 * * 1-5 /etc/init.d/picframe start > /dev/null
0 9 * * 0,6 /etc/init.d/picframe start > /dev/null

The first line stops the slideshow at 2am every night. The second one starts it every weekday at 5pm. The third line starts the slideshow every sunday and saturday at 9am.

Blanking the screen when the slideshow is stopped.

It seems that a user has to be logged into a local tty terminal on the machine and have “setterm -blank 1” run in order for the screen to be turned off when the slideshow is stopped. You could manually log in to a tty. Another way to do this is follow the directions on this site for automatically loging into a tty and running the setterm command. Alternatively, it may work to modifiy the terminial creation piece in /etc/inittab to just run the setterm command before showing the login prompt.

How I finally got the screen to blank automatically:

  1. Followed these directions for installing qlogin and the two libraries it needs.
    • Download qlogin into a convenient directory such as /usr/local/src/.
    • copy the “qlogin” program in the archive to something like /sbin/qlogin
    • Install the setgroups extention:
      …it comes with Qlogin. To build that, cd to the “setgroups” subdirectory
      in the Qlogin source tree, then

      perl Makefile.PL
      make
      make install

    • Download and install the User::Utmp perl package with the same commands as above.
  2. Edit /etc/inittab to make qlogin automatically log in to the first tty:
    replace
    1:23:respawn:/sbin/getty 38400 tty1

    with

    1:23:respawn:/sbin/qlogin –command=”/bin/bash” /dev/tty1 pictureframe
  3. Add “setterm -blank 1” to the rc.local file.

    If you are using Debian and therefore don’t have an rc.local file, you can make the equivalent as follows:

    • make a script with the following at /etc/init.d/local
      #!/bin/bash

      /usr/bin/setterm -blank 1 > /dev/console

    • make that script executable
      chmod a+x /etc/init.d/local
    • add that to the startup:
      update-rc.d local defaults 80
  4. Reboot and enjoy.

Hardware

Laptop with slideshow software running on it
My rule of thumb for the hardware side of this project was to do as little modification as necessary to achieve the desired form and function. My main reason for this is that I wished to retain as much of the basic functioning of a normal laptop as possible to facilitate future modifications and upgrades to my picture-frame system. By retaining the general laptop form-factor, keyboard, CDROM, etc, reinstalling the operating system, other devices, etc is much easier. As seen in the picture at right, I started this project in “laptop form”, getting the software working first for exactly this reason.

Hinge-end of the laptop showing extended cables.
Once I had gotten the software worked out as described in the sections above, it was time to modify the hardware of the laptop to get it into “picture frame” form-factor.

I was initially hoping to be able to simply unscrew the hinges and remount the display backwards so that it closed with the back of the screen on top of the keyboard, a la “tablet PC”. This configuration would be strong — since the screen would still be screwed to the body of the laptop, just backwards — as well as simple and extensible — since it could easily be returned to “laptop” form-factor.

Side-view of laptop with the screen epoxied to the bottom of the laptop. The hole seen is where the dead battery used to live.Unfortunately, the orange data-cable/strip (shown in the picture above/left) was not flexible enough to twist around to an inverted configuration. Since that wasn’t going to work, I decided just to pull the data-cable/strip out as far as it would go and epoxy the back of the screen to the “bottom” of the laptop with wood spacers to allow for airflow. In addition to the gluing, I had to solder a 3-inch extension into the display power-cable-bundle so that it could reach around the back of the laptop.

The display/laptop standing on a shelf with matting in front of it. The power and network cables are sneaking around behind the booksThe only remaining job is to obtain a frame and hang the display on the wall. In the mean-time I am just standing the machine on a shelf with a piece of matting leaning against it. The power and network cables that sneak back through the books on the shelf allow me to ssh into the display and update/change the pictures in the slideshow.