mrworf/photoframe

Distribute the frame displayed picture on recycled old usb photoframes across your house

Closed this issue · 3 comments

Hi @mrworf,

I wanted to share something I have done recycling few old photoframes usb driven.

The main photoframe running on an RPI 3 pushes the currently displayed picture to other frames which are equipped with RPI zero and plugged to the old frame via usb appearing as a usb stick thanks to usb gadget mass storage (this only works on rpi zero, maybe others but definitely not on older hardware like RPI B).

There are issues as the usb stick needs unmounting and remounting to update the content to the frame and different frames react differently so I needed to tweak my script to get it to work on all the usb frames.

I used https://magpi.raspberrypi.org/articles/pi-zero-w-smart-usb-flash-drive to get the RPI zero to act as a mass storage device and skipped the samba and mounting script and wrote a small script below:

#!/bin/bash

FOLDER="/root/history/"

while $(watch -g -t ls -rtlh $FOLDER | tail -2 | head -1 | awk '{print $9}' >/dev/null)
do

    for i in $( ls -rtlh $FOLDER | tail -2 | head -1 | awk '{print $9}' )
            do
            echo -e "Found new picture $FOLDER$i\n"

            ssh pi@192.168.1.237 'rm -f /mnt/usb_share/*.jpg'
            scp $FOLDER$i pi@192.168.1.237:/mnt/usb_share/$i.jpg
            ssh pi@192.168.1.237 'sudo /sbin/modprobe -r g_mass_storage && \
                sync ; sleep 1 ; \
                sudo /sbin/modprobe g_mass_storage file=/piusb.bin stall=0 ro=1'
    done

done

All you need is to share ssh keys from the photoframe to the target RPI zero and run the script putting the correct IP address.

Hope this helps.
Thanks,
Rafik

That's really neat.

Can you do a wiki page for that on this project? Everyone has write access and I don't want this amazing little trick to disappear in the bug log :)

Hi @mrworf, it is all documented https://github.com/mrworf/photoframe/wiki/Mirror-your-frame-in-your-house-using-old-cheap-hardware

I improved the script and tried to document each step, please let me know anything you might feels is missing.

Rafik