Digital Picture Frame & Clock on the Framebuffer!

dpfBeen wanting to have a go at this for a long time, and finally found some time to sit down and hack my way through it. Everyone else on the web seems to have used X to do this, but encouraged by all the work done on the cli and framebuffer by KMandla I felt this could be done. Now I’ve done all the hard work, I am happy to share it with you!

My target is a 15 year old laptop, my trusty Dell Latitude CPt 333mHz. cptThis comes with Neomagic (?!) video and audio and provides a VESA framebuffer of 1024 x 768 @ 75mHz, which fills the screen nicely. I had modded the laptop, it now has a full 192mb of ram (max) and I have replaced the very noisy 20gb HDD with a silent Compact Flash conversion. It is capable still of running cli or very light linux distros like Slitaz.

The laptop is still in good running order, and everything works, so I have no plans to dismantle it, I’ll have to make a frame with a bottom section for the base/keyboard.

If you are interested, here is the lshw output: lshw

For this purpose, I decided to install a cli Ubuntu, so grabbed the mini.iso for 12.04.2 from the interweb, burned to CD and got installing. After selecting the repository mirror, I thought the installation had crashed as it spent a good 20 minutes thrashing the cpu, but it was just grabbing all the files from the server. Eventually after a couple of hours, all was installed and I was able to boot into my new install and login.

A few programs needed: fbi, screen, mplayer, fbgrab, fbset, so set about installing them. Created a Pictures directory under home, and filled it with @ 100 images, all jpg. I used convert on my main pc to resize all the images to 1024×600. Something like this:

Then edit

, and add your main user to the video and audio groups (saves having to runs things as sudo to access the framebuffer)

dpf1My first intention was to use fbi for displaying the images, this had the capability to generate a random slideshow, but I could not find a way to overlay a clock on the images. The only thing I did try was running a clock on one vt, then switching to another vt where the images were displaying. A simply while [ true ] script using sleep and chvt automated this. Not great, as one could guarantee that whenever you looked up to check the time it would be in an image! fbi didn’t like being invoked from within screen, which meant I couldn’t use it with multiple regions.

Therefore I turned to mplayer, which I knew could be invoked from screen, and could play a slideshow of images. After a lot of hacking, I got to the command I needed:

Let’s break this down:


ensures the slideshow just keeps on going until I intervene


places the image display to the top and left of the screen


the location of the images


timer to change the image every 50 seconds


indicates the type of images used


remember the framebuffer screen was 1024 x768, well this scales the images to 1024×600, which leaves a gap of 118 pixels at the bottom of the screen (more on this later).


cuts down mplayer chatter, which can bleed through the images onto the framebuffer

So far so good, this bit works, only thing to sort out is how to randomise the files. I found a simple little script that I think will do the job:

Next I needed a clock!

A quick trip to Kmandla’s wiki sorted me out here. tempted by the binary clocks, I went for two more straight forward ones: vtclock and tty-clock. Got these downloaded and compiled, and finally plumped for tty-clock given it was in colour and stood out more against the screen. I needed to get tty-clock to present itself in the bottom 118 pixels of the screen, at the same time as mplayer was doing it’s thing up above. Introducing gnu screen, a sort of multiple terminal within a terminal.

Setting up screen to do what I wanted took a fair bit of googling and fiddling but I got there in the end. Idpf3 setup the .screenrc file to create four regions (horizontal split) with the clock in the bottom region, and then to run the player command in the top one. Not sure I fully understand how the focus command works, but it does what I want! I found the resize command later, which might mean onl;y having to use 2 regions. The other clever but was to add a string to the caption (the white bar on show for each region, and to paint the foreground and background black. The caption lines are still there, but the same colour as the terminal background. Result!

.screenrc:

The clock parameters: -s (show seconds) -c (centre on screen) -C 2 (green text)

In order to run the slideshow and clock, all I now had to do was type screen on the command line, and away it went.

Now to automate the whole thing and build a box for it!

Note: you may have noticed that a couple of the screenshots are showing artifacts. This seems to be due to the type of jpg I have used in some circumstances, doesn’t happen with the animals images I have used? Some research may through up some specific settings for the jpgs?

4 thoughts on “Digital Picture Frame & Clock on the Framebuffer!

  1. Pingback: Automating Framebuffer Digital Photo Frame | METRIC RAT

  2. Pingback: Bonus: Tim’s combo picture frame and clock | Inconsolation

  3. Pingback: Fullscreen Browser Slideshow with Clock | METRIC RAT

  4. Pingback: Digital Slideshow and Clock – Conky / Lua | METRIC RAT

Leave a Reply

Your email address will not be published. Required fields are marked *