Tablet Photo Frame with FTP Sync and Automated Start&Stop

I was searching for a Photo Frame to be placed at the grandparents of my little daughter with the following features:

  • Synchronisation with a FTP server to allow remote update of photos
  • Automated stop in the evening and start in the morning to prevent the photo frame from illuminating the room

As I could not find a turnkey solution I deceided to build it on my own based on an old Samsung Galaxy Tab 3 8.0 (T310). Note: The tablet needs to be rooted to allow automated stopping of the photo frame in the evening.

Step 1: FTP Synchronisation

  • Create FTP server login (I used my hosted webspace to create a ftp subaccount)
  • Create local folder for pictures on tablet (e.g. /sdcard/fotos_bilderrahmen)
  • Install FolderSync lite app (Play Store)
  • In FolderSync create “Account” using your FTP login data
  • In FolderSync create “Folderpair”. Select the FTP-Account and the local folder. Define scheduling e.g. hourly, activate deleting files on local side if deleted on server.

Step 2: Photo Frame app

  • Install Photo Frame app Premium (Play Store)
  • Start app and configure (e.g. refresh folder content e.g. 15min, orientation, transition between photos, …)
  • Select local photo folder (SD) and create startpage shortcut to start photoshow directly from this folder (use button top right)

Step 3: Automate start and stop of photo frame app

  • Install Automate app (Play Store)
  • Start app and activate app start after boot (in app properties)
  • Create new flow (see screenshots, take care on values for app start block)

    Step 4: Integrate in wooden photo frame

    • Fix tablet with double sided mirror tape (e.g. Tesa)
    • Glue additional wooden spacers to stabilize
    • Optional: Order (or DIY) taylored passepartout (e.g. art&more)

    Advertisements

    Calling a HTTP url from FHEM to trigger action

    I need to call HTTP urls from FHEM for several things, like firing IR signals to my TV (see my post: https://kaistech.wordpress.com/2016/10/09/wifi-infrared-ir-remote-extension-using-esp8266/ ).
    As far as I know, FHEM currently does not have a way to do this easily (HTTPMOD seems to be a bit too complicated for that).

    My solution is based on a simple PERL script which is called directly from FHEM:

    Script /home/pi/irhttp.pl:

    #!/usr/bin/perl -w

    use warnings;
    use strict;
    use Time::HiRes qw/time usleep/;
    use Socket qw(:all);
    use POSIX ":sys_wait_h";

    use LWP::Simple;

    #print $ARGV[0];
    #print "\n";

    my $url = 'http://192.168.2.114/ir?code=';
    $url .= $ARGV[0];

    my $content = get($url);
    die "Can't GET $url" if (! defined $content);

    Then make it executable: sudo chmod +x /home/pi/irhttp.pl

    Now you can call it from FHEM e.g. from a DOIF like this:

    define DOIF_Dummy_WohnzimmerTVMode DOIF ([Dummy_WohnzimmerTVMode]) ({system ("/home/pi/irhttp.pl 50153655 &")})

    Note: Here I pass the a argument to the Perl script which is attached to the URL.

    Wifi Infrared IR Remote Extension using ESP8266

    In the last months we integrated a rising count of IoT devices into our FHEM based homeautomation system (Wifi switches, LED lights, door and window sensors etc.). Nevertheless, most of my entertainment devices (TV, Sounddeck) were not integrated and required their own infrared remote to be turned on, switch channel, etc. A infrared adapter needed to get in place to integrate these devices into my tablet based FHEM interface.

    As I had a lot of success using ESP8266 modules for 24×7 running devices in the past, I deceided again to use a ESP8266 (Wemos D1 mini module, cheap available at Aliexpress). My aim was to let the ESP fire two IR leds which are installed directly in front of at TV and Sounddeck. A HTTP server running on the ESP receives the IR request in form of decimal IR code (which I identified before using a IR receiver on a ESP).

    Hardware
    – ESP8266 (e.g. Wemos D1 mini or NodeMCU)
    – 2x IR transmitting LED (any 950nm IR led will work), ~20Ohm 0.5W resistor, NPN transistor (any NPN like BC547, BC548 or PN2222 will work) , 330Ohm 0.125-0.25W resistor
    – optional to identify IR codes using your devices IR remote: IR-receiver 38kHz (e.g. TSOP 4838)

    My code is based on this nice library and its examples:https://github.com/markszabo/IRremoteESP8266/blob/master/README.md

    Using the TSOP4838 wired to 5V of Wemos board, GND and D2 (aka GPIO 4) and the example from the libary (https://github.com/markszabo/IRremoteESP8266/blob/master/examples/IRrecvDumpV2/IRrecvDumpV2.ino) I identified the following IR codes for my device (library will print out HEX but DEC required for HTTP call lateron):

    TV ONOFF
    NEC
    32
    0x2FD48B7
    50153655

    AUDIO ONOFF
    NEC
    32
    0x40BFEA15
    1086319125

    AUDIO VOL+
    NEC
    32
    0x40BFB04F
    1086304335

    AUDIO VOL-
    NEC
    32
    0x40BFF20D
    1086321165

    AUDIO SOURCE BT
    NEC
    32
    0x40BF8877
    1086294135

    AUDIO SOURCE TOSLINK
    NEC
    32
    0x40BF08F7
    1086261495

    The hardware of the IR transmitting server is set up as follows. I use the 5V of Wemos board which is hardwired to the 5V rail of the USB power supply:

    The IR leds are consuming about 100mA of current. I deceided to run 2 in series with a 20Ohms 0.5W resistor burning about 2Volts (3Volts burned by two led and transistor collector-emitter). The NPN transistor is driven by D2 (aka GPIO 4) via a 330Ohms resistor.

    My Arduino sketch for the ESP bases on this example from the library: https://github.com/markszabo/IRremoteESP8266/blob/master/examples/IRServer/IRServer.ino

    A few pictures of the hardware:

    Finally now I am able to put my old IR remotes away and send out IR commands via simple HTTP request to the ESP (e.g. http://192.168.1.110/ir?code=104937399).

    Remarks:
    The examples of the library are using GPIO 2. So the PIN needs to be updated in the Arduino sketches to GPIO 4.
    I configured my DSL router, to assign the same IP for the ESP all the time.

    Hint: See my next post how to call the IR server from FHEM: https://kaistech.wordpress.com/2016/10/11/calling-a-http-url-from-fhem-to-trigger-action/