Pages

Thursday, December 26, 2019

DIY Digital Photo Frame

Once I stumbled upon the Orange Pi Zero Plus2, which comes with the following features and is perfect to setup a simple DIY Digital Photo Frame:

CPU: Cortax-A53 (4 64bit cores up to 816 MHz (H5))
Memory: 512MB
EMMC: 8GB
MicroSD Slot, HDMI, WIFI and more

The 8GB EMMC holds the operating system (Armbian). HDMI is needed to connect the Photo Frame to any HDMI capable monitor. The MicroSD Slot holds a 128GB card for storing some photos and music.
After installing the operating system, I created two folders on my MicroSD card:

# mkdir -p /local/photos
# mkdir -p /local/music


The first directory stores all my photos I want to display, the second directory stores some music to play during the slideshow.

I have created only two scripts, ony for displaying the photos with fim. And another to play the music with ogg123. Both packages must be installed first.

Then I have created the first script to display my photos in a random slideshow:

# vi /usr/local/bin/slideshow.sh
#!/bin/bash
find /local/photos/ -name "*" -type "f" > /home/karellen/photos.txt
cat /home/karellen/photos.txt | shuf > /home/karellen/photos_shuf.txt
cat /home/karellen/photos_shuf.txt | fim --load-image-descriptions-file /home/karellen/photos.dsc - -c 'while(1){display;sleep "60";next;}' > /dev/null 2>&1


The second script will play some music in the background:

# cat /usr/local/bin/autoplay.sh
#!/bin/bash
find /local/music/ -name "*.ogg" -type f > /home/karellen/music.txt
while :; do
  cat /home/karellen/music.txt | shuf | while read f; do
    /usr/bin/ogg123 "$f" > /dev/null 2>&1
  done
done


The last step was to add both scripts to /etc/rc.local to start them after booting:

# vi /etc/rc.local
...
/usr/local/bin/autoplay.sh &
/usr/local/bin/slideshow.sh &

exit 0


After reboot the Photo Frame will display some photos in a slideshow and play some music in the background.

Links:

Orange Pi Zero Plus2: http://www.orangepi.org/OrangePiZeroPlus2/
Armbian: https://www.armbian.com/orange-pi-zero-2-h5/

No comments:

Post a Comment