Difference between revisions of "DIY Digital Picture Frame"

From Makers Local 256
Jump to: navigation, search
(Soft Resources: added startup script)
m (References: added link to power save mode commands)
 
(37 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Online Reources=
+
{{Project|Creator=Omegix
* [http://www.thewares.net/item/33 Guide to using Damn Small Linux for this]
+
|Status=<onlyinclude> Started </onlyinclude>                                <!--LEAVE ONLYINCLUDES FOR STATUS HACK-->
* [http://www.adamfranco.com/archives/3 This project] has the idea I"m looking for, keep it in "laptop" form as much as possible to make future enhancements easier.
+
|Born On=14:09, 27 January 2012 (CST)                                                                  <!--DO NOT EDIT -->
 +
|Last Updated={{#time: H:i, d F Y| {{REVISIONTIMESTAMP}} }} (CDT)              <!--DO NOT EDIT -->
 +
}}
  
=Physical Resources=
+
==Overview==
* Ratmandu is donating a Latitude C640 with no optical drive, keyboard, or RAM
+
See [[DIY_Digital_Picture_Frame/Old]] for previous attempt utilizing a laptop.
** Purchased 128MB of RAM from ebay for ~$8
+
** Switched stick I purchased for an extra 256MB stick that Strages had
+
** Salvaged a 20GB hard drive from the ancient Latitude that ran Win95 (relatively huge, considering the age)
+
** Was able to PXE boot and install Ubuntu
+
** According to [http://www.elhvb.com/mobokive/edwin/laptops/Dell/LATITUDE/C540-640.PDF This Document] the Docking Station pin for Turning on the laptop is pin #17, and one of the Ground pins is pin #10.  Should be able to put an external switch across these two to make the unit power up.
+
** LCD Ribbon cable will not reach motherboard, will need to purchase an extension for it.
+
*** Alternatively, need to open up LCD housing and see how long the cable will reach.  may be able to mount the LCD to the bottom of the computer (with spacers for airflow) as that would provide a usable cable orientation
+
[[Image:LCD_Cable_1.jpg | 200px]] [[Image:LCD_Cable_2.jpg | 200px]]
+
**** Was unable to find an extension Cable
+
**** When the LCD housing was taken apart, it was found that the cable would reach if the LCD was mounted to the underside of the laptop
+
**** Unfortunately the LCD ribbon cable that powers the cold cathodes tore
+
***** Replacement cable would be $25 after shipping at parts-people.com
+
  
* I have an old Gateway machine that might be PXE bootableRatmandu is bringing a PCMCIA network card so I can try this out.
+
Digital picture frame using an embedded systemUtilizing a dockstar and a displaylink USB-to-VGA Adapter.
** This machine worked out well.  Was able to disassemble and reconnect screen and still have the machine function.
+
[[Image:Screen_works.jpg | 200px]]
+
[[Image:Switch_extended.jpg | 200px]]
+
[[Image:Strain_relief.jpg | 200px]] <br>
+
First picture shows screen still working.  Second Picture shows the switch extended out.  Third Picture shows some hot glue strain relief.
+
** Next:  Secure Screen to Laptop.  Make sure keyboard will work with computer first.
+
  
=Soft Resources=
+
Amazingly big thanks to [[User:brimstone|brimstone]]This project mostly consisted of me asking how this could be done, and learning while brimstone typed his magic.
* Have installe Ubuntu via PXE boot
+
* Installed ubuntu-desktop
+
* Installed flickrfs
+
* created flickr account
+
** flickerfs does not need a username/password combination to access flickr, it uses some kind of authentication keyIt works, I don't need to understand it.
+
* installed feh at brimstone's recommendation, some sort of screen saver
+
** command:  feh -F -D 1 .
+
*** This commend starts a slideshow through the directory
+
*** brimstome recommended rsyncing the directory to somewhere as it appeared to be pulling the images from flickr each time rather than storing them locally?
+
*** flickerfs allows you to create a directory in the public tags directory to pull in photos of that tag.  it uses the directory name as the tag
+
*** looks like flickerfs unmounts at reboot.  may need to write a script to create the desired directory/tag at boot
+
*** flickrfs must be run at startup
+
  
<pre><nowiki>
 
#!/bin/sh
 
  
#need to put in a wait statement here to give time for network to boot before
+
== Steps ==
#attempting to connect with flickr
+
=== Displaying Local Files ===
cd /home/omegix
+
# Get [[Dockstar|dockstar running debian squeeze]] with an 8gb thumb drive.
flickrfs jeff_flickr
+
#* This step may not be necessary for others, but for some reason my dockstar installation needed the /etc/resolv.conf edited to add "nameserver 192.168.1.1" where the IP address was that of my home router's.  This was so the dockstar could see the outside network and access the apt repositories.
 +
# Have displaylink adapter plugged into dockstar, and screen plugged into adapter. 
 +
# Confirmed that udlfb driver was working with linux kernel (got the green screen when plugging in displaylink adapter)
 +
# SSH into the dockstar
 +
# Installed X windowing server
 +
# Installed feh (image display program)
 +
# Edit /etc/rc.local so that on reboot it will run "startx" to start the x server
 +
# Create directory to store a single image in (for mine I put it in /root) (not to be confused with the root directory " / " )
 +
# copy any picture you desire into that directory (it doesn't matter, as it will get overwritten often)
 +
# .xsession:
 +
## Put .xsession in the root directory ( / )
 +
## Edit .xsession so that it won't go into powersave mode and turn off the screen
 +
##*
 +
<pre>
 +
# disable DPMS (Screen blanking)
 +
xset dpms force on
 +
xset -dpms
 +
xset s noblank
 +
xset s off
 +
</pre>
 +
## Added line to .xsession to start the feh program.
 +
##* <pre> feh -R 2 -F /root/picture.jpg </pre>
 +
##* This will refresh (-R) displaying the picture.jpg file every 2 seconds, at Fullscreen (-F)
 +
# For some reason Xorg crashes frequently.  Until the problem can be fixed, this workaround can be implemented
 +
## Create script to check and see if Xorg is running.  Add script to crontab so it will check every minute. I named my script "CheckForX.sh"
 +
##
 +
<pre>
 +
#!/bin/bash
 +
pid=""
 +
pid="$(ps -e | grep Xorg | grep -v grep  | awk ' {print $1} ' )"
 +
echo $pid
 +
if [ "$pid" == "" ];
 +
then
 +
echo "process not running"
 +
startx &
 +
else
 +
echo "press is ok"
 +
fi
 +
</pre>
  
#need to either put a wait statement here to give time for pictures to load,
+
=== Cycling Through Pictures ===
#or rsync to a directory known to have some static files
+
# apt-get install cron
 +
# Create a directory where you will store all of your pictures you want do display.  For mine I used /root/PICTURES
 +
# create a script (SelectRandom.sh) that does the following
 +
<pre>
 +
#!/bin/bash
 +
cd /root/PICTURES
 +
for i in 1 2 3 4 5
 +
do
 +
        cp $(find -name '*.jpg' | shuf | head -1) /root/picture.jpg
 +
        sleep 9
 +
done
 +
</pre>
 +
#* Explanation of the code above:
 +
#** find -name '*.jpg' | shuf | head -1
 +
#*** find will find all files of specified type in provided directory and all subdirectories
 +
#*** shuf will randomize whatever list is provided to it.  in this instance, all the filenames found from the 'find' command
 +
#*** head will provide the number of entries at the top of the provided list.  The '-1' specifies to provide just the first entry.
 +
# edit your cronjobs ( crontab -e )
 +
# put in the following line to run the script every 9 seconds
 +
<pre>
 +
* * * * * /root/pictureframescripts/SelectRandom.sh
 +
</pre>
 +
#* We do this because the minimum amount of time you can run a cron job is 1 minute.  So in the script, we speficy how often we want to replace the picture being displayed. Cron will then run that script once a minute.
  
mkdir /home/omegix/jeff_flickr/tags/public/lolcats
+
=== Displaying Remote Files ===
cd /home/omegix/jeff_flickr/tags/public/lolcats
+
==== Via SSH (SSHFS) ====
feh -F -D 2 *.jpg
+
# Install SSHFS. I followed [http://embraceubuntu.com/2005/10/28/how-to-mount-a-remote-ssh-filesystem-using-sshfs/ these instructions].
</nowiki></pre>
+
# Create a script that will mount a remote folder via ssh.  Ex:  /root/pictureframescripts/MountSshfs.sh
 +
#* make sure to set it executable:  chmod +x MountSshfs.sh
 +
# Use the following line to auto-login to the sshfh.  Please note that you will be storing the remote password of your system in plaintext.  This is not the greatest of ideas for security reasons.  If you have another suggestion, please let me know
 +
#* echo <your_password> | sshfs <your_login<@<your ip address>:<remote file location> /root/PICTURES/sshpicturemount -o workaround=rename -$$name -o password_stdin
 +
# On the dockstar, in the .xsession file, add the following line before feh executes
 +
#* ./root/pictureframescripts/MountSshfs.sh
 +
#** This will ensure that your remote folder is loaded at boot time.  The cron job you previously setup is already pulling from the directory /root/PICTURES so it will now pull from /root/PICTURES/sshpicturemount as well
 +
 
 +
=== (Optional) Using dockstar as a terminal ===
 +
This project is meant to be a picture frame, which should be fairly hands off once running.
 +
But if you wanted to use the dockstar as a terminal, you would have to make the following modifications.
 +
# Plug in a mouse and keyboard
 +
# ssh into the box
 +
# If not already installed, apt-get install fluxbox
 +
# pkill the feh process
 +
#* Since feh was likely the only process running, when you kill feh, the X server will also stop
 +
# change /.xsession to run fluxbox or another lightweight windowing manager
 +
# run the "startx" command to restart the X server
 +
 
 +
=== Future Plans ===
 +
* Add wireless.  Brimstone mentioned he had success with Dlink DWA-125.
 +
* Pull Images from a samba share
 +
* Pull Images from a gmail account
 +
* Pull Images from a facebook album
 +
* Pull Images from flickrfs
 +
At this point, on boot, feh should start cycling through pictures on the local memory
 +
 
 +
== Resources ==
 +
=== Physical ===
 +
* Old Dell LCD Screen
 +
* [http://www.amazon.com/dp/B004D0QC0A/?tag=makersloca256-20 USB-to-VGA Adapter]
 +
* Dockstar
 +
* 8Gb Thumb Drive
 +
* Hama brand wireless 802.11b usb stick
 +
 
 +
=== References ===
 +
* http://forum.doozan.com/read.php?2,2073
 +
* http://mulchman.org/blog/?p=90
 +
** found from this article:  http://www.hunterdavis.com/2010/11/28/a-25-gamingemulation-powerhouse-using-the-dockstar-as-a-gaming-console/#more-843
 +
* https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling <-- for turning off powersave mode / screen blanking
 +
 
 +
=== Tips from Makers \ Hackerspacers ===
 +
* problem with dockstar not booting:  pull the drive out, fsck it on your local machine  ~brimstone
 +
* you might be able to force it to turn the screen on with DISPLAY=:0 xset dpms force on (might) ~brimstone
 +
** ||cw> omegix: DISPLAY env var, but you might need to xauth first, not sure that works over telnet
 +
* [[User:brimstone|brimstone]] says a displaylink adapter is ideal
 +
** use lsmod to determine if SiS module is loaded when plugging in the adapter I have
 +
* [[User:ramgarden|ramgarden]] says to try this for adding to photostream dynamically:
 +
** http://spoon.cx/~larcher/2009/01/06/flickr-screensaver-for-linux/
 +
** Then you can email new photos to the flickr account for this photo frame using the special email address unique to each account.
 +
** Then run the podget every 5 - 10 minutes or so to get the latest pictures from the flickr account.
 +
** There might be a better way since podget will download every picture but OK if the file location is pointing somewhere with plenty of space.
 +
==== Linux Concepts ====
 +
* The udlfb kernel module provides a frame buffer for things to be displayed via the hardware (USB-to-VGA adapter).
 +
* X / X11 is a windowing server, that sends output to the frame buffer.
 +
* gdm / xdm are login managers, which appear only briefly, and display their outputs to the windowing server (X / X11) before continuing on to start the windowing manager (fluxbox).
 +
* fluxbox is a windowing manager, allowing you to have multiple windows to output to the windowing server.
 +
[[Category:Dockstar]]                                                  <!--MAKE AS MANY CATEGORIES AS YOU NEED-->

Latest revision as of 12:41, 29 May 2012

Creator:
Omegix
Status:
Started
Born On:
14:09, 27 January 2012 (CST)
Last Updated:
12:41, 29 May 2012 (CDT)

Overview

See DIY_Digital_Picture_Frame/Old for previous attempt utilizing a laptop.

Digital picture frame using an embedded system. Utilizing a dockstar and a displaylink USB-to-VGA Adapter.

Amazingly big thanks to brimstone. This project mostly consisted of me asking how this could be done, and learning while brimstone typed his magic.


Steps

Displaying Local Files

  1. Get dockstar running debian squeeze with an 8gb thumb drive.
    • This step may not be necessary for others, but for some reason my dockstar installation needed the /etc/resolv.conf edited to add "nameserver 192.168.1.1" where the IP address was that of my home router's. This was so the dockstar could see the outside network and access the apt repositories.
  2. Have displaylink adapter plugged into dockstar, and screen plugged into adapter.
  3. Confirmed that udlfb driver was working with linux kernel (got the green screen when plugging in displaylink adapter)
  4. SSH into the dockstar
  5. Installed X windowing server
  6. Installed feh (image display program)
  7. Edit /etc/rc.local so that on reboot it will run "startx" to start the x server
  8. Create directory to store a single image in (for mine I put it in /root) (not to be confused with the root directory " / " )
  9. copy any picture you desire into that directory (it doesn't matter, as it will get overwritten often)
  10. .xsession:
    1. Put .xsession in the root directory ( / )
    2. Edit .xsession so that it won't go into powersave mode and turn off the screen
# disable DPMS (Screen blanking) 
xset dpms force on
xset -dpms
xset s noblank
xset s off
    1. Added line to .xsession to start the feh program.
      •  feh -R 2 -F /root/picture.jpg 
      • This will refresh (-R) displaying the picture.jpg file every 2 seconds, at Fullscreen (-F)
  1. For some reason Xorg crashes frequently. Until the problem can be fixed, this workaround can be implemented
    1. Create script to check and see if Xorg is running. Add script to crontab so it will check every minute. I named my script "CheckForX.sh"
#!/bin/bash
pid=""
pid="$(ps -e | grep Xorg | grep -v grep  | awk ' {print $1} ' )"
echo $pid
if [ "$pid" == "" ];
then
echo "process not running"
startx &
else
echo "press is ok"
fi

Cycling Through Pictures

  1. apt-get install cron
  2. Create a directory where you will store all of your pictures you want do display. For mine I used /root/PICTURES
  3. create a script (SelectRandom.sh) that does the following
#!/bin/bash
cd /root/PICTURES
for i in 1 2 3 4 5
do
        cp $(find -name '*.jpg' | shuf | head -1) /root/picture.jpg
        sleep 9
done
    • Explanation of the code above:
      • find -name '*.jpg' | shuf | head -1
        • find will find all files of specified type in provided directory and all subdirectories
        • shuf will randomize whatever list is provided to it. in this instance, all the filenames found from the 'find' command
        • head will provide the number of entries at the top of the provided list. The '-1' specifies to provide just the first entry.
  1. edit your cronjobs ( crontab -e )
  2. put in the following line to run the script every 9 seconds
* * * * * /root/pictureframescripts/SelectRandom.sh
    • We do this because the minimum amount of time you can run a cron job is 1 minute. So in the script, we speficy how often we want to replace the picture being displayed. Cron will then run that script once a minute.

Displaying Remote Files

Via SSH (SSHFS)

  1. Install SSHFS. I followed these instructions.
  2. Create a script that will mount a remote folder via ssh. Ex: /root/pictureframescripts/MountSshfs.sh
    • make sure to set it executable: chmod +x MountSshfs.sh
  3. Use the following line to auto-login to the sshfh. Please note that you will be storing the remote password of your system in plaintext. This is not the greatest of ideas for security reasons. If you have another suggestion, please let me know
    • echo <your_password> | sshfs <your_login<@<your ip address>:<remote file location> /root/PICTURES/sshpicturemount -o workaround=rename -$$name -o password_stdin
  4. On the dockstar, in the .xsession file, add the following line before feh executes
    • ./root/pictureframescripts/MountSshfs.sh
      • This will ensure that your remote folder is loaded at boot time. The cron job you previously setup is already pulling from the directory /root/PICTURES so it will now pull from /root/PICTURES/sshpicturemount as well

(Optional) Using dockstar as a terminal

This project is meant to be a picture frame, which should be fairly hands off once running. But if you wanted to use the dockstar as a terminal, you would have to make the following modifications.

  1. Plug in a mouse and keyboard
  2. ssh into the box
  3. If not already installed, apt-get install fluxbox
  4. pkill the feh process
    • Since feh was likely the only process running, when you kill feh, the X server will also stop
  5. change /.xsession to run fluxbox or another lightweight windowing manager
  6. run the "startx" command to restart the X server

Future Plans

  • Add wireless. Brimstone mentioned he had success with Dlink DWA-125.
  • Pull Images from a samba share
  • Pull Images from a gmail account
  • Pull Images from a facebook album
  • Pull Images from flickrfs

At this point, on boot, feh should start cycling through pictures on the local memory

Resources

Physical

  • Old Dell LCD Screen
  • USB-to-VGA Adapter
  • Dockstar
  • 8Gb Thumb Drive
  • Hama brand wireless 802.11b usb stick

References

Tips from Makers \ Hackerspacers

  • problem with dockstar not booting: pull the drive out, fsck it on your local machine ~brimstone
  • you might be able to force it to turn the screen on with DISPLAY=:0 xset dpms force on (might) ~brimstone
    • ||cw> omegix: DISPLAY env var, but you might need to xauth first, not sure that works over telnet
  • brimstone says a displaylink adapter is ideal
    • use lsmod to determine if SiS module is loaded when plugging in the adapter I have
  • ramgarden says to try this for adding to photostream dynamically:
    • http://spoon.cx/~larcher/2009/01/06/flickr-screensaver-for-linux/
    • Then you can email new photos to the flickr account for this photo frame using the special email address unique to each account.
    • Then run the podget every 5 - 10 minutes or so to get the latest pictures from the flickr account.
    • There might be a better way since podget will download every picture but OK if the file location is pointing somewhere with plenty of space.

Linux Concepts

  • The udlfb kernel module provides a frame buffer for things to be displayed via the hardware (USB-to-VGA adapter).
  • X / X11 is a windowing server, that sends output to the frame buffer.
  • gdm / xdm are login managers, which appear only briefly, and display their outputs to the windowing server (X / X11) before continuing on to start the windowing manager (fluxbox).
  • fluxbox is a windowing manager, allowing you to have multiple windows to output to the windowing server.