I have a customer who needed several non-interactive displays for their business. There are in fact many reasons you might want this; for example, menu displays in a restaurant are often done like this. My customer needed these displays in public areas where there would be little room to hide a computer. We wanted to display a (local, intranet) web page which would update itself nearly in real-time to follow some business statistics, but we could have been displaying pretty much anything.
My solution was to use the Raspberry Pi Zero W, a tiny single-board ARM computer with built-in wifi. The system boots from a micro SD card, which you preload with a copy of what they now call Raspberry Pi OS. Basically it’s a customized Debian installation.
Note that these instructions are relevant as of November 2020. If it’s been a while since I wrote this, well, expect some changes. Also note, this is my very easy way of setting up such a display; don’t expect it to be the most efficient or elegant solution, just one that works.
To begin, download the Raspberry Pi OS Lite image from the website here and copy it to an appropriate micro SD card (there are instructions on the site). We’re using the “Lite” image so we can install just what we need.
Set up your Raspberry Pi for interactive use for the moment. You probably won’t need a mouse but you will certainly need a keyboard. Put in the card you prepared and power it up. When it gets to the login prompt, the username is pi and the password is raspberry.
We are running without a GUI, so to connect to the Internet we need to connect to wifi using the raspi-config script:
$ sudo raspi-config
In the provided menu, go to Network Settings. After selecting your country, you’ll be prompted for SSID and passphrase. Note that if you are using a wired model of Raspberry Pi, you won’t have to do this step; however, you still need to be in raspi-config for the next part.
Next, go to Localisation Options and set up your country and time zone information. You might not need this, but it only takes a moment so why not?
Now, and this is kind of important, go to the Advanced Settings and disable Screen Blanking. In the same menu, choose the option to expand the partition so you have all the available space allocated.
With all of that done, exit the menu using the Finish option, and let it reboot, and log in again.
Now we should update the operating system, and install some packages we need for this project:
$ sudo apt update $ sudo apt upgrade $ sudo apt install chromium openbox lightdm
Chromium will be used to display whatever information we are wanting to show. Installing OpenBox will automatically install a minimal X Windows environment; OpenBox has a simple mechanism for automatically starting programs and does not show any menus or widgets on the screen by default (as in olden days, you click on the root window to get a menu). LightDM will permit us to arrange automatic login, so the system will go straight to our screen view.
After all of these installations are done, there are several things you need to do. First, go back into raspi-config (as above) and choose System Options, Boot / Auto Login, then Desktop / CLI. Choose the option for a graphical desktop with automatic login, then exit out as before.
DON’T reboot yet! Now we need to set up the autostart situation for the default “pi” user account to autostart a Chromium session. In the folder $HOME/.config/openbox edit (or create) a file named autostart and put in these lines:
#!/bin/bash xset -dpms xset s off xset s noblank /usr/bin/chromium --noerrdialogs --disable-infobars --kiosk https://my.website.com/
The first three lines are intended to prevent the screen from blanking. Even though you turned it off in raspi-config, X may still want to blank the screen, and you don’t want that.
The third line starts a Chromium session, with no navigation or informational bars, no error dialogs, and in “kiosk mode.” These options should present a totally blank, frameless window in which your chosen web page will appear. Of course, you must change the URL given to whatever page you have chosen to display.
Don’t forget to mark the file readable and executable:
$ chmod a+rx .config/openbox/autostart
Now, reboot. With any luck, everything will Just Work…
BUT IT DIDN’T
The only problem I’ve encountered with this procedure is that the chromium package doesn’t work right on some Raspberry Pi units, and no, I don’t know why. I get “Illegal Operation” as an error output on those systems. The best option I’ve found is to substitute the chromium-chromedriver package:
$ sudo apt install chromium-chromedriver
Note that apt will uninstall the chromium package when you do this; also, you have to change your command path from /usr/bin/chromium to /usr/bin/chromium-browser in the autostart file. So far this has worked reliably for me when the error occurs. Possibly I should update the instructions above and just run this package by default, but as of right now I have Raspberry Pi units working both ways.
You can install OpenSSH for remote access. If you do this, first CHANGE THE PASSWORD from the default!
$ passwd $ sudo apt install openssh
If you are setting up the Raspberry Pi on one network, but intend to deploy it to another, the handy wifi setup tool Comitup may be helpful. Installing it is easy:
$ sudo apt install comitup
Using it is pretty simple too; I don’t think I can improve on the original author’s docs here: https://davesteele.github.io/comitup