Advertisement
Tronnic

RPi Touchscreen / TouchUI installation guide

Aug 8th, 2018
9,999
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.31 KB | None | 0 0
  1. https://www.thingiverse.com/thing:3030160
  2.  
  3. 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!
  4.  
  5. This tutorial works with my hardware. If you are using a different Pi / Touchscreen combo this may not work.
  6. 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")
  7. Raspberry Pi 3 Model B: https://www.amazon.de/gp/product/B01CD5VC92/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
  8. 40mm USB Fan: https://www.amazon.de/gp/product/B074YGZHQG/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
  9. Heatsinks: https://www.amazon.de/gp/product/B07C5NM8XR/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1
  10. Power-Adapter: https://www.amazon.de/gp/product/B01E75SB2C/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
  11. MicroSD: https://www.amazon.de/gp/product/B06XFSZGCC/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
  12. PiCam V2.1: https://www.amazon.de/gp/product/B01ER2SKFS/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
  13. PiCam Cable: https://www.amazon.de/gp/product/B075PH4MWG/ref=oh_aui_search_detailpage?ie=UTF8&psc=1
  14.  
  15. Software / Files you need:
  16. Install Etcher (Software to flash SD Cards) https://etcher.io/
  17. Install Win32DiskImager (Software to backup) https://sourceforge.net/projects/win32diskimager/
  18. Install PuTTY (SSH Software to access your Pi) https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
  19. Install Notepad++ (Software to edit textfiles, do NOT use Windows Notepad) https://notepad-plus-plus.org/download/
  20. Download latest Octopi image https://octoprint.org/download/
  21.  
  22. Lets get started:
  23. 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.
  24.  
  25. Unplug your MicroSD Card and replug it again. Windows will show an error and wants to format your drive. DO NOT DO THIS.
  26.  
  27. 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.
  28.  
  29. 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.
  30.  
  31. Eject and remove the MicroSD from your computer and plug into your raspberry. You can already attach the touchscreen.
  32.  
  33. 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
  34.  
  35. Do the initial configuration and set up Octoprint according to your liking. Go into Settings > Octoprint > Plugin Manager > Get More... and install TouchUI
  36.  
  37. 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.
  38.  
  39. Plug your pi back in, wait till its fully booted (check webinterface)
  40.  
  41. Open PuTTY, type octopi.local or Pi's IP into the box Host Name, Use Port 22 (SSH) and hit Open (bottom right)
  42.  
  43. A black window should pop up, login with username "pi", hit enter, type password "raspberry". You should now see the raspberrys console (pi@octopi:~ $)
  44.  
  45. Pay close attention now, follow each step exactly. When your pi wants you to confirm something, hit Y to accept.
  46.  
  47. 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:
  48.  
  49. sudo apt-mark hold raspberrypi-bootloader
  50. sudo apt-get update
  51. sudo apt-get upgrade
  52. git clone https://github.com/goodtft/LCD-show.git
  53. chmod -R 755 LCD-show
  54. cd LCD-show/
  55. sudo ./LCD35-show
  56.  
  57. Your pi should restart automatically, your display should be active now showing console. Major step done! :)
  58.  
  59. Lets rotate the screen to fit our mount (if you do not need screen rotation skip this step)
  60.  
  61. Close your old putty window, start putty again, login to your pi.
  62.  
  63. Type the following:
  64.  
  65. sudo nano /boot/config.txt
  66.  
  67. scroll all the way down (using arrow keys) and change dtoverlay=tft35a to dtoverlay=tft35a:rotate=270
  68.  
  69. Press CTRL+O > ENTER > CTRL+X to save & exit (CTRL = STRG in german)
  70.  
  71. Type the following:
  72.  
  73. sudo reboot
  74.  
  75. Your Pi will restart and the display should have the correct orientation
  76.  
  77. 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:
  78.  
  79. sudo apt-get install --no-install-recommends xinit xinput xserver-xorg xserver-xorg-video-fbdev x11-xserver-utils matchbox unclutter chromium-browser
  80.  
  81. sudo nano /usr/share/X11/xorg.conf.d/99-fbdev.conf
  82.  
  83. Copy & paste the following:
  84.  
  85. Section "Device"
  86. Identifier "touchscreen"
  87. Driver "fbdev"
  88. Option "fbdev" "/dev/fb1"
  89. EndSection
  90.  
  91. Press CTRL+O > Enter > CTRL+X
  92.  
  93. Type the following into the console:
  94.  
  95. sudo sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
  96.  
  97. If it fails, simply ignore it. It will still work.
  98.  
  99. git clone https://github.com/BillyBlaze/OctoPrint-TouchUI-autostart.git ~/TouchUI-autostart/
  100. sudo cp ~/TouchUI-autostart/touchui.init /etc/init.d/touchui
  101. sudo chmod +x /etc/init.d/touchui
  102. sudo cp ~/TouchUI-autostart/touchui.default /etc/default/touchui
  103. sudo update-rc.d touchui defaults
  104. sudo reboot
  105.  
  106. 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!!)
  107.  
  108. Close old putty window, open putty, login to your pi.
  109.  
  110. Type the following:
  111.  
  112. sudo nano /etc/X11/xorg.conf.d/99-calibration.conf
  113.  
  114. Delete everything in there and insert the following:
  115.  
  116. Section "InputClass"
  117. Identifier "calibration"
  118. MatchProduct "ADS7846 Touchscreen"
  119. Option "MinX" "3914"
  120. Option "MaxX" "62713"
  121. Option "MinY" "3021"
  122. Option "MaxY" "61593"
  123. Option "SwapXY" "0" # unless it was already set to 1
  124. Option "InvertX" "0" # unless it was already set
  125. Option "InvertY" "0" # unless it was already set
  126. Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
  127. EndSection
  128.  
  129. Press CTRL+O > Enter > CTRL+X
  130.  
  131. sudo reboot
  132.  
  133. Your pi will restart, touch UI should load and the touchscreen should work! Congrats, almost there! ;)
  134.  
  135. Optional: Lets enable the Pi's Camera
  136.  
  137. Close old Putty window, open new one, login to your pi
  138.  
  139. sudo raspi-config
  140.  
  141. Select Interfacing Options
  142. Select Camera
  143. Select Yes
  144. Select Finish and reboot
  145.  
  146. Your Pi's camera should be enabled now.
  147.  
  148. After your Pi is booted up, open your browser, go to Octoprint (http://octopi.local), open your settings and select "Webcam & Timelapse".
  149.  
  150. Change Stream-URL to http://YOUR-PI's-IP-ADRESS:8080/?action=stream
  151.  
  152. Your almost done!!
  153.  
  154. 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.
  155.  
  156. Please make sure to always shut down your pi! Unplugging it from power directly without shutdown can break your installation.
  157. Trough the Octoprint Webinterface: https://i.imgur.com/l59gbgB.png
  158. Or trough PuTTY:
  159. sudo shutdown now
  160. OR
  161. sudo reboot
  162.  
  163. Done! I hope this was helpful to you. <3
  164.  
  165.  
  166. 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:
  167.  
  168.  
  169. Open Putty, Login to your pi
  170.  
  171. Type the following:
  172.  
  173. ~/oprint/bin/pip install https://github.com/foosel/OctoPrint/archive/1.3.8.zip
  174. sudo reboot
  175.  
  176. TouchUI should load correctly now.
  177.  
  178. Have fun with your new setup guys. If you need any help I'll try my best to help you out.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement