Lately I have been asked to provide information screens for the company I work for. Despite the apparent simplicity, it is one thing to do that at home on a single unit, and another to do it on an industrial level where you need to change information at a snap on differing displays.
There are actually a number of ways to go about this. The simplest is just writing your data on a USB stick and let it run. This carries many disadvantages. Another one is using RF cables, and finally, conveniently using a tiny Single Board Computer (SBC).
As a tech nerd, working in an Automation company, I obviously opted for the third one. This is because any TV can start up to a signal, but NONE can do that and run info from a usb stick automatically. It’s just the way TV interfaces are made.
Having some experience of them over the years, I chose the RaspberryPI computer.
I needed time to think this over, as despite it not being my money, I did not want to incur more expenses. Finally I found the time to experiment with my own Pi and 50 inch TV plonked on my desk… (yes, my eyes are burning).
The way I figured it out is: I need a computer with a slide-show viewer, with the ability to change images from any desktop computer running any operating system.
A ‘headless’ raspberry PI with HDMI output seems perfect for the job. Small, low powered, incredibly adaptable, and above all… very cheap!
Setting up Raspbian.
First of all, I installed my Rpi with Raspbian. Easy Peasy. There are many tutorials on the internet to do that, so I will not go into detail about it.
Setting up Screen modes.
There are two things that are important here. Set the TVs in ‘STORE’ mode, so they do not switch off after a time limit, ever. and of course, preventing the Raspberry Pi from going to sleep! (The TV needs to wake up via a timer. This, in turn powers the PI via the USB on the TV itself, which boots up automatically, sense an HDMI signal and starts ‘playing’.)
To keep the pi screen on indefinitely, we need to edit the lightdm file. Open Terminal on the PI and enter the following. Most of the commands will be done via Terminal! As long as the text is followed exactly, there is little chance of a problem.
sudo nano /etc/lightdm/lightdm.conf
Add the following line anywhere beneath the [SeatsDefaults] line.
xserver-command=X -s 0 –dpms
Obviously Save & exit by pressing ctrl+x and then y. Now the pi needs to be restarted. The command is below.
Now, a really important part of the process is to have the Pi available under SSH, so that we can use Putty to access the machine and Bitvise (or FileZilla) to transfer data. With this we can keep the pi totally headless (unattended, no keyboard, no mouse).
SSH, or secure shell for anyone who is unfamiliar with the term is a common cryptographic protocol for communication over networks. It allows us to be able to use command-line without actually being on the Pi.
The Raspberry Pi SSH Setup requires us to use the raspi-config tool to allow SSH connections. To do this, we will need a keyboard, mouse and a screen for the Pi. Once we have done this, we no longer require any of these pieces of equipment.
First turn on and log in to the Raspberry Pi. (Remember default username is pi and password raspberry)
If you need the IP Address now would be a good time to get it. To do this simply type:
Now type the following command:
Now in here go to Interfacing Options->SSH (Previously Advanced Options->SSH) (in these screens you need to use the arrow keys, and return.
Enable SSH and reboot the Pi. That’s all there is to it.
Now that we have enabled SSH we will need to connect from another computer.
This is done using a free software called Putty. On MAC computers you just need to type ssh email@example.com substituting the Xes with the numbers obtained previously from hostname -I.
OK, back to the PC. Putty is really easy to use, and a doddle to download. Go to putty.org and download the version for Windows.
Once that is installed, run Putty.
In the screenshot (above) there are only two things you need to fill in… the IP of the RPi (obtained as explained via hostname -I), and the port… that should be 22. Click on ‘open’, at which point you will be met with a security alert.
This is because the PC does not ‘know’ the RPi yet. Obviously, click on yes…otherwise it would be a short-lived tutorial.
The RPi will ask you for a login and password… these are pi and raspberry. (My suggestion is that you change the password, unless it is for home use. I changed it to a shorter code…less prone to mistakes.)
That’s it. A terminal window will open at your end, and you are able to send commands remotely rather than needing to be at the RPi itself. An example window is shown below.
Setting up the slideshow!
To set up our slideshow, we’re going to use the Feh package. Feh is an image viewer and cataloguer. It is a fast image viewer that doesn’t get bogged down with huge GUI dependencies. I chose this as it was the most lightweight package that worked without any huge complications.
Again, from the Terminal, type the following to get the software package.
sudo apt-get install feh
Raspbian will ask you whether to install this. Yes, obviously.
Now to test that it works, you can enter the following line. (What I did prior to this write-up, is to download a few images via the Chromium browser on the Pi and save them in the Pictures folder. You can of course use different folders, or even chuck them on a pen-drive, but for now, the Pictures folder is our target.
This is to get acclimatized with the terminal, then we can change to our heart’s content.
Let’s start with the following command.
sudo nano /home/pi/startpf.sh
(sudo is for Super User Do), while nano is the text editor. StartPF is short for Start Picture Frame… it can be anything you wish.
Since the file does not exist, Raspbian will conveniently create an empty file for you. Enter the following lines. Linux distinguishes between upper and lower characters, so make sure you enter this correctly!
DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority /usr/bin/feh -q -p -Z -F -R 60 -Y -D 15.0 /home/pi/Pictures
(From Display to Pictures everything must be on the same line). Save and exit (CTRL-X and Yes)
(( PS. The 15.0 is the time interval you need each picture shown. In this case, 15 seconds. A more viable one would be 7.0 ))
That’s it. You can run the program by typing the following command in Terminal.
Getting the show to run on bootup.
I will be using this on a TV system in a factory, so I obviously just need someone (or something, such as a SONOFF) to switch the tv on and the show can run by itself. The huge advantage of this is that from my office I can SSH into each RPi individually and change the order of slides on the fly … remove some of them, add new ones… whatever.
So I can choose to transmit a ‘noticeboard’ to the TV in a canteen, and efficiencies to differently located TVs on the production floor.
Again, this is a fairly easy procedure to do but it is important that you have SSH enabled so you can access the Pi remotely as you will lose access to the GUI/Screen. So make sure you have done this before setting it to launch at boot up.
To do this we must edit the startup file on the RPi. Open up the rc.local file by entering the following command.
sudo nano /etc/rc.local
Add the following before the exit 0 line in this folder.
bash /home/pi/startpf.sh &
If you ever need to kill the process (say you may want to access the desktop, simply enter the following line in your terminal. (Remember you must be SSHed)
sudo pkill feh
You should now have your very own slideshow of pictures going.Since feh is a highly versatile software, it allows you to modify the content of the folder on the fly.
This is done via FileZilla, BitVise, or even from the Pi itself.
I hope that everything is clear. I have checked all the commands and despite the lengthy text, it is a very easy process to go through with.
In essence, they are the following:
set screen to never switch off.
set up SSH.
set up slideshow (install feh).
create parameters for slideshow.
run slideshow on bootup.
That’s all. I hope this has been of help.
Live Long and Prosper.