Igor's Blog

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:
screenshot.jpg


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
#!/bin/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:
 /etc/lightdm/lightdm.conf
...
[SeatDefaults]
...
session-setup-script=/photos/cache/conky.sh
...




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...
 /photos/cache/conky.txt
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
TEXT
${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/.

-i

, , ,
About — I'm an enthusiastic software engineer and consultant interested in many fields including J2EE, programming, electronics, 3D printing, video games, wood working and gardening.
See my Resume for more information.
The views expressed in this blog are my own and not those of my employer.
comments powered by Disqus
My other posts you may like...
Programming, DIY, Games, Hacks, Tech and more.
Follow me on...
Current and Past Projects
See my Resume

Subscribe


RSS Feed

My Other Web Sites

Igor and Elise's Travels
Riverside Expressway Cam
StrFunc() Online
300 George St Blogumentary
Guru JSON-RPC Tester
Extrudifier Object Designer

Recent Blog Posts

Where to find the last item (Robbie's lost lyrics) in GravityFalls Lake level

Detecting print requests to print contents of a DIV with JavaScript

Using Google DFP with AdSense on responsive pages

How to change the email subject line in Gmail

Force PHP GD library to load JPEG images that have invalid data

How to uninstall Samsung Smart Switch from your Mac

Facebook adds weather forecasts but forgets to adjust them to your time zone

No sound or microphone when answering calls on an iPhone

Replacing the standard Odroid XU4 fan and heatsink

PHP PDO doesn't work binding multiple IN statement values

Recent Galleries

Space Food - Chocolate Ice Cream with Chocolate Chips

Legeod Star Wars AT-DP kit

DIY spare parts computer build with a RAIDMAX Anura case

Fake 'Lepin' brand Lego packaging

Hardwood garden bench with clear resin void filler

Fixing a 3D printer extruder that stopped heating up

Easily increase disk space in a Lenovo Ideapad 100S 14" laptop with an M.2 SSD

Making a multi-piece 3D printed solder spool holder stand

DIY indoor apartment grow light wiring

Good Friday Electronics fun Easter Bunny LED PCB Kit IBEABU-01.0

Top Categories

Blogs I follow

Matt Moores Blog
Georgi's FlatPress Guide
Perplexing Permutations
The Security Sleuth

Friends

RAWS Parts Online
Alpha Dimensions Hosting
Kristensen Photography
Ilia Rogatchevski
Travelling Fairy

Blog Activity

Blog Activity
Follow me on... 
     
...or subscribe for updates!

Don't show this again