Octoscreen install on Pi4 with 3.5" UCTRONICS spi display

I've been using Octoprint for several years but stopped using it for a little while after buying a Qidi X-Pro because it was not 100% Octoprint compatible.I came back into the fold no to long ago and decided to setup Octoprint on the X-Pro and it's worked good for some time now. Recently though I wanted to give TouchUI a shot and got it working before finding Octoscreen and switched before ever deploying TouchUI. As a fair linux newb I spent a few days researching and working through all the steps needed to get this up and running. Since I would have really appreciated a walk through I documented my steps to get this working and wanted to publish them here to help anyone looking to do the same or similar.

The hardware used are a Raspberry Pi4 4gb and a 3.5" UCTRONICS SPI display, this is not the HDMI version and some steps below are specific to a SPI interface so take note if your using a different setup. Also a shout out to UCTRONICS as I found a couple errors in the Octoprint drivers they published and they fixed the github drivers in like 12 hours.

Disclaimer, I did my best to document this process as I went through and I believe this is correct. I highly recommend using a different MicroSD card if you're already running a Octopi server to make sure it works for you and then attempt to update an existing servers. Now on to the steps I used, if you see errors, comments or questions feel free to message me or respond to this thread.

#Raspberry Pi4 4gb
#UCTRONICS 3.5" SPI Display U6111
#Installed latest Octoprint to MicroSD
#OctoScreen Install https://github.com/Z-Bolt/OctoScreen/
#Using default raspberry password through this after each sudo as needed.

#Putty login in pi:raspberry
sudo apt-get update
password: raspberry
sudo apt-get upgrade
Y #Yes
Q #Quit the changelogs
sudo reboot now

#Putty login in pi:raspberry
git clone https://github.com/UCTRONICS/UCTRONICS_HSLCD35.git
cd UCTRONICS_HSLCD35/Octoprint
sudo chmod +x UCTRONICS_HSLCD35_SHOW
sudo ./UCTRONICS_HSLCD35_SHOW
Forced Reboot

#PreRequisite install for OctoScreen
sudo apt-get install libgtk-3-0 xserver-xorg xinit x11-xserver-utils
Y #Yes
sudo apt-get install git build-essential xorg-dev xutils-dev x11proto-dri2-dev
Y #Yes
sudo apt-get install libltdl-dev libtool automake libdrm-dev
Y #Yes
git clone https://github.com/ssvb/xf86-video-fbturbo.git

cd xf86-video-fbturbo
autoreconf -vi
./configure --prefix=/usr
make
sudo make install
sudo cp xorg.conf /etc/X11/xorg.conf

wget https://github.com/Z-Bolt/OctoScreen/releases/download/v2.5.1/octoscreen_2.5-1_armhf.deb
sudo dpkg -i octoscreen_2.5-1_armhf.deb

#While the display works at command prompt it would not display correctly in Octoscreen
#so changing fb1 to fb0 allowed this to work.
sudo nano /etc/X11/xorg.conf.d/99-fbdev.conf
Change: Option "fbdev" "/dev/fb1" to Option "fbdev" "/dev/fb0"
Ctrl-O, enter, Ctrl-X
sudo reboot now

sudo nano /etc/octoscreen/config
OCTOSCREEN_RESOLUTION=800x600 #the display is only 480x320 but 800x600 is needed & works
Ctrl-O, enter, Ctrl-X

#Install fbcp to "clone" the HDMI output:
git clone https://github.com/tasanakorn/rpi-fbcp
cd rpi-fbcp
mkdir build
cd build
cmake ..
make
sudo install fbcp /usr/local/bin/fbcp

#Make fbcp start on every boot:
sudo nano /etc/rc.local
#Go at the end of file right before "exit 0" insert this line:
/usr/local/bin/fbcp &
Ctrl-O, enter, Ctrl-X

sudo nano /boot/config.txt
#Uncomment & change these lines
framebuffer_width=800
framebuffer_height=600

#Update the line near the bottom to:
hdmi_cvt 800 600 60 6 0 0 0
Ctrl-O, enter, Ctrl-X

#At this point the screen should display Octoscreen correctly but the touch interface for X & Y
#are inverted and these steps correct this by rotating the touch inputs but not the display.
#Add the option line to the end of libinput touchscreen section
sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf
#Section "InputClass"
#Identifier "libinput touchscreen catchall"
#MatchIsTouchscreen "on"
#MatchDevicePath "/dev/input/event*"
#Driver "libinput"
Option "TransformationMatrix" "0 -1 1 1 0 0 0 0 1"
#EndSection
Ctrl-O, enter, Ctrl-X
sudo reboot now

sudo service octoscreen stop
sudo apt-get install -y xinput-calibrator
password: raspberry

sudo xinit ~/TouchUI-autostart/helpers/calibration.xinit *
sudo reboot now

#Putty login in pi:raspberry
sudo raspi-config
#option 1 change the password to something other than raspberry #justdoit

octoprint.local login to frontend
Complete Octoprint Setup Wizard
Update Octoprint to 1.4.2 (or the most current)
Reboot

3 Likes

Thanks for putting this guide together. I have the exact configuration you have and have been having an incredibly challenging time getting it to work. I've started from a scratch install with your guide and hit this point (everything is working wonderfully). Since I started with a fresh install I no longer have TouchUI installed on the Pi4/Octoprint. Do I still need to install the TouchUI plug-in to run Octoscreen?

Your guide is awesome. I've been working on the same for TouchUI, but got stuck on the last few steps you have here.