Monday, July 30, 2018

40" Picture Frame For under $100

Yup, another version of my picture frame obsession (YAPF). I have turned several laptops into picture frames in the past. The Mark I, a ca'95 HP laptop is still running strong, 8 years non stop. The Mark II ca'99 HP laptops were not that strong. These died after few years...something changed in HP's quality about the new millenum...

So here we go again! This time I am spending real $$$ on it!

The ingredients:

  1.  A used HDTV from craigslist.org.  Best, a TV with LED back-light and 1080p resolution (a 720p works too but the picture quality is not that great unless they are small.). I got a 4yr old Emerson LC401EM3F.for $75
  2. Rapsberry Pi Zero $5 or better RPiZeroW $10 (much more fun to access remotely)
  3. miniSD card, greater than 4GB capacity $5
  4. 5V USB power supply (a charger better than 500mA), USB cable (to power RPi) $10
  5. High-Speed Mini-HDMI to HDMI Cable, such as this (Amazon Basic) $5
Total about $95.

Quick steps to the finish

Here are the steps to achive glory in less than an hour...that is if you know what you're doing. (Some skills required.)

Create Bootable Raspian Lite system. 

There are plenty tutorials online how to do it here.
  • Download Raspian Lite (at the time of writing it's STRETCH). Here
  • Image your microSD card (on linux I use dd)
  • Connect a keyboard (needs a microUSB to USB cable/adapter, OTG works) to USB port.
  • Connect monitor via you cable (you can use adapters but the connectors on RPIW are fragile and close together so cable work better).
  • Power it up by plugging the USB charger/power supply into PWR connector.
  • You should see RPI booting.
  • After booting, log in as pi, password raspberry

Configure the system, via raspi-config utility.

  • change password (if you want)
  • set hostname (if you want)
  • configure wifi (so you can log into it with ssh - applies only to RPIZ or if you plug inWiFi adaptor)
  • enable ssh
  • configure locale: US UTF-8, timezone
  • configure keyboard: Generic 104 PC, US than at the end there is option to set Ctrl-Alt-Backspace to kill X
  • configure boot to console (not graphical)
  • set to resize file system to full CD
  • reboot, check that wifi is connected (ping something), also check you can ssh to the system (handy later)

Add to the system, as Lite is a bit...lite.

  • first update  all
    • sudo apt-get update && sudo apt-get upgrade -y
  • reboot 
  • install graphical display (xorg) and other utils
    • sudo apt-get install --no-install-recommends xserver-xorg xinit x11-xserver-utils lightdm feh
    • note: the lightdm allows auto login to X; feh is the slide show application.

Configure scripts so things start automatically on every boot.

  • create ~/.xinitrc (this is what startx runs: disable x screen blanking and make it execute pf.sh at the end)
    xset s off
    xset -dpms
    xset s noblank
    /home/pi/bin/pf.sh
  • create ~/bin/pf.sh to start feh in desired mode - full screen, randomized slide show 60s, no mouse etc and make it look for pictures in ... Pictures directory)
    feh -xrzYZFD60 --no-pointer --auto-rotate ~/Pictures
  • in ~/.profile add the following at the end  (this runs startx on login from tty1 so autologin will use it)
    if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
    startx
    fi

Enjoy the view

Put some pictures in Pictures directory (you can use the scp utility via network).
Connect da TV.
Reboot.
You should see RPI booting and then switching into graphical X and after a moment displaying the pictures.

DONE?


Ahh...No....not completely. I still want the YAPF.M3 to turn off when nobody is watching and back on when somebody is here (via a PIR sensor). More on this later  (hooking PIR sensor, using HDMI CEC TV control and wrapping it all in a script).

Here is how to add schedule to the YAPF.M3
http://minkbot.blogspot.com/2018/08/picture-frame-rpipf-on-schedule.html

Also, since it's already connected to wifi, perhaps it could suck in the pictures itself? The disadvantage is that I am still using Picassa and which do not modify my pictures (Picassa just remembers the operations) and the pictures would be the resolution unnecessary higher than 1080p (20MP anyone?).

Github Repository

All the files are in github. These can be copied to the home directory: ~/home/pi.
https://github.com/michkrom/pictureframe



No comments: