User Tools

Site Tools


octoprint-touchui_setup

(from https://pastebin.com/rsMa5K1v & https://www.thingiverse.com/thing:3030160)

Octoprint TouchUI

https://www.thingiverse.com/thing:3030160
 
It can be a huge hassle to get TouchUI & your touchscreen running. I spend almost 2 days figuring out, getting information from different surces and ran from issue to issue. These are the steps I made to get mine working (Windows 10 64bit). Follow them closely and yours should work as well!
 
This tutorial works with my hardware. If you are using a different Pi / Touchscreen combo this may not work. 
Touchscreen im using: Elegoo Display 3.5" https://www.amazon.de/gp/product/B01JRUH0CY/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1 (Identifies within the pi with "ADS7846 Touchscreen")
Raspberry Pi 3 Model B: https://www.amazon.de/gp/product/B01CD5VC92/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
40mm USB Fan: https://www.amazon.de/gp/product/B074YGZHQG/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
Heatsinks: https://www.amazon.de/gp/product/B07C5NM8XR/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
Power-Adapter: https://www.amazon.de/gp/product/B01E75SB2C/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
MicroSD: https://www.amazon.de/gp/product/B06XFSZGCC/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
PiCam V2.1: https://www.amazon.de/gp/product/B01ER2SKFS/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
PiCam Cable: https://www.amazon.de/gp/product/B075PH4MWG/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
 
Software / Files you need:
Install Etcher (Software to flash SD Cards) https://etcher.io/
Install Win32DiskImager (Software to backup) https://sourceforge.net/projects/win32diskimager/
Install PuTTY (SSH Software to access your Pi) https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Install Notepad++ (Software to edit textfiles, do NOT use Windows Notepad) https://notepad-plus-plus.org/download/
Download latest Octopi image https://octoprint.org/download/
 
Lets get started:
Insert your MicroSD Card (I recommend at least 8GB Class 10 or U1), Run Etcher, Select Octopi Image, Select your MicroSD Card and hit Flash. Wait untill it's done. 
 
Unplug your MicroSD Card and replug it again. Windows will show an error and wants to format your drive. DO NOT DO THIS.
 
Open your MicroSD Card (Drive is called "boot"). Open the file "octopi-wpa-supplicant.txt" (if you want to enable WiFi), uncomment (remove #) infront of the 4 lines that fits your WiFi and input your SSID and password. Save and Exit.
 
Optional (if you are using the PiCam V2): Open the file "octopi.txt" with Notepad++, scroll all the way down and uncomment and edit this: camera_raspi_options="-x 800 -y 600 -fps 15 -quality 8" This config works great for me trough wifi. Save and Exit.
 
Eject and remove the MicroSD from your computer and plug into your raspberry. You can already attach the touchscreen. 
 
After your Pi is booted up access your pi trough a browser with the Pi's IP (find the ip in your router) or trough http://octopi.local
 
Do the initial configuration and set up Octoprint according to your liking. Go into Settings > Octoprint > Plugin Manager > Get More... and install TouchUI
 
Shutdown your raspberry (do not unplug to turn off, use the web interface, click on the power button in the upper right corner and select "Shutdown System". Wait a few seconds (15 or so) and unplug your pi from power.
 
Plug your pi back in, wait till its fully booted (check webinterface)
 
Open PuTTY, type octopi.local or Pi's IP into the box Host Name, Use Port 22 (SSH) and hit Open (bottom right)
 
A black window should pop up, login with username "pi", hit enter, type password "raspberry". You should now see the raspberrys console (pi@octopi:~ $)
 
Pay close attention now, follow each step exactly. When your pi wants you to confirm something, hit Y to accept.
 
Type the following, line after line. Always wait until the action is complete before you proceed to the next line. Some steps take some time to finish:
 
sudo apt-mark hold raspberrypi-bootloader
sudo apt-get update
sudo apt-get upgrade
git clone https://github.com/goodtft/LCD-show.git
chmod -R 755 LCD-show
cd LCD-show/
sudo ./LCD35-show
 
Your pi should restart automatically, your display should be active now showing console. Major step done! :)
 
Lets rotate the screen to fit our mount (if you do not need screen rotation skip this step)
 
Close your old putty window, start putty again, login to your pi. 
 
Type the following:
 
sudo nano /boot/config.txt
 
scroll all the way down (using arrow keys) and change dtoverlay=tft35a to dtoverlay=tft35a:rotate=270
 
Press CTRL+O > ENTER > CTRL+X to save & exit (CTRL = STRG in german)
 
Type the following:
 
sudo reboot
 
Your Pi will restart and the display should have the correct orientation
 
Close old Putty window, open new one, login to your pi. Type the following to install TouchUI. Note: You can select and copy those lines, paste them into Putty with a simple right click:
 
sudo apt-get install --no-install-recommends xinit xinput xserver-xorg xserver-xorg-video-fbdev x11-xserver-utils matchbox unclutter chromium-browser
 
sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.conf
 
Copy & paste the following:
 
Section "Device"
  Identifier "touchscreen"
  Driver "fbdev"
  Option "fbdev" "/dev/fb1"
EndSection
 
Press CTRL+O > Enter > CTRL+X
 
Type the following into the console:
 
sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
 
If it fails, simply ignore it. It will still work.
 
git clone https://github.com/BillyBlaze/OctoPrint-TouchUI-autostart.git ~/TouchUI-autostart/
sudo cp ~/TouchUI-autostart/touchui.init /etc/init.d/touchui
sudo chmod +x /etc/init.d/touchui
sudo cp ~/TouchUI-autostart/touchui.default /etc/default/touchui
sudo update-rc.d touchui defaults
sudo reboot
 
Your Pi should restart, your touchscreen will come to life and TouchUI will load. Your Touchscreen wont work properly yet. The axes will be inverted. Lets fix that: (NOTE: If TouchUI doesn't load (loads long time, red text) read below!!)
 
Close old putty window, open putty, login to your pi.
 
Type the following:
 
sudo nano /etc/X11/xorg.conf.d/99-calibration.conf
 
Delete everything in there and insert the following:
 
Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "MinX"  "3914"
        Option  "MaxX"  "62713"
        Option  "MinY"  "3021"
        Option  "MaxY"  "61593"
        Option  "SwapXY"        "0" # unless it was already set to 1
        Option  "InvertX"       "0"  # unless it was already set
        Option  "InvertY"       "0"  # unless it was already set
        Option  "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
EndSection
 
Press CTRL+O > Enter > CTRL+X
 
sudo reboot
 
Your pi will restart, touch UI should load and the touchscreen should work! Congrats, almost there! ;)
 
Optional: Lets enable the Pi's Camera
 
Close old Putty window, open new one, login to your pi
 
sudo raspi-config
 
Select Interfacing Options
Select Camera
Select Yes
Select Finish and reboot
 
Your Pi's camera should be enabled now. 
 
After your Pi is booted up, open your browser, go to Octoprint (http://octopi.local), open your settings and select "Webcam & Timelapse". 
 
Change Stream-URL to http://YOUR-PI's-IP-ADRESS:8080/?action=stream
 
Your almost done!! 
 
Shut down your Pi trough the Octoprint interface. Power down and unplug the SD card. Insert it into your windows machine and open up the programm Win32DiskImager. Insert a path and a file name into the empty line. For example C:\backup\octopi_configured.img and hit the "Read" button. When something breaks you can always use Etcher to reflash your OS to your SD card.
 
Please make sure to always shut down your pi! Unplugging it from power directly without shutdown can break your installation. 
Trough the Octoprint Webinterface: https://i.imgur.com/l59gbgB.png
Or trough PuTTY:
sudo shutdown now
OR
sudo reboot
 
Done! I hope this was helpful to you. <3
 
 
NOTE: There is currently a bug in Octoprint V1.3.9 that prevents TouchUI from loading. If you have this problem downgrade your Octoprint installation back to 1.3.8 until the problem is solved. How to do that:
 
 
Open Putty, Login to your pi
 
Type the following:
 
~/oprint/bin/pip install https://github.com/foosel/OctoPrint/archive/1.3.8.zip
sudo reboot
 
TouchUI should load correctly now. 
 
Have fun with your new setup guys. If you need any help I'll try my best to help you out.
octoprint-touchui_setup.txt · Last modified: 2021/02/18 09:35 by orrmany