This tutorial will run you through setting up a Raspberry pi that automatically launches a customizable dias-show from an external drive when booted.

What you will need

  • Raspberry Pi w/screen, mouse, keyboard and powersupply
  • 16gb micro SD card for Pi OS
  • USB Flash drive for media files

 

Setting up the Pi

  • Download the Raspberry Pi Imager Software and install the latest Raspberry Pi OS on your SD card
  • Boot the raspi and follow the setup wizard.
  • From the desktop go to pi > preferences > raspberry pi configuration > display and disable screen blanking:

  • Install feh and xscreensaver by running the following commands in the terminal:

sudo apt-get install feh

sudo apt-get install xscreensaver

  • From the desktop go to pi > preferences > screensaver. From the ‘mode’-dropdown menu click Disable Screen Saver.

  • Insert USB flash drive with photos and launch a slideshow using the following command:

feh -Y -x -q -D 7 -B black -F -Z -r /media/

Useful parameters to alter:

NB: To see full documentation from feh: Type ‘man feh’ in terminal.

Exit a running slideshow by pressing esc.

Configuring automatic launch on boot

In order to launch the slideshow automatically we need to setup a simple script that automatically runs after booting. The script should run a few seconds after booting has finished to ensure that the USB flash-drive is registered. We will achieve this by combining the time and os -modules in a python script.

  • Create a new python file in the home directory using Nano:

sudo nano slideshow.py

Type the following python script (without the dashes) and hit ctrl+s and ctrl+x to save and exit Nano

__________________

# !/bin/python
import time
import os

print(“Slideshow running soon…”)
time.sleep(10)
os.system(“feh -Y -x -q -D 7 -B black -F -Z -r /media/”)

while 1:
    time.sleep(1)

___________________

  • Check that your script works by opening a terminal and typing the following command:

python slideshow.py

hit esc to exit the slideshow and exit the python script with ctrl+c

  • Access autostart by typing the following command in the terminal:

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

  • Add the following line and hit ctrl+s and ctrl+x to save and exit Nano:

@sudo python3 slideshow.py

 

Thats it! Reboot your Pi to make sure the slideshow is launched.
Remember that 10 seconds will pass on the desktop before the slideshow launches!