09. Setup With An Attached Screen - larry-athey/rpi-smart-still GitHub Wiki
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 11 comes with only the Chromium web browser installed. This system's user interface was designed using Firefox so you will want to remove all Chromium components and replace it with Firefox. Use the commands below in a terminal to remove Chromium and then install Firefox. (No, you don't need the mobile version of Firefox to use this on your phone)
sudo apt purge chromium* -y
sudo apt install firefox-esr fonts-stix -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. Enable autoplay if you want to have voice prompts spoken. I would also recommend getting rid of the "uBlock Origin" ad blocker extension that is usually 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.
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-esr -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. (Most cheap Raspberry Pi screens will go to a blue background with a static "No Signal" banner when LXDE shuts down the HDMI port, which will burn into your screen)
sudo nano /etc/lightdm/lightdm.conf
Find the line that starts with "xserver-command=X" under the [Seat:*] section, 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. I also just use a basic screen saver (Shade Bobs) that doesn't bog down the CPU.
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.5
xrandr --output HDMI-1 --gamma 0.9
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. In case you are wondering, no, there is no contrast setting. You use the gamma value for this. Above 1 shifts to cooler (blue) and below 1 shifts to warmer (red).
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.5
@xrandr --output HDMI-1 --gamma 0.9
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, change the appearance, removing apps, customize 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-esr.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/lib/firefox-esr/firefox-esr -kiosk %u
If you are using a Model 3 B+, you will be using most of your RAM and will want to increase the swap file size so that rarely used background services aren't always resident in memory. By default, Raspbian 11 only allocates 100 MB for the swap and Raspbian 12 only allocates 200 MB. Even in the Windows world, the swap (or paging) file size is 1.5 times the amount of RAM. I've found that on a Model 3 B+ just 512 MB is more than enough for this system.
sudo nano /etc/dphys-swapfile
Change CONF_SWAPSIZE=100 to CONF_SWAPSIZE=512
Save and exit, then sudo reboot