Pinterest Stumbleupon Whatsapp

Digital photo frames are certainly nice to look at, but they can be rather inflexible, and family photos can be a little … well, boring. But if you add a screen to a Raspberry Pi, you can make something quite unique, by overlaying photos from r/earthporn with “inspirational” quotes from r/showerthoughts (or any combination of your favorite subreddits).

muo-diy-digitalphotopi-frame3

Want to make your own dynamic, digital, Raspberry Pi-powered talking point? Read on.

Prepare Your Pi

You’ll need to have the latest version of Raspbian 5 Ways New Raspbian Jessie Makes Raspberry Pi Even Easier to Use 5 Ways New Raspbian Jessie Makes Raspberry Pi Even Easier to Use Following the release of Debian Jessie in July, the Raspberry Pi community has been blessed with a new release of the Raspbian variant, based on the "parent" distro. Read More  installed for this project, so if necessary download and write to your SD card How To Install An Operating System To Your Raspberry Pi How To Install An Operating System To Your Raspberry Pi Here's how to get a new OS installed and running on your Pi – and how to clone your perfect setup for quick disaster recovery. Read More . Once you’ve done that, take the time to setup wireless networking How to Setup Wi-Fi and Bluetooth on the Raspberry Pi 3 How to Setup Wi-Fi and Bluetooth on the Raspberry Pi 3 We finally got wireless and Bluetooth capabilities built-in on the Raspberry Pi 3, but how do you set it up? Read More and enable SSH Setting Up Your Raspberry Pi For Headless Use With SSH Setting Up Your Raspberry Pi For Headless Use With SSH The Raspberry Pi can accept SSH commands when connected to a local network (either by Ethernet or Wi-Fi), enabling you to easily set it up. The benefits of SSH go beyond upsetting the daily screening... Read More .

With all of this done and correctly configured, ensure that you have connected your Pi successfully to the intended display. This might be an old laptop monitor, a disused tablet or Kindle reader, or one of the displays designed for the Pi How to Setup Your Raspberry Pi Touchscreen How to Setup Your Raspberry Pi Touchscreen The Raspberry Pi comes with a variety of useful add-ons, but one piece of kit that has proved particularly popular is the Raspberry Pi 7-inch Touchscreen Display. Here's how to set one up. Read More .

muo-diy-digitalphotopi-expandfs

You should also take the steps required to expand the Raspberry Pi filesystem. This can be done in raspi-config in the command line What You Need to Know About Getting Started with Raspberry Pi What You Need to Know About Getting Started with Raspberry Pi The Raspberry Pi computer is the latest in a line of compact, multi-function devices, shipped as a barebones package so that end users can use the hardware for virtually any computing project that comes to... Read More or in the Menu > Preferences > Raspberry Pi Configuration box on the desktop.

Getting Content from Reddit

muo-diy-digitalphotopi-frame2

Rather than cycle through some photos stored on your Pi, you can use a Python script to find images from the web. The Reddit channels r/EarthPorn (beautiful, stunning photos of the Earth, and totally safe for work!) and r/ShowerThoughts are great candidates, and you can download the code from this scul86’s Github page. Download ep_st.py, ep_st.config and template.html and save all three files into the same location on your Raspberry Pi (perhaps home/pi/Frame), before editing ep_st.config:

sudo nano /home/pi/Frame/ep_st.config

Here, look for the text headed [FILEPATHS] and change these to match the location where you have saved the three files. If you’re not sure what the full filepath should be, cd into the file in the command line, and type pwd.

muo-diy-digitalphotopi-config

Note that you can also adjust the subreddits from which the script pulls text and images, though we’d suggest leaving them at the defaults for now.

When you’re done, hit Ctrl + X, then Y to confirm the changes.

Next, you need to install praw, a Python wrapper for the Reddit API. Install this with

sudo pip install praw

Wait while this is done, and then turn your attention to giving the ep_st.py the necessary permissions:

sudo chmod 777 /home/pi/Frame/ep_st.py

You should then make the file executable:

sudo chmod +x /home/pi/Frame/ep_st.py

To test the slideshow, cd into the Frame directory and run

python ep_st.py

muo-diy-digitalphotopi-python

In the GUI, browse to the Frame directory and find the newly-created ep_st.html. This is the result of the Python script and the settings you specified in the config file, so open this to see the results. The page is set to automatically refresh, and should update itself whenever a new inspirational image is created. If you’re worried about filling up your Pi drive space with these, don’t be: the images aren’t actually downloaded, it’s just creating an HTML file that points to them remotely (probably an IMGUR url) with a textual overlay.

At this stage, all that is left to do is set the slideshow to launch automatically when you boot your Raspberry Pi. To make this happen, we need the Python script to run, and the HTML file to open.

Begin by installing and configuring a browser. We’re going to use Midori, but you can select and configure pretty much any Pi-compatible browser.

First, open sudo raspi-config and Disable Overscan. Then, install the browser:

sudo apt-get install midori x11-xserver-utils matchbox unclutter

Next, open nano to create a script:

sudo nano /home/pi/fullscreen.sh

Here, enter the following:

unclutter &

matchbox-window-manager &

midori -e Fullscreen -a [URL]

Substitute [URL] with the webpage you wish to load at boot. For our ep_st.html file, saved in the /home/pi/Frame subdirectory, the line would read:

midori -e Fullscreen -a Frame/ep_st.html

Save this with Ctrl + X and confirm with Y.

Next, make it executable with

sudo chmod 755 /home/pi/fullscreen.sh

You should then edit the autostart file:

sudo nano ~/.config/lxsession/LXDE-pi/autostart

At the end of the file (you may have some lines in here already from the setup of your Pi’s touchscreen display How to Setup Your Raspberry Pi Touchscreen How to Setup Your Raspberry Pi Touchscreen The Raspberry Pi comes with a variety of useful add-ons, but one piece of kit that has proved particularly popular is the Raspberry Pi 7-inch Touchscreen Display. Here's how to set one up. Read More ) add:

@xset s off

@xset -dpms

@xset s noblank

@/home/pi/fullscreen.sh

Save and exit, then edit the rc.local file:

sudo nano /etc/rc.local

Here, add a new line above exit 0:

su -l pi -c startx

Save and exit, then reboot.

sudo reboot

Keeping the Lights On

By default, the Pi display — whatever display is connected — will be switched off after a few minutes of inactivity. We can deal with this by connecting via SSH (or using the Terminal if you have a keyboard plugged in) and editing the lightdm.conf file.

sudo nano /etc/lightdm/lightdm.conf

Find [SeatDefaults] (the brackets are included; you’ll find it towards the end of the file) and add this line under it:

xserver-command=X -s 0 -dpms

Save and exit with Ctrl + X and reboot:

sudo reboot

Your Own Inspirational Digital Picture Frame!

Let us know in the comments how this project went for you! Have you stuck with the defaults, or did you find some other sub-reddits that work well together? Or did you run into problems? Whatever happened, whatever you’ve done with this project, tell us about it in the comments!

  1. David G
    October 5, 2016 at 2:10 am

    Is there anyway to make the fullscreen.sh script run without setting it up to autostart. Whenever I try it returns this:
    unclutter: could not open display
    matchbox: can't open display! check your DISPLAY variable.
    Midori - Cannot open display

    I want to be able to run it thru crontab so I can have a different script run part of the day.

  2. butch
    July 29, 2016 at 2:01 am

    Did MDM's issue get resolved? I'm working my way through this tutorial and I'm getting the same error. Any assistance is greatly appreciated. I'm a bit of a noob.

    raspberry pi 3.

    • Christian Cawley
      July 31, 2016 at 6:49 pm

      This is frustrating as at present I can't remount the project as I'm working on something else.

      Have you run it as python ep_st.py, or with sudo?

      Is Python up to date on your system?

      The system used in preparing the tutorial was running an older image of Raspbian but on a Raspberry Pi 3, if this is of any help to anyone. As soon as I can get the current project finished, I'll start working through this again.

      • Chris Mckinley
        July 31, 2016 at 11:45 pm

        I ran it as the tutorial states. python ep_st.py

        Apologies as I'm a total noob, first pi, first project. I do understand some command lines, I'm just not very familiar with linux or python. Thank you for looking into this.

        Raspberrypi 3 Model B. I'm not sure if python is up to date with the system or not. Any advice on how to check?

        • Chris Mckinley
          July 31, 2016 at 11:56 pm

          The pi says it's running python v 2.7.

        • Chris Mckinley
          August 1, 2016 at 12:17 am

          After digging around, if I type in python --version, I get 2.7.9

          If I type in python3 --version, I get 3.4.2

          neither will allow the script to run, even if I do python3 ep_st.py

        • Chris Mckinley
          August 1, 2016 at 1:21 pm

          Issue resolved using the advice- "make sure you have the module installed with "sudo pip install configparser" or whatever the name is that it says you're missing."

      • mdm
        August 4, 2016 at 3:27 am

        Yes was all up to date, tried sudo as well

  3. mdm
    July 28, 2016 at 1:13 am

    Sorry ignore last comment long day, the following command

    python ep_st.py

    • Christian Cawley
      July 28, 2016 at 7:34 am

      Okay, what do you have on line 23? is this a line you've edited?

      • mdm
        July 28, 2016 at 8:43 pm

        Did not edit that file at all, as i did not see any instruction to.
        Line 23
        import configparser

        • Christian Cawley
          July 29, 2016 at 7:38 am

          Fair enough. Really don't know why it wouldn't work unless there was a problem.

          Have you tried re-downloading?

        • mdm
          July 30, 2016 at 5:18 pm

          Have attempted on several different pi's

        • butch
          July 29, 2016 at 10:44 am

          I'm having the same issue. Did you find a resolution?

        • Chris Mckinley
          July 29, 2016 at 10:47 am

          I'm having the same issue, did you find a resolution?

  4. mdm
    July 28, 2016 at 1:12 am

    Very sorry forgot to include that

    When running this command

    sudo nano /home/pi/Frame/ep_st.config

  5. Christian Cawley
    July 27, 2016 at 7:04 am

    At what stage does this occur, mdm?

  6. mdm
    July 27, 2016 at 2:50 am

    Getting an error

    Traceback (most recent call last):
    File "ep_st.py", line 23, in
    import configparser
    ImportError: No module named configparser

Leave a Reply

Your email address will not be published. Required fields are marked *