Skip to content

09. Setup With An Attached Screen

Larry Athey edited this page Sep 18, 2024 · 61 revisions

First off, I want to make it clear that those 7" touch screens that you see on Amazon are pretty much only worth their asking price. Don't expect a top quality screen for $40, and don't expect their touch screen input to be anywhere near as reliable as the touch screen on your phone or tablet. (You'd be smarter to add a $10 game controller style miniature keyboard to your order at the same time) Perhaps the ones from https://www.adafruit.com are better. Be sure that the screen that you order is at least 1024x600 resolution or the user interface won't fit without zooming out the browser.

At the time of this writing, Raspbian 12 comes with Chromium and Firefox installed with Chromium as the default web browser. This system's user interface was designed using Firefox so you will want to remove all Chromium components using the following command in a terminal. (No, you don't need the mobile version of Firefox to use this on your phone)

sudo apt purge chromium* -y

Start Firefox after that and go into the settings. You will want to set it so that its homepage is http://localhost and opens to that page on startup. I would also recommend getting rid of the "uBlock Origin" ad blocker extension that is installed by Raspbian since it will just be adding extra CPU load to the browser. You certainly won't be cruising websites on your little screen during a distillation run. (The settings search field is your friend)

When Firefox is running, you will want to run it full screen so the user interface takes up every pixel of screen real estate. You can do this by pressing the F11 key, or you can click on your start button, then click Run, then type "firefox -kiosk". This prevents your mouse from making the window header appear when you move to the top of the screen. Keep in mind that when Firefox is running in kiosk mode, the only way to quit Firefox is to press CTRL-Q.

Next up...Raspbian's LXDE display power management. We don't need this, all we need is a screensaver (which they also neglected to install). The default power management turns off the display power after 5 minutes of inactivity, and there is no desktop app for adjusting this. So, I figure we might as well get rid of it all together since the screen is really only used when the smart still controller system is in use.

sudo nano /etc/lightdm/lightdm.conf

Find the line that starts with "xserver-command=X", uncomment it, and change it to the following.

xserver-command=X -s 0 -dpms

Next, we need to install the X Screensaver package that Raspbian neglected to install, although the LXDE auto start configuration file has the daemon startup command in it. You definitely want this installed because LCD screens still have the image burn-in problem that old CRT monitors had. Since the user interface doesn't change much while in operation, there is pretty much a guarantee that it will burn into the screen.

sudo apt install xscreensaver -y

After it's installed, click on your start button, then click on Preferences, then click on XScreenSaver Settings. You will be immediately prompted to allow it to start the daemon, just answer Yes to that. It will automatically start on reboot after this. Select the screensaver you like (ones in white lettering are already installed). I only use one screen saver and have it set to start after 30 minutes. You use whatever you think is best. You don't want to set it to start after too long or you'll end up with an image burn-in that may never wear off.

Lastly...We will address the atrocious picture quality of those $40 Amazon displays. These usually have no controls for setting brightness, contrast, gamma, etc. Fortunately, we can control this at the software level by telling the Xorg system to adjust its own rendering. I fixed mine by executing these two commands in a terminal and adjusting their values until I got what I wanted.

xrandr --output HDMI-1 --brightness 1.7
xrandr --output HDMI-1 --gamma 1.8

After finding the settings that work best for your screen, you can add these commands to the main LXDE startup so they are applied every time your system starts up.

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Then add the commands to the bottom of the configuration file like this.

@xrandr --output HDMI-1 --brightness 1.7
@xrandr --output HDMI-1 --gamma 1.8

This covers the minimum necessities for setting up your system with an attached LCD screen. Reboot and you're ready to go. Anything else would merely be personal preferences. Such as sound volume, rotating the screen if necessary to re-orient the power and HDMI cables, switching to the dark theme, customizing menu bar app launchers, etc.


Additional Tips:

If you want remote desktop access into your system and you don't want to mess with setting up a RealVNC account in order to use the VNC server that comes with Raspbian by default, see the following tutorial. This will automatically uninstall the existing RealVNC server and install Tiger VNC in its place. Keep in mind that this doesn't share the same desktop session as your logged in account and the VNC server runs on port 5901.

https://pimylifeup.com/raspberry-pi-vnc-server/

If you want a separate launcher that automatically starts Firefox in kiosk mode, all you need to do is make a copy of the existing firefox.desktop launcher and edit a few lines.

sudo cp /usr/share/applications/firefox.desktop /usr/share/applications/firefox-kiosk.desktop
sudo nano /usr/share/applications/firefox-kiosk.desktop

Then make the following changes to the launcher file. So long as your start/home page is set to http://localhost it will start up at the user interface in full screen mode.

Name=Firefox-Kiosk
Comment=Start Firefox in kiosk mode
Exec=/usr/bin/firefox -kiosk %u