1

C.W.Holeman III

HST Clock

LOADING HST TIME

Writing Projects

The Dance in the Deeps
First Draft

A Clockwork Armada
First Draft

Quote of the Week

"You're in America now," I said. "Our idea of diplomacy is showing up with a gun in one hand and a sandwich in the other and asking which you'd prefer."

--Harry Dresden [Turn Coat, by Jim Butcher]

Joke of the Week

There are only 10 kinds of people in the world: Those who know binary, and those who don't.

Twitter Updates


Magic Picture Frame

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.

Required Materials

Instructions

  1. Set up the Raspberry Pi:
    1. Download Raspbian (the operating system).
    2. Download Etcher (the tool to get the operating system onto the computer).
    3. Use Etcher to flash the microSD card with Raspbian.
    4. Pop the microSD card into the Pi and boot it up.
  2. Configure the Pi.
    1. Enable Wifi.
    2. Enable SSH:
      1. From the Preferences menu --> Launch Raspberry Pi Configuration.
      2. Navigate to the Interfaces tab.
      3. Select Enabled next to SSH.
      4. Click OK.
    3. 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
    4. Install feh, a full-screen slide-show program:
      1. sudo apt-get install feh
      2. 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/
      3. 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.
    5. Set up cron jobs to kick off feh when the computer boots up:
      1. 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.)
      2. Save the file and exit (Crlt+O, Crlt+X).
    6. Edit a config file to allow the crons to start when the Pi boots up:
      1. Run: sudo nano /etc/rc.local
      2. Just before the line that reads "exit 0", add the following line:
        /etc/init.d/cron/start
      3. Save the file and exit (Crlt+O, Crlt+X).
    7. 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

  3. 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.
  4. On your Android phone, install Tasker, the SSH Tasker Plugin, & the Auto Voice Tasker Plugin.
  5. 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.
    1. 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.)
    2. 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".
  6. 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):
    1. vcgencmd display_power 1 (Enables the display.)
    2. vcgencmd display_power 0 (Disables the display.)