Subscribe to RSS feed - electronic brain surgery since 2001

DIY Digital Picture Frame

As you may have noticed, Kaddi and I take lots of photos on our vacations. But what good are vacation photos if you never look at them? So when we redecorated the living room recently, we wanted a way to incorporate our pictures as wall decoration. So we were looking to buy a digital picture frame…

We probably ordered every model Amazon has on offer and holy shit are they crap. Not only are they all cheap plastic, they also have horrible resolutions, weird software and sometimes simply not even work. The only decent model we found was the Nix Advance 10 inch. If you want to buy one, get a Nix model.

However even though the Nix 10“ worked fine, we wanted something we could mount to the wall and that looks like an actual frame. So I built it myself.

I went to AliExpress and ordered a bunch of parts. Delivery was surprisingly fast – after only a month everything had arrived. Only three parts I ordered from German online stores: the Raspberry (because it wasn't cheaper in China), the power supply (because I don't want an accidental fire hazard) and the framing mat (because I needed it custom cut). The latter was not of the quality I would have liked, but it works for now. I also bought the wood and paint in a local hardware store.

Here's the complete part list:

10.1 IPS Panel 46.75€
Raspberry Zero W + shipping 17.61€
HDMI cable 3.42€
PIR Sensor 0.95€
12V to 5V Converter 4.24€
DC Jacks 10x 1.36€
DC Connectors 10x 3.61€
12V Power Supply 13.99€
Framing Mat + shipping 8.90€
wood and paint apprx. 20.00€
Total 120.83

I ended up with nearly exact the same price as the Nix, but with the additional benefit of having WiFi in the frame, which the Nix hasn't.

I didn't take a whole bunch of pictures during the assembly. But it was relatively straight forward.

  • assemble the frame
  • drill a hole for the PIR sensor
  • put in the framing mat
  • use some cardboard glued to the framing mat for aligning the display
  • use a particle board to attach the electronics
  • connect everything
  • use pins to fixate the particle board in the fram

On the software side, nothing too special either.

  • install Raspian light and set up the wifi
  • install some minimal xserver requirements: sudo apt-get install xserver-xorg xinit x11-xserver-utils lightdm
  • run raspi-config to adjust locales and boot into desktop by default

At that point the raspi should boot into an empty desktop with a single xterm open.

Next, we need two things. First, a script that will switch off the display when no movement has been detected by the PIR sensor for a while. I cobbled the following together:

import RPi.GPIO as GPIO
import time
import threading
from subprocess import call
PIR_PIN = 18
TIMER = None
def handleEdge(pin):
    if(GPIO.input(pin) == 1):
def handleMotion():
    global TIMER
def handleAbsense():
def stopTimer():
    global TIMER
    if TIMER:
        TIMER = None
def startTimer():
    global TIMER
    TIMER = threading.Timer(TIMEOUT, handleShutdown)
def handleShutdown():
    global TIMER
    TIMER = None
def main():
    GPIO.setup(PIR_PIN, GPIO.IN)
    GPIO.add_event_detect(PIR_PIN, GPIO.BOTH, callback=handleEdge)
    # main loop
    while True:
if __name__ == "__main__":

This assumes the PIR sensor is connected to GPIO 18. It uses the vcgencmd tool to switch the HDMI display on when motion is detected and off when no motion has been seen for 10 minutes.

Next we need to automatically run a photo slideshow and the above script when the raspi boots. For displaying the pictures we use feh. So install that first: sudo apt-get install feh.

Then create an .xsession file:

# disable screensaver
xset s noblank 
xset s off 
xset -dpms
# use PIR sensor to turn on/off display
/home/pi/ &
# start slideshow
feh -F -Z -z -D 120 --auto-rotate photos/

That's it. Put some pictures into /home/pi/photos, reboot and you're done.

diy, raspberry, electronics
Similar posts:
Posted on Saturday, May the 12th 2018 (2 weeks ago).


blog comments powered by Disqus