Category Archives: SyncThing

DIY Digital Photo Frame

In previous posts I had been digitizing old family photos. This process was not simply to restore and preserve past memories but to turn into gifts for the Christmas season. I have over 6,000 new photos I’d like to put into some digital picture frames.

Pursuing online vendors left me wanting more. All sites were filled with poorly built or functioning frames. Some of the top search results on Amazon were products accused of buying all of their 5 star reviews. 800×600 resolution made me cringe as all of my scanned photos were large enough for poster size prints.

I decided I would venture a DIY route for these gifts. The tinkerer inside me knew I would be able to find a better way before Christmas. I originally looked into taking an old LCD monitor attached to a Raspberry Pi and placed into a shadow box, but the price quickly ballooned once all the pieces were tallied. I thought to myself, “Matt, why don’t you use a device that already has the LCD and computer built in together, like a tablet!”

I purchased a used Kindle Fire (first generation) and a Kindle Fire HD 7″ (second generation) and a used Nexus 7 (first generation) for some testing. I planned on stripping the device down out of it’s casing and place it into a thick picture frame instead of a larger shadow box.

The Fire has a resolution of 1024×600 at 169 dpi while the Nexus has 1280×800 at 216 dpi. Even though they were several years old they would be more than powerful enough to handle displaying simple pictures. Most of the pictures I scanned are all 4:3 either horizontal or vertical, so most of the screen wouldn’t be used when displaying an image on a widescreen display. The 8mm video I recorded would use this real estate though. The Nexus comes with a front facing camera, which I wanted to use as a proximity sensor to turn the display on and off depending on traffic walking by the frame.

To get the camera acting as a motion detector for the photo frame I had to string a few apps together. I used Motion Detector which raised “motion captured” events to Tasker which then could turn on the screen and launch the photo slideshow app. Tasker was also able to automatically get the picture frame functionality running when the tablet was powered on, making it more resilient after being powered off accidentally. Tasker also helped turn the apps off at night to save power. I used Cloud PhotoFrame EX.Net to display the slideshow. Even though it’s advertised as a cloud photo app, it worked just fine for local storage as well. I went through a few dozen slideshow apps until I settled on this one. It was the easiest to set up, had lots of display options, can play mp4 videos, and also had the ability to re-scan the photo folders for changes periodically. It has no ads and only asks to be reviewed once.

I wanted to be able to update the images on the frame automatically either over the internet or locally when visiting. I am unable to physically visit all of the recipients of the frames on a regular basis, and even when I can I don’t want to be messing around with opening up the frames and adding/removing pictures from SD cards. I decided to use Syncthing, an awesome service which uses the torrent protocol to sync files between multiple places. Syncthing allows both internet and local network connections. For recipients that don’t have wifi, I simply turn my laptop on at their house and wirelessly connect to the tablet. Syncthing finds the client running on the tablet and syncs the files between my local laptop and the tablet. Anything I add/remove from my local folder gets reflected on the frame automatically. At home I can add new pictures to a Syncthing folder, and they will be automatically pushed to any frame connected to the internet.

Getting the tablets into the picture frames required some modifications. I routed out the backsides of the frames to accommodate the size of the tablets. I centered the display inside the visible portion of the frame. I also removed the glass so the touchscreen could be used to flip to different pictures. I notched out areas around the charger port, power, and volume buttons so they could be manipulated without taking the picture out of the frame. I then used small pieces of sheet metal with screws to create “tabs” to hold the table in place. I used the back frame cover with kickstand to hold the tablet in place.

A rough fit test of the tablets inside the frames
A rough fit test of the tablets inside the frames

In the end it was a great success. It stole the show and the grandparents haven’t set it down since they got it on Christmas. I have noticed one negative downside from this. They’ve requested I scan in another box of pictures they found in the attic… 😐

Everytime they walked through the room they stopped for several minutes :)
Everytime they walked through the room they stopped for several minutes 🙂

Proxying Apache Connections to Multiple Applications

I was having issues getting Apache working with Plex, OwnCloud, and SyncThing at the same time on a new server. I wanted to have a reverse proxy set up, so instead of

I could have

Apache’s reverse proxy functionality caters to this need.
Each app gets its own ProxyPass, telling Apache what to do with incoming requests.
SyncThing didn’t like operating without a trailing slash in the URL, so a rewrite rule was created to do this for the user.
OwnCloud, since it doesn’t require operating on a separate port, simply goes around the proxy.
Everything else falls into the catchall, which redirects the user to Plex.

#redirect everything to SSL
<VirtualHost *:80>
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

<VirtualHost *:443>

        #SSL configuration
        SSLEngine on
        SSLCertificateFile /etc/ssl/certs/server.crt
        SSLCertificateKeyFile /etc/ssl/private/server.key
        SSLCertificateChainFile /etc/ssl/certs/intermediate.crt
        #begin the proxying
        ProxyRequests Off
        ProxyPreserveHost On

        #let owncloud pass straight through
        ProxyPass /owncloud !

        #syncthing doesn't work without a trailing slash in browser URL
        RewriteRule ^/syncthing$ /syncthing/ [R]
        ProxyPass /syncthing/
        ProxyPassReverse /syncthing/

        #default go to plex
        ProxyPass /
        ProxyPassReverse /

        RewriteEngine on
        RewriteCond %{REQUEST_URI} !^/web
        RewriteCond %{HTTP:X-Plex-Device} ^$
        RewriteRule ^/$ /web/$1 [R,L]