I picked up this cheap screen on Ebay with case and heatsink for $20. I spent hours trying to get this to work. I probably failed at least 30 times before I got this to go. I put this document together to help other people out and help me remember in case I have to go back and reinstall Octoprint. I picked up bits from the internet until I got something to work. The drivers from goodtft and waveshare will crash raspbian buster. The drivers are built in and you don’t to install the manufacturer drivers.
Step 1.
First of all enable SPI by using the terminal command:
raspi-config
Navigate to ‘Advanced options’ and then enable SPI
Reboot if needed through the command in the terminal:
sudo reboot
The touch screen should turn on and be white colored.
Step 2.
If your still running the Buster beta upgrade to the latest stable kernel
sudo apt-get update --allow-releaseinfo-change
Give the following command to update and upgrade Raspian:
sudo apt-get update
sudo apt-get upgrade
sudo reboot
Step 3.
Now to modify the configuration file to configure the display
sudo nano /boot/config.txt
then add this line to the bottom
dtoverlay=piscreen,speed=16000000,rotate=90
give Ctrl+X, Y, and Enter. (This saves the file)
Give the command:
sudo reboot
Unplug your HDMI cable if you have it plugged in
You now see Linux booting up on the 3.5 inch touch screen.
Step 4.
Log into you Octoprint and install the touch UI plugin. Run the following command to install X and touch screen auto login/boot into touch mode
git clone GitHub - BillyBlaze/OctoPrint-TouchUI-autostart: Startup files for TouchUI ~/TouchUI-autostart/
sudo ~/TouchUI-autostart/helpers/install
When done
sudo reboot
You should now see Octoprint fire up and go into touch screen mode
Step 5.
At this point your Octoprint should be loaded but your mouse and touch screen will probably be moving backwards. In the newer (Jessi, Buster) versions of Raspbian they changed input control from
evdev to libinput. You need to install evdev or it will ignore your
99-calibration.conf configurations.
sudo apt-get install xserver-xorg-input-evdev
sudo reboot
You can now modify your 99-calibration.conf file
sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf
Copy and past below
Section “InputClass”
Identifier “calibration”
MatchProduct “ADS7846 Touchscreen”
Driver “evdev”
Option “Calibration” “3936 227 268 3880”
Option “InvertY” “true”
Option “InvertX” “false”
EndSection
Save and reboot
sudo reboot
Your Raspberry Pi 4 should come up now. Touchscreen should be working in the right direction.