Skip to main content
Tim's (still) not blogging

OctoPrint with touch screen

Finally something to do with all of these Raspberries Pi I own. Turns out I have a camera and a 3.5″ PiTFT LCD touchscreen.

Adafruit’s docs for https://learn.adafruit.com/3-dot-5-pitft-octoprint-rig mention that if your OctoPrint install is based on debian/raspbian/raspios lite, you’re out of luck. And since OctoPi looks so nicely prepackaged, I didn’t want to have to install everything manually.

So I decided to build my own OctoPi image from the non-lite raspios image. That was pretty easy, since OctoPi has good instructions. No sense burning my SSD cycles on this, so I:

Spun up a DO droplet with Ubuntu 21.04
Followed OctoPi build instructions, but substituted https://downloads.raspberrypi.org/raspios_armhf_latest instead of lite
Ran build
gzipped, downloaded, imaged to SD card

Then I followed the PiTFT easy instructions for FBCP https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/easy-install-2 , but I still couldn’t get a GUI on the screen. There was a part of the OctoPi build script that disabled lightdm, and I tried to re-enable, but didn’t have much luck with that.

Eventually I found an OctoPi console message that I should have seen sooner, which says to run sudo /home/pi/scripts/install-desktop to add a GUI. This worked on the public OctoPi lite image, so I burned down all of my custom build.

So the short version is:

Stock OctoPi image
sudo /home/pi/scripts/install-desktop
sudo python3 adafruit-pitft.py --display=35r --rotation=90 --install-type=fbcp
Install TouchUI plugin in OctoPrint

sudo apt-get install -y chromium

raspi-config lets you easily set up auto-login, but it took me a long time to find how to open the OctoPrint web UI on login.

https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup#method-2-autostart

vi /home/pi/.config/autostart/octoprint-ui.desktop

[Desktop Entry]
Type=Application
Name=OctoPrint UI
Exec=chromium --start-fullscreen http://localhost/



Update

Screensaver/lock still kicks in, and sometimes it doesn’t load on boot (maybe octoprint isn’t running yet?)

Found another tutorial with setup scripts, might try those.