Skip to content

Instantly share code, notes, and snippets.

@tom-henderson
Created February 20, 2013 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tom-henderson/4993163 to your computer and use it in GitHub Desktop.
Save tom-henderson/4993163 to your computer and use it in GitHub Desktop.
Minimal slideshow display for raspberry pi. Install the Arch Linux image to your SD card, boot the Pi with a display attached to the HDMI port, then run this to get set up. To customise: Copy your slides into /root/slides. Edit slide changing schedule by editing the root crontab. Edit /root/startup-slide to set the slide that displays on startup…
#!/bin/bash
# From newly installed arch linux image
# Based on instructions from
# http://www.techrepublic.com/blog/opensource/how-to-create-photo-slideshows-with-as-little-software-as-possible/3716
# update and install requred packages
pacman -Syy
pacman -S fbida ttf-inconsolata
# Set timezone
ln -sf /usr/share/zoneinfo/Pacific/Auckland /etc/localtime
echo "Pacific/Auckland" > /etc/timezone
# create new directory to hold slides
mkdir /root/slides
# something to get started with
wget https://www.dropbox.com/s/3s9d3y8poh52utg/720p-test.gif -P /root/slides
wget https://www.dropbox.com/s/bz4pcugzg4g15cv/pi-desktop.jpg -P /root/slides
# Add bash script to show image
cat > /root/play-slide <<EOF
#!/bin/bash
killall fbi
/usr/bin/fbi -noverbose -a -T 1 $1
EOF
chmod +x /root/play-slide
# Script to select the slide to show at startup
cat > /root/startup-slide <<EOF
#!/bin/bash
# Select a slide based on the time of day.
TIME=`date +"%H"`
case $TIME in
0[0-9])
SLIDE="pi-desktop.jpg"
;;
1[0-6])
SLIDE="720p-test.gif"
;;
*)
SLIDE="pi-desktop.jpg"
;;
esac
/root/play-slide /root/slides/$SLIDE
EOF
chmod +x /root/startup-slide
# Add cron jobs to schedule images
# @reboot triggers a bit early, we need to wait 15 seconds or so
cat > /root/cron-jobs <<EOF
@reboot sleep 15 && /root/startup-slide
*/2 * * * * /root/play-slide /root/slides/pi-desktop.jpg
1-59/2 * * * * /root/play-slide /root/slides/720p-test.jpg
# etc
EOF
crontab /root/cron-jobs
rm /root/cron-jobs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment