Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ for more details.
A while back I wrote an entry on how to get the Lenovo LT1421 USB DisplayLink monitor working on a RaspberryPi. Now I took that a bit further and created a photo frame using the Raspberry Pi model A, a USB monitor and a bunch of software and some custom scripts.

This is part three of this blog post, if you haven't seen the first or second part, you can find them here: https://www.igorkromin.net/index.php/2015/04/06/raspberrypi-and-a-usb-monitor-combined-to-make-a-photo-frame-part-1/ and https://www.igorkromin.net/index.php/2015/04/07/raspberrypi-and-a-usb-monitor-combined-to-make-a-photo-frame-part-2/.

In the two previous parts I set up file sharing, the Xorg and window manager settings and the script to select a random photo. This part shows the full Conky setup required to get the display happening. As a reminder, this is a screenshot of what the Conky script aims to do:

I set up a script that would launch Conky for me. In addition this script turns off HDMI output on the Raspberry Pi because I'm using a USB monitor. Here it is:
 vi /photos/cache/conky.sh
tvservice -o
conky -d -c /photos/cache/conky.txt -X :0

Now to make Conky start automatically when the window manager is started, I added the following configuration to the lightdm config file:

Since I wanted to have the weather forecast displayed in the picture frame, I had to have a way of getting this information. I went for '1d' script from this post: Conky weather+moon scripts (Accuw/WUndergr/NWS/Lunaf.com). However, instead of having Conky execute the script itself, I put it into cron as well, like so (new weather details every 10 minutes):
 crontab -e
*/10 * * * * /home/pi/1d_accuweather_rss/1d

I also copied the ConkyWeather.ttf font file to the ~/.fonts directory.

...and now for the actual Conky script itself...
background no
font Ubuntu:bold:size=11
use_xft yes
xftalpha 0.9
update_interval 2
total_run_times 0
own_window yes
own_window_type desktop
own_window_transparent no
double_buffer yes
minimum_size 1366 768
maximum_width 1366
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color ffffff
own_window_colour 111111
alignment top_left
gap_x 0
gap_y 0
uppercase no
imlib_cache_size 0
${image /photos/cache/current.jpg -f 10}
${voffset 130}
${color aaaaaa}
${goto 1080}${voffset -180}${font Origami Mommy:size=20}Date/Time ${voffset -5}${hr 20}
${voffset 24}
${color ffffff}
${goto 1079}${voffset -80}${font Origami Mommy Pixellated:size=65}${time %d}
${goto 1233}${voffset -112}${font Origami Mommy Pixellated:size=39}${time %b}
${goto 1220}${voffset -25}${offset 58}${font Origami Mommy Pixellated:size=19}${time %Y}
${color bbbbff}${voffset -20}
${goto 1079}${voffset -18}${font Origami Mommy:size=60}${time %H}
${goto 1212}${voffset -90}${font Origami Mommy:size=30}:
${goto 1232}${voffset -61}${font Origami Mommy:size=60}${time %M}
${color aaaaaa}
${goto 1080}${voffset -180}${font Origami Mommy:size=20}Weather ${voffset -5}${hr 20}
${color 888888}
${goto 1080}${voffset -40}${font Origami Mommy Pixellated:size=20}Now
${goto 1075}${voffset -5}${color ffffff}${font Origami Mommy:size=13}${execpi 600 sed -n '1p' $HOME/1d_accuweather_rss/weather|awk -F: '{print $2}'}
${goto 1080}${voffset 5}${font conkyweather:size=70}${execpi 600 sed -n '2p' $HOME/1d_accuweather_rss/weather}
${goto 1160}${voffset -100}${font Origami Mommy:size=52}${execpi 600 sed -n '1p' $HOME/1d_accuweather_rss/weather|awk -F: '{print $3}'}
${color 888888}
${goto 1080}${voffset -155}${font Origami Mommy Pixellated:size=20}Today
${goto 1075}${voffset -5}${color ffffff}${font Origami Mommy:size=13} ${execpi 600 sed -n '4p' $HOME/1d_accuweather_rss/weather|awk -FC\ '{print $3}'}
${goto 1080}${voffset 5}${font conkyweather:size=70}${execpi 600 sed -n '5p' $HOME/1d_accuweather_rss/weather}
${goto 1180}${voffset -120}${font Origami Mommy:size=20}${execpi 600 sed -n '4p' $HOME/1d_accuweather_rss/weather|awk -FC\ '{print $2}'}
${goto 1180}${font Origami Mommy:size=20}${execpi 600 sed -n '4p' $HOME/1d_accuweather_rss/weather|awk -FC\ '{print $1}'}
${color 888888}
${goto 1080}${voffset -35}${font Origami Mommy Pixellated:size=20}Tomorrow
${goto 1075}${voffset -5}${color ffffff}${font Origami Mommy:size=13} ${execpi 600 sed -n '7p' $HOME/1d_accuweather_rss/weather|awk -FC\ '{print $3}'}
${goto 1080}${voffset 5}${font conkyweather:size=70}${execpi 600 sed -n '8p' $HOME/1d_accuweather_rss/weather}
${goto 1180}${voffset -120}${font Origami Mommy:size=20}${execpi 600 sed -n '7p' $HOME/1d_accuweather_rss/weather|awk -FC\ '{print $2}'}
${goto 1180}${font Origami Mommy:size=20}${execpi 600 sed -n '7p' $HOME/1d_accuweather_rss/weather|awk -FC\ '{print $1}'}
${goto 1080}${font :size=8}${color 555555}${voffset -27}Web: http://${addr wlan0}/

The image cache is turned off which should automatically refresh the current photo as soon as it's selected by the select.sh script, I do add a 10s refresh just in case though. The weather is updated every 600 seconds inside the script.

I've not bothered with clipping the forecast text, so sometimes it goes off the scree, when the forecast is especially long. I didn't think this would be a huge problem.

This is pretty much it. There is one extra part to this post coming up soon, in that post I describe how I added Apache to the mix so that the photo frame can be viewed in any web browser and controlled too e.g. turning off the screen, forcing the next photo to show up, etc. Keep and eye out for that post in the next couple of days.

Part 4 is posted now, check it out here: https://www.igorkromin.net/index.php/2015/04/15/raspberrypi-and-a-usb-monitor-combined-to-make-a-photo-frame-part-4/.


Hope you found this post useful...

...so please read on! I love writing articles that provide beneficial information, tips and examples to my readers. All information on my blog is provided free of charge and I encourage you to share it as you wish. There is a small favour I ask in return however - engage in comments below, provide feedback, and if you see mistakes let me know.

If you want to show additional support and help me pay for web hosting and domain name registration, donations, no matter how small, are always welcome!

Use of any information contained in this blog post/article is subject to this disclaimer.
comments powered by Disqus
Other posts you may like...