Setting up Adafruit 3.5" TFT w/ Repetier Server

After trying to setup Octoprint with a plugin called Octoprint TFT where you can control everything from a small touchscreen I realized the amount of aspirin needed to resurrect that plugin wasn't going to go well. One of the members of the Prusa group I admin mentioned that it's easier and works better on Repetier Server.

Easier??? NO. Better? YES!

Documentation was impossible to find to properly make this work even though I found a forum post here that described setting up a different brand screen then finding others having the same issues I was having but the issue not being resolved. 

Spent the better part of 3-4 hours setting it up using what I learned from the Octoprint plugin and viola a tiny Repetier Server that I can control from the front of my printer. 



Step 1: Install latest RPi version of Repetier Server following normal directions
Step 2: Edit config.txt file 

Edit Config.txt file on Boot

Change LCD rotate to 0

lcd_rotate=0


Scroll to this section and make these changes, uncomment 3 lines and single line addition

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
dtoverlay=pitft35-resistive,rotate=90,speed=20000000,fps=20

Save txt file

Step 3: Eject MicroSD card and load up the PI as normal
Step 4: Setup Repetier Server via web interface
Step 5: SSH into your pi

Step 6: Expand the filesystem

sudo raspi-config

Select: 7 Advanced Options => A1 Expand Filesystem

Reboot

Step 7: Install Adafruit Drivers


chmod +x adafruit-pitft.sh

sudo ./adafruit-pitft.sh

Option 4 (rotated 90 degrees)
Option 1
Yes

Reboot

Step 8: Modify screen config

sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf

Add the following

Section "Device"

Identifier "adafruitTFT"

Driver     "fbdev"

Option     "fbdev" "/dev/fb1"

EndSection

^x
Y

Step 9: Set Screen Size

sudo nano /usr/share/X11/xorg.conf.d/40-libinput.conf

I added Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1" in InputClass section dedicated to touchscreens

Section "InputClass"
        Identifier "libinput touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"
EndSection

^x
Y

Step 10: sudo reboot

Should be ready to go but if you need to calibrate the screen here is the step for that

Step 11: Screen Calibration

Manually calibrate screen

sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen ts_calibrate

Head to screen and manually touch each point to calibrate the screen

Reboot and done.


Comments

  • As it is not a question I moved it to tips and tricks. It is a good example of how to install a display driver. That is as I can see the only real problem with our pi image. It is for hdmi output and depending on the display you use, you might need to install vendor drivers and point x window system to the correct screen.
  • edited December 2018
    @Repetier

    What's the process in pointing x windows to the correct screen? If you wouldn't mind typing it up like I'm 5 that's would be awesome since I lack the ability to understand how this all works. Coding is my weakness. I prefer hardware. ????
  • edited December 2018
    it´s in Step 8  : Option     "fbdev" "/dev/fb1"
    the fb1 points to lcd , fb0 would point to hdmi

    to understand it´s best to read lots of threads( know it from my own experience )

    f.e. look at this


  • Hello, I was wondering what is required to change from 90 degrees to 270 degrees. I have the screen displaying the image properly, but touchscreen inputs are registering as though it was still 90 degrees. Thanks for any help.
  • edited January 29
    try as follows:

    sudo apt-get install xinput-calibrator

    sudo nano /usr/share/X11/xorg.conf.d/99-calib.conf

    Section "InputClass"
     Identifier "calibration"
     MatchProduct "ADS7846 Touchscreen"
     Option "TransformationMatrix " "1 0 0 0 -1 1 0 0 1"
     Option "Calibration" "200 3900 3900 260"
     Option "Swap Axes" "1"
    EndSection

    ^X
    Y

    sudo reboot

    also possible:
    If you followed the installation from codiac2600 it might be enough to change transformation matrix in step 9

  • Thank you for the response. I will try it after my current print is finished.

  • Step 7: Install Adafruit Drivers

    wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/adafruit-pitft.sh
    chmod +x adafruit-pitft.sh
    sudo ./adafruit-pitft.sh
    Option 4 (rotated 90 degrees)Option 1Yes
    Reboot


    Step 7 has me scratching my head.

    Specifically the "yes" part

    is it yes to the console option? if so i cant get it to display anything other than console after doing all the steps.

    if its no and then yes to the next question. where it asks if you want it to mirror HDMI.

    then in that instance i cannot get it off a White Screen Display.
     

Sign In or Register to comment.