Differences

This shows you the differences between two versions of the page.

Link to this comparison view

divertissements:digitalframe [2010/10/09 22:47] (current)
Line 1: Line 1:
 +====== Using a digital frame as a secondary monitor ======
  
 +Without HW modding ;-)
 +
 +
 +===== Idea =====
 +
 +How about having a secondary (low cost, low consumption) pc monitor to show status data for a server?
 +
 +Hardware needed:
 +  * digital frame (bluetooth enabled)
 +  * at least 1 pc with bluetooth
 +
 +They must be in range of course.
 +
 +Develop a script that (periodically): ​
 +  - gathers information to be displayed (text?)
 +  - aggregates this info into one single page/image (the final format MUST be recognized by the digital frame, i.e., JPG, GIF, etc.)
 +  - uploads this image via bluetooth to the digital frame
 +
 +
 +===== Implementation =====
 +
 +  - no need to explain, just use whatever sequence you are interested in (e.g. '​df',​ '​top',​ '​who',​ etc.)
 +  - ideas:
 +    - <​del>​text -> parsewiki -> latex -> pdf -> jpg</​del>​
 +    - <​del>​imagemagick (superimpose)</​del>​
 +    - pbmtext (from netpbm package) !!!
 +    - (still have to try) http://​www.imagemagick.org/​Usage/​text/#​text_operators
 +  - as easy as: '$ obexput -v -b <​BLUEADDR> ​ -p <​filename>'​
 +
 +The uploaded (via bluetooth) image is displayed as soon as received and it's not stored, so there are no overflow (only 10 Mb of memory on the frame) problems :-)
 +
 +I "​crontabbed"​ the script, it runs every minute, it also picks a random photo from my library and displays it (after a small delay).
 +
 +If you want to monitor websites you can use "web thumbnailing"​ software to display snapshots of webpages on the frame.
 +
 +The USB channel could also be used BUT the frame switches to a "pc connection"​ mode when the cable is connected and does not display anything until the cable is disconnected and, anyway, bluetooth is better (for the range).
 +
 +
 +===== Scripts =====
 +
 +Generate image from textual file:
 +<​code>​
 +cat $FILENAME|pbmtext>​ $FILENAME.pbm
 +convert $FILENAME.pbm $FILENAME.jpg
 +</​code>​
 +The conversion is a must since the frame does not accept/​display PBM files.
 +
 +Upload and display:
 +<​code>​
 +obexput -v -b <​BLUEADDR> ​ -p <​nomefile>​
 +</​code>​
 +
 +
 +==== A complete example ====
 +
 +<​code>​
 +FILENAME=$(mktemp)
 +##########################​
 +# status here, modify at will
 +date >> $FILENAME
 +df >> $FILENAME
 +top -b -n1 |head -n 10 >> $FILENAME
 +##########################​
 +cat $FILENAME
 +# cut to 70 char is a must, to keep text viewable
 +cat $FILENAME|cut -c-70|pbmtext>​ $FILENAME.pbm
 +convert $FILENAME.pbm $FILENAME.jpg
 +obexput -v -b <​BLUEADDR> ​ -p $FILENAME.jpg
 +rm ${FILENAME}*
 +</​code>​
 +
 +
 +==== An evolution... ====
 +
 +<​code>​
 +statusOnFrame.sh ​  # script for status (see above)
 +sleep 5
 +
 +#########################################################​
 +TEMPDIR=$(mktemp -d)
 +pushd $TEMPDIR
 +
 +#​METEO################​
 +wget http://​www.ilmeteo2.com/​italy.png
 +convert italy.png -resize 410x234 foto.jpg
 +mandaFoto.sh foto.jpg
 +sleep 5
 +
 +for num in 1 2 3 4
 +do
 + wget http://​www.ilmeteo2.com/​italy${num}.png
 + ​convert italy${num}.png -resize 410x234 foto.jpg
 + ​mandaFoto.sh foto.jpg ​ # obexput...
 + sleep 5
 +done
 +
 +#​UNAFOTOACASO################​
 +PHOTO=$(find <!!!your path here!!!> -type f|grep -i '​jpg$'​|shuf|head -n 1)
 +LABEL=$(echo $PHOTO|cut -c 27-)
 +convert $PHOTO -resize 410x234 label:​$LABEL +swap -append foto.jpg
 +#ls -l $PHOTO
 +mandaFoto.sh foto.jpg ​ # obexput...
 +pausa
 +
 +#​NEWS################​
 +#wget http://​ansa.it/​web/​ansait_web_rss_homepage.xml
 +wget -O - http://​ansa.it/​mobile/​ |html2text|tail -n +5|head -n 15|pbmtext > ansa.pbm
 +convert ansa.pbm foto.jpg
 +mandaFoto.sh foto.jpg ​ # obexput...
 +sleep 5
 +
 +#########################################################​
 +popd
 +
 +rm -f ${TEMPDIR}/​*
 +rmdir ${TEMPDIR}
 +</​code>​
 +
 +===== Result =====
 +
 +{{:​digitalframeasmonitor.jpg?​400}}