Projects / Digital photo frame

Digital photo frame

Beginner2 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. Pi 4RASPBERR

    Flash the Pi

    Raspberry Pi OS with desktop.

  2. Pi 4

    Install feh

    Test a slideshow of a few photos.

  3. Pi 4

    Auto-start

    Add the line to the desktop's autostart.

  4. Pi 4

    Add photo sync

    Copy from a computer with rsync.

  5. Pi 4

    Add the night schedule

    Cron lines for off and on.

  6. Pi 4motion

    Add the PIR

    Wake the screen on movement.

  7. Pi 4

    Build the frame

    Wooden frame with vents at the back.

In short

How do you build a digital photo frame?

A Pi and a 7-inch screen show photos from a shared folder, turning the screen off at night. You need Raspberry Pi 4 Model B (4 GB), SanDisk microSD card 32 GB (A1, Class 10), Raspberry Pi 27 W USB-C power supply, 7 inch HDMI display (1024x600) and PIR Motion Sensor HC-SR501. It takes 7 steps and about 120 minutes.

Level
Beginner
Time
About 120 min
Parts
5

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Display HDMIPi micro-HDMI (through an adapter cable)Picture
Display USB (touch or power)Pi USB portPower for the display if it needs it
PIR VCCPi pin 2 (5 V)Power
PIR GNDPi pin 6 (GND)Ground
PIR OUTPi pin 11 (GPIO17)Motion signal
Pi USB-CRaspberry Pi power supplyPower

Code

feh is a light image viewer that runs a slideshow from a folder and re-reads the folder every 10 minutes, so new photos appear without restarting. Share the photos by copying them from a computer with rsync on a schedule; use an SSH key set up for this purpose and never type or store a password in the crontab. The two cron lines turn the screen off at 23:00 and on at 07:00, and the PIR script wakes it when someone walks past; on the newer Wayland desktop use wlr-randr to switch the output instead, as vcgencmd may not work. Photos are personal: keep the frame on your home network and do not expose the folder to the internet. A frame in a wooden case needs ventilation holes behind the Pi, and the power supply should be kept out of the frame and strain-relieved. Check the display's own power needs: some 7 inch panels draw from a USB port, so use a good supply.

# Digital photo frame. Run on the Pi (Raspberry Pi OS with desktop). Not an Arduino sketch.
# 1. Install a slideshow viewer.
sudo apt update
sudo apt install -y feh rsync
# 2. Put photos in a folder.
mkdir -p ~/photos
# 3. Run a full-screen slideshow: 20 seconds per photo, random order, scaled to the screen, hide the pointer.
feh --fullscreen --auto-zoom --randomize --slideshow-delay 20 --hide-pointer --reload 600 ~/photos
# 4. Start it at login (current desktop, labwc): add this line to ~/.config/labwc/autostart
#      feh --fullscreen --auto-zoom --randomize --slideshow-delay 20 --hide-pointer --reload 600 /home/pi/photos &
#    (older desktops use ~/.config/lxsession/LXDE-pi/autostart; check your image's documentation)
# 5. Photos from a shared folder: copy from a computer on your network every hour with rsync, using an SSH key.
#      0 * * * * rsync -a --delete user@your-computer:/path/to/photos/ /home/pi/photos/
#    Add the line with: crontab -e
# 6. Screen off at night, on in the morning (legacy HDMI power control; on Wayland use wlr-randr instead):
#      0 23 * * * vcgencmd display_power 0
#      0 7  * * * vcgencmd display_power 1
# 7. Wake on motion: run this tiny script at login. Save as ~/pir_wake.py
#      from gpiozero import MotionSensor
#      import subprocess, time
#      pir = MotionSensor(17)
#      while True:
#          pir.wait_for_motion()
#          subprocess.run(["vcgencmd", "display_power", "1"])
#          time.sleep(60)
# 8. Resize large photos once to the screen size to save memory: install imagemagick and run
#      mogrify -resize 1024x600 -path /home/pi/photos/small *.jpg

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Power onSlideshow starts by itself
Add a photo to the shared folderAppears within an hour
At 23:00Screen goes off
Walk past at nightScreen wakes for a minute

If it does not work

Black screen after the schedule

Check the display power command for your desktop.

Photos stretched

Use auto-zoom and a matching aspect ratio.

Slideshow slow

Resize photos to the screen size.

Sync does not run

Check the SSH key and the crontab line.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the digital photo frame?

Raspberry Pi 4 Model B (4 GB), SanDisk microSD card 32 GB (A1, Class 10), Raspberry Pi 27 W USB-C power supply, 7 inch HDMI display (1024x600) and PIR Motion Sensor HC-SR501.

How long does the digital photo frame take to build?

About 120 minutes for a beginner maker, in 7 steps.

How do I know the digital photo frame works?

Power on: Slideshow starts by itself. Add a photo to the shared folder: Appears within an hour. At 23:00: Screen goes off.

Black screen after the schedule: what should I check?

Check the display power command for your desktop.

Photos stretched: what should I check?

Use auto-zoom and a matching aspect ratio.

Slideshow slow: what should I check?

Resize photos to the screen size.

Sync does not run: what should I check?

Check the SSH key and the crontab line.