The goal of this project is to create a Magic Picture Frame. This frame will display pictures for one hour at a time (a configurable option) on a hung & framed display.
It will also be able to be controlled by voice commands to display the next or previous images. This guide assumes you are comfortable with the terminal, though it does provide exact commands that you can copy and paste into bash.
USB power brick and USB cable. (to power the Pi), any old left over phone charger will work for this little computer. (Free)
A monitor with an HDMI input, or an adapter to get it there. I had some old screens laying around, but I needed to pick up a $6 adapter to get it from VGA to HDMI. Old screens can be picked up from thrift stores for under $20.
A microSD card.
A phone running Android (only needed if you want the voice controls).
A Google Home device (only needed if you want the voice controls).
Download Etcher (the tool to get the operating system onto the computer).
Use Etcher to flash the microSD card with Raspbian.
Pop the microSD card into the Pi and boot it up.
Configure the Pi.
Enable Wifi.
Enable SSH:
From the Preferences menu --> Launch Raspberry Pi Configuration.
Navigate to the Interfaces tab.
Select Enabled next to SSH.
Click OK.
Set up directory for the images (it'll also show images in sub-folders). This command will create a directory called "frame" in your home directory: mkdir ~/frame
Test this with the following, just ensure you have some images in there first: feh -Y -q -D 3600 -B black -F -Z -z -r /home/pi/frame/
These are the options, ans youu can edit them as desired:
-Y, hide the pointer.
-D, wait some seconds between automatically changing slides.
3600, the number of seconds per image (3600 is an hour).
-q, don't report non-fatal errors for failed loads.
-B, background type.
black, the background color.
-F, fullscreen mode.
-Z, zoom pictures to screen size.
-z, show pictures in random order.
-r, recursive; show images in all sub-directories.
/home/pi/frame/, the location of the images.
Set up cron jobs to kick off feh when the computer boots up:
Run: crontab -e . When asked, use the default editor. Add the following lines to the end of the file: @reboot setterm -blank 0 -powerdown 0 (this is to prevent the display from turning off.) @reboot sleep 60 && DISPLAY=:0.0 feh -Y -x -q -D 3600 -B black -F -Z -z -r /home/pi/frame/ (this is the line that actually starts feh.) 0 0 * * * vcgencmd display_power 0 (this is the line that disables the display at midnight.) 0 7 * * * vcgencmd display_power 1 (this is the line that enables the display at 7 am.)
Save the file and exit (Crlt+O, Crlt+X).
Edit a config file to allow the crons to start when the Pi boots up:
Run: sudo nano /etc/rc.local
Just before the line that reads "exit 0", add the following line: /etc/init.d/cron/start
Save the file and exit (Crlt+O, Crlt+X).
Install xdotool for sending key stroke commands to the pi via SSH. This will let you run commands via SSH on the tty session with the actual display. Run: sudo apt-get install xdotool
At this point all you have to do is boot the computer and it will start the slideshow. However, if you want to add the Magic, you will need to continue with the following steps to add voice control.
Configure Tasker/Auto Voice. This allows you to use verbal commands to the Google Home to push a command via SSH to control the image.
Create two Tasker Tasks. Call them Previous & Next. Add Action --> SSH Plugin --> Configuration: fill in the SSH login info. In the Remote Command section place:
DISPLAY=:0 xdotool getactivewindow key Left (To go to the previous image. Don't include this stuff within the parentheses.)
DISPLAY=:0 xdotool getactivewindow key Right (To go to the next image. Don't include this stuff within the parentheses.)
Next create two Tasker Profiles, one for each of the Tasks. Call them "Frame Advance" and "Frame Previous":
Plus --> Event --> Plugin --> AutoVoice --> Recognized --> Configure --> Cancel --> Commands --> No --> Some command to speak, such as "Advance frame".
Give it a Response as well, so you will know if it triggered correctly (such as "displaying next image").
For the Task, pick the appropreate Task you created in Step 1.
Test this by saying to your Google Home, "Hey Google, ask AutoVoice to advance frame." if all is well, you will get your response echoed at you.
Do the previous four steps again, but for "Previous frame".
You can give the frame the ability to wake & sleep by building additional Tasks and Profiles. Just send the following commands via SSH like you did (in Step 5.2):