This is the updated version of this post.
This was my first Raspberry Pi project … and it didn’t get off to a good start. I have since got a new router and lost all means of getting back on to the Pi so I spent some time doing a full rebuild and fixing some of the messes from previously. I felt a lot more comfortable this second time playing around in Linux sorting things out. So, if you are new to Raspberry Pis, you’re having a go at this? Well, confidence … you’ll be OK. And if you mess up, pull out the MicroSD card and start again.
Starting Kit:
- Ras Pi 3 (rev 2)
- 16Gb Class 10 Micro SD Card + adapter (so you can plug it into your PC)
- old USB Keyboard and Mouse
- a laptop
- Etcher
- lots of cups of tea (biscuits optional)
- WiFi
- LAN cable
- Power supply for Ras Pi
Steps – the loose outline
- Plug it all in
- Put the operating system on the Micros SD card
- Follow some online instructions
- Ignore those and tinker
- Break lots of things
- Go back to instructions and follow the video
- Proudly display it to no-one as it’s now 1am
As I said, it didn’t necessarily go to plan, even the second time, following my own instructions, I still got it wrong!
Issues I initially encountered:
- My Ras Pi 2 seemed to lock up, but this later turned out to be because I didn’t read the instructions
- Amazon is fast at delivering Ras Pi 3’s but my missus is faster at spotting the payment
- My HDMI to VGA cable wouldn’t work with my monitor
- The instructions you find on the internet seem to be written in an alien language sudo apt-get install translate-gobbledygook
- Not working with the latest version of the OS caused me to lose about an hour of updates
- Phone chargers lie … 5v 2A … not true !
- Switching to wi-fi BEFORE doing updates is much slower !
What I hope to give you here is a simple guide. I will not say it is in-fallible, this is my first Ras Pi project. I also assume that I have broken stuff along the way – that’s OK apparently. Coming from the land of Windows, this does seem odd ! So good luck and let’s crack on.
Things you will need to bare in mind when doing this :
- It takes a lot of time
- You will type stuff initially and not know why – sudo and nano
- Although there is a lot of information on the internet, not all people speak your language, and by that I mean technically. Knowing a hdmi safe=1 instruction lives in config.txt file means putting blind faith in someone you don’t know has done this right at some point !
Step 1 – plug it all in
The unboxing. I got my Ras Pi 3 off Amazon – the brown bag it comes in is simply brilliant. I quickly assembled everything and plugged it all in. First problem, not a flicker out of the computer monitor I was using. I then de-camped and plugged in to the TV using the HDMI cable and it worked – a flicker of hope.
Issue to resolve later. HDMI-VGA adapter and Computer monitors
Step 2 – Putting the operating system on the Micro SD card
On your home computer, install Etcher. This is the fool-proof way to install an image onto a SD card that I found.
Next you need the operating system for the Ras Pi. Being a purist I used the one from the main Ras Pi website. At the time of this blog it was Raspian Jessie with Pixel. I used the Lite version. This will take ages to download, so take some time now to get a cup of tea … you’re going to need it!
Put the Micro SD card into your laptop/desktop computer and launch Etcher. Follow the instructions to put the image onto the Micro SD card, should all be fairly simple.
When done, take the Micro SD card out and then put it back in to the computer. Browse for it and see if you can see anything at all on the Micro SD card. Windows should see something.
Step 3 – Follow some online instructions
When I say instructions, what I mean are half-truths of tired people! The main blog that I followed was:
https://pimylifeup.com/raspberry-pi-photo-frame/
Massive kudos to the author, but there are some mistakes in the text and at least one missing instruction. So here goes my attempt!!
Turn on the Pi
Put the Micro SD card in and putting the power in. and log in. Again, this is not an easy thing to find as it is assumed by the internet you will know it.
Username: pi
Password: raspberry
Because we are using Lite, you don’t get a desktop… yet … we’ll get there!
Configuring the Pi
As we have a command prompt only, we will need to be careful what we type. We first need to configure the Raspberry Pi. So type..
sudo raspi-config
I made the following config changes:
2 : Hostname - PictureFrame 4 : Localisation - Timezone and WiFi Country 7 : Advanced Options - A1 Expand Filesystem
Use the right cursor on the keyboard to select Finish and it may reboot. I say may as it sometimes does and sometimes doesn’t.
Now type
sudo apt-get update
When this finishes then do
sudo apt-get upgrade
This will put the latest versions of everything onto your Pi. Watch carefully as there are options you need to say yes and no to !
Now you need to reboot, this next command will be something you type a lot
sudo reboot
This should reboot your Pi and then get you back to the prompt.
Update the config tool
I then went back into the config and updated the tool itself.
sudo raspi-config
Update the tool and finish and reboot
Installing a desktop of some kind
sudo apt-get install --no-install-recommends xserver-xorg sudo apt-get install raspberrypi-ui-mods sudo apt-get install lightdm
This will install LightDM which is a desktop and will make things feel a little more familiar.
Do a reboot (remember the command from above?) and when you log in again, go back into raspi-config and change the boot options and change this to desktop with login. This will mean that later on when you are not close to the ras pi and it reboots (e.g. power outage) then it will log back in afterwards.
Issue to resolve later. Would it be better to reboot to command prompt with login?
Turn off screen blanking
A bit of blind faith is needed on this next bit … I assume it works and there is some kind of screen blanking but I typed this anyway without any adverse affects!
sudo nano /etc/lightdm/lightdm.conf
This brings up a really awful text editor (called nano). You use the cursor keys on the keyboard to move a green blob down the page. Keep going till you find [SeatsDefaults]. Why it is called this … no idea.
The first line will be #type=xlocal
Go above that line and type:
xserver-command=X -s 0 –dpms
(yes that is a ZERO)
So this section should look like :
[SeatsDefaults] xserver-command=X -s 0 –dpms #type=xlocal
Now, remember I said this nano was a bit rubbish. To save your edit is:
ctrl+x (saves it) y (confirms you want to save it) enter (to overwrite the filename)
Phew – well done ! You survived editing and saving your first file. A cup of tea is in order to celebrate.
sudo reboot
This should reboot your Pi and then get you back to the desktop.
Put the files onto the Pi and enable wi-fi/SSH
This should reboot your Pi and then get you back to the desktop.
As you are about to get into installing the package, it is my strong recommendation that you put in the USB pen drive with your photos on it and/or copy your photos onto the card. Nicely, this Pixel has a file manager similar to windows to help you do that. Write down on a piece of paper the name of the folder you put the photos into e.g.
/home/pi/Public
The package we are going to be using will also launch before any desktop so you will need to gain access to the Pi remotely. I therefore recommend you set up
a) wi-fi using this blog : http://www.makeuseof.com/tag/setup-wi-fi-bluetooth-raspberry-pi-3/
b) SSH using this blog : https://pimylifeup.com/raspberry-pi-ssh/
The wi-fi means that you don’t need any network cables thus reducing your wiring requirements and SSH means you can how put the Pi down and use your laptop, from a distance … like the kitchen .. by the biscuit barrel !
What the feh?
The package we are going to install is called feh. I know right … great name. If you are interested, you can find more out about it here.
There is more blind faith and trust coming up – a lot of this I just don’t understand. In the original instructions for example, they go from full commands to abbreviations. I don’t think it is necessary as you will be saving it as a script. I also removed a command of preload as I have over 500 images and it just wouldn’t work.
OK, back to Terminal
sudo apt-get install feh
This installs the app. You now need to make sure it will all work. To do this we are going to type what looks like gobbledygook. The good news is that you are using SSH from a laptop so you can copy and paste this 😉
piDISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh --quiet --randomize --full-screen --reload 60 -Y --slideshow-delay 15.0 /home/pi/Public &
I am not going to pretend I know what everything does, but … what I did learn was:
- Display=:0 is some privilege thing to say do what I say
- the X bit is the graphics bit
- usr/bin/feh is running the programme
- then come the switches (–quiet etc)
- right at the end is the folder your photos are in
- the & at the end means that you can do other commands if you need to otherwise it locks you out of the command line.
Issue to resolve later. Why when I used the shortened switches did it not play in random? is -Z incorrect?
Issue to resolve later. Using this in the terminal on the Pi works but not over SSH
Cross fingers things should be working ?
My first programme
Technically it is a script not a programme. To make the Pi do that whole DISPLAY thing when you turn it on, you need to create a script then put it in a startup area.
To create a programme, we’re back to nano and let’s call this StartPictureFrame.
sudo nano /home/pi/StartPictureFrame.sh
nano will be empty so you will need to type the following
#!/bin/bash DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh --quiet --randomize --full-screen --reload 60 -Y --slideshow-delay 15.0 /home/pi/Public
And don’t put the & at the end either !
Can you remember how to save it?
ctrl+x (saves it) y (confirms you want to save it) enter (to overwrite the filename)
Test it works!
Type
bash /home/pi/StartPictureFrame.sh
I have my fingers crossed for you too … watch those pretty pictures as you dunk your biscuit into your cup of tea!
Time to automate this
This is the bit where I had the most problems, not the editing, but getting it all working. You see, if you look at the blog I was using, it does not state sleep 10 anywhere. In fact the comments below and elsewhere seem to have hundreds of people with the same issue. feh won’t work. Here is my solution to the problem … watch the video again in that original blog … carefully !
The commands are:
sudo nano /etc/rc.local
This is editing the main boot up script for the Pi. Before Exit 0 at the bottom add
sleep 10 sudo bash /home/pi/StartPictureFrame.sh &
And yes there is an & at the end
ctrl+x (saves it) y (confirms you want to save it) enter (to overwrite the filename)
So … time for the reboot.
To kill the screensaver
From your SSH thing, do
sudo pkill feh
to kill the screen saver.
Issue to resolve later. What does sleep 10 do ?
sudo reboot
This should reboot your Pi and your slideshow should start.
Step 4 – Getting this to work on a PC monitor
Most of what you’ve just done was probably on the TV in the lounge. However, for me, I have an old 19-inch PC monitor which I wanted to use. It has VGA and DVI inputs but no HDMI. I have a HDMI to VGA adapter but when I plugged the Pi in, everything was squished to a 2 inch strip on the left.
Massive thanks to this rambling set of comments which gave me the solution.
- Find out what your monitor will run
From SSH run:
/opt/vc/bin/tvservice -m CEA
- Find out what your Pi is happy with
From SSH run:
/opt/vc/bin/tvservice -m DMT
For me it looked like 1028 x 720 at 60Hz so I found that DMT Mode 23 was the place I needed to be.
- Editing your Pi
These edits need to be in a file called config.txt. To edit it
sudo nano /boot/config.txt
This is a very scary file … so do these edits carefully !
Uncomment the hdmi_safe command if you get no picture on HDMI for a default “safe” mode. This is done by removing the # at the start, so it should look like this..
hdmi_safe=1
If you scroll down a few lines you will see the hdmi group. I also edited the group to be the same as my monitor from the DMT above
hdmi_mode=23 ctrl+x (saves it) y (confirms you want to save it) enter (to overwrite the filename)
Final time?
sudo reboot
Issue log to investigate
- HDMI-VGA adapter and Computer monitors
I have (somewhere) a HDMI to DVI cable and I wonder if this would have meant I didn’t have to edit the config.txt file. I will dig that cable out and try it.
- Why when I used the shortened switches did it not play in random? is -Z incorrect?
I’m not sure that this is a typo or just broken code. A lot of people complain about feh, but it does do the job. An alternative version of this is to use Kodi, but that seems like a lot of install to do the same job.
- What does sleep 10 do ?
Ah yes, the mystery command … I will find you and work out what you do !
- Running low on biscuits.
Ever the eternal battle for mankind. At 1 am when you can’t drink anything more and the biscuit barrel is empty!
FINAL THOUGHTS
Although it was hard work, I’ve not done any Linux/Unix for decades, I did actually have a load of fun. Especially when I couldn’t get it to work. I actually tried to work out the problem and it was only when I couldn’t, did I watch the video clip and spot the sleep command.
Hope that was useful to you ! Please let me know how you get on – and good luck!
If you spot any mistakes or have some comments, feel free to contact me:
[gravityform id=”1″ title=”false” description=”false”]



Leave a Reply