tl;dr
I created a Wi-Fi enabled picture frame using an old monitor connected to a Raspberry Pi Zero W running slide with ability to turn off an on remotely. This should act as an updated guide to this opensource.com guide, which works in Feb 2024.
Background
My wife and I recently received our wedding photos from our photographer, and they were incredible, so wanted to have them all on show in our flat. Looking on Amazon new electronic picture frames are at least £50, and I had an old monitor lying around that I wanted to put to better use anyway.
Problem
Looking online for "best self-hosted picture frame software" leads to numerous half-baked (and unmaintained) projects, another vertical of app-enabled software that was way over the top for what I needed, and finally a set of tutorials that were significantly outdated or required to use of a specific storage solution (GDrive, BackBlaze buckets, etc). All I wanted was the screen to show a picture of our wedding, then 30 seconds later switch to another, all stored locally.
Solution
In the end I found this article on opensource.com which looked straight forward enough, though as it turns out was also outdated. I did really like the underlying software it used though, slide, so I persisted and created this article which acts as an update to the original one, to show how it works with a Raspberry Pi Zero (or any Raspberry Pi for that matter) in 2024.
Below I will go through the setup of the Pi, install off the software, and how to turn the screen on and off periodically/ remotely.
Gather materials
The following materials will be needed to complete the project:
- Old monitor
- Raspberry Pi - I have a Zero W, but anyone will work
- microSD card (or SD for older Pi models)
- Display cable - whatever cable and converted connects your Pi to your monitor
- Keyboard
- (Optional) Wi-Fi Dongle (not needed for my Zero W) Connect the Raspberry Pi to the monitor using the display cables.
Install the OS
To install the Raspberry Pi OS onto the SD card, I downloaded the right version from the official Raspberry Pi Operating system images page.
Important Note: Ensure that (a) your are downloading the correct image for your Pi (not all will work with all Pis) and (b) you are downloading the "with desktop" version. The latter ensures that all the graphical drivers are installed that will be required to display images. Once you download the correct image (in my case, it was "Raspberry Pi OS with desktop"), install it using this guide onto the SD card.
Plug the microSD card into the Raspberry Pi, boot it up, and complete the initial setup, which includes creating a username, password, and setting the Wi-Fi credentials. For the remainder of the article, I will be using SSH to complete the setup, which needs to be enabled. Open the terminal (Ctrl
+ Alt
+ t
) and run sudo raspi-config
. From here, under Interface Options > SSH enable SSH. Connect to the Raspberry Pi using (for example) ssh pi@<ip_address>
from another computer.
Add the pictures
You can add pictures to the Pi in any way you want, but I simply placed all of our photos onto a directory /home/pi/pics
using scp
from my main PC.
Install and setup slide
Same as the original tutorial, I use slide to run the slideshow of the pictures on the frame. Go to the releases page on the projects GitHub and check for the latest version to use in the commands below (at the time of writing that is 0.9.13, so that is what I will use).
Run the following to download and extract the executable and place it in the users bin
directory.
wget https://github.com/NautiluX/slide/releases/download/v0.9.13/slide_pi_0.9.13.tar.gz
tar xf slide_pi_0.9.13.tar.gz
mv slide_0.9.13/slide /usr/local/bin/
Before running it, you will need to install the dependencies, as not all required libraries are shipped with the binary. The original tutorial required the installation of qt5-default
, however this is no longer available in Debian bookworm, instead run and install the following (thanks to JonB's forum post):
sudo apt install libexif12 qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
To test that everything works, run the following, changing the path to wherever your images are stored:
DISPLAY=:0.0 slide -p /home/pi/pics
DISPLAY=:0.0 is needed to ensure that QT5 uses the connected display rather than the SSH session.
Start the slideshow on boot
The slideshow should start when the Raspberry Pi boots, so the following commands should be run:
mkdir -p /home/pi/.config/lxsession/LXDE-pi/
vi /home/pi/.config/lxsession/LXDE-pi/autostart
Add the following content to the file:
@xset s noblank
@xset s off
@xset -dpms
@slide -p -t 30 -o 200 -p /home/pi/nextcloud/picframe
To stop the Pi from blanking the screen after 10 minutes of inactivity, open /etc/lightdm/lightdm.conf
and add the following at the bottom:
[SeatDefaults]
xserver-command=X -s 0 -dpms
Turn off the monitor
To save electricity and not have the monitor on 24/7, the best way is to switch off the Pi's video output, which should then place the monitor is automatic stand-by/ power save. This also ensures the Pi is not turned off, as it does not consume much power and it takes a while (at least for the Pi Zero W) to boot up. For this, the xrandr
command, which I will show below, can be schedule via crontab or remotely. You will need the name of the HDMI/ display port, which you can get by running DISPLAY=:0.0 xrandr
(via the SSH session); my output is as follows, showing the name being HDMI-1
:
pi@raspberrypi:~ $ DISPLAY=:0.0 xrandr
Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 2048 x 2048
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 480mm x 270mm
1920x1080 60.00*+ 50.00 59.94
1920x1080i 60.00 50.00 59.94
1680x1050 59.88
1400x1050 59.95
1600x900 60.00
1280x1024 75.02 60.02
1440x900 59.90
1280x800 59.91
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 75.03 60.00
800x600 75.00 60.32
720x576 50.00
720x480 60.00 59.94
640x480 75.00 60.00 59.94
Toggle monitor via crontab
To schedule the display via crontab, run crontab -e
and add the following lines to turn on at 7:00 (AM) and off at 22:00.
0 22 * * * xrandr --output HDMI-1 --auto
0 7 * * * xrandr --output HDMI-1 --off
Toggle monitor remotely
To remotely turn the monitor on and off, you can use the following SSH command:
ssh pi@<ip_address> 'DISPLAY=:0.0 xrandr --output HDMI-1 --auto' #turn on
ssh pi@<ip_address> 'DISPLAY=:0.0 xrandr --output HDMI-1 --off' #tunr off
I have used this to allow Home Assistant to control the monitor based on a schedule and other automations.
References
Manuel Dewald - How to build a WiFi picture frame with a Raspberry Pi (opensource.com)
Qt Forum - Issue with sudo apt-get install qt5-default
Raspberry Pi Forums - STICKY: How to use Autostart - Raspberry Pi OS (Desktop)
Raspberry Pi Forums - Re: vcgencmd display power 0 doesn't work more relevant in bookworm