Raspberry Pi with Octoprint and mcufriend 3" touchscreen issues

Hello,

I received a couple of years ago, an tft lcd 3" screen as a gift, and now, I am considering to use it on my Octoprint server as a screen. I have installed Octoprint on both my Raspberry Pi 2 and 3, and somehow I managed to make the display light up and show the desktop, even TouchUI's user interface. The issue is that I don't seem to get the touch functionality work at all.

The lcd screen has mcufriend written on it, so I tried to google it, without much success. I've managed to found these:

Now, I don't know, if the screen is not a touch one and that is why the functionality is not working, or being Octoprint's Linux build which initially doesn't have a GUI and I need to set additional things to make it work, but my question would be, that what can I do to try and make it work and at the same time, what screen is recommended that is a guarantee success without so much hassle.

Thanks

Visit the Adafruit TFT helper script and run this locally on the Pi as the root user.

this the result:

This script downloads and installs
PiTFT Support using userspace touch
controls and a DTO for display drawing.
one of several configuration files.
Run time of up to 5 minutes. Reboot required!

Select configuration:
1. PiTFT 2.4", 2.8" or 3.2" resistive (240x320)
2. PiTFT 2.2" no touch (240x320)
3. PiTFT 2.8" capacitive touch (240x320)
4. PiTFT 3.5" resistive touch (320x480)
5. Braincraft 1.54" display (240x240)
6. Quit without installing

SELECT 1-6: 1
Select rotation:
1. 90 degrees (landscape)
2. 180 degrees (portait)
3. 270 degrees (landscape)
4. 0 degrees (portait)

SELECT 1-4: 2
[PITFT] Checking init system...
Found systemd
/boot is mounted
[PITFT] System update
Updating apt indexes...
.........
Reading package lists...
.........
[PITFT] Installing Python libraries & Software...
Installing Pre-requisite Software...This may take a few minutes!
[PITFT] Updating /boot/config.txt...
Already have an adafruit-pitft-helper section in /boot/config.txt.
Removing old section...
[PITFT] Updating SysFS rules for Touchscreen...
[PITFT] Updating TSLib default calibration...
Would you like the console to appear on the PiTFT display? [y/n] y
[PITFT] Updating console to PiTFT...
Remove fbcp from /etc/rc.local, if it's there...
Configuring boot/config.txt for default HDMI
Set up main console turn on
/boot/cmdline.txt already updated
Turning off console blanking
Setting raspi-config to boot to console w/o login...
[PITFT] Success!

Settings take effect on next boot.

REBOOT NOW? [y/N]

Say "y" to that prompt and let it reboot. It should have added at least one overlay into the /boot/config.txt file. You might want to review what it added after the fact.

See if touching in the center of the screen at least moves the cursor to the center of the screen. If that works then you know that a touch input device was added. If not, then you might want to further review your device. Look for an extra USB cable from the TFT screen which needs to go into the Pi.

If touching the screen moves the cursor then it probably will work for you (but maybe not). If you installed the Desktop (using the /scripts/add_desktop script, then the Desktop/x11 system is running and the Adafruit's script adjusted the x11-based orientation correctly.

If instead you just have the standard Raspbian Buster Lite without the Desktop then Adafruit's script wouldn't necessarily orient the touch part correctly for console-based apps. See this for the work-around.

I restarted it, and still nothing responsive on the touch part...

Before installing TouchUI plugin for Octoprint, I've installed and enabled X11 desktop and it showed a gray background with a trashcan and normal debian lookalike desktop environment at the correct size. The touch functionality wasn't working and I thought TouchUI will resolve that, but it didn't. Also worth noting that the UI seems huge compared to the debian desktop and I can only see the 3 buttons with State: offline under them (I don't have the Pi connected to the printer while working on the screen).

/boot/config.txt now has this:

# --- added by adafruit-pitft-helper Tue  8 Oct 20:11:48 UTC 2019 ---
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=pitft28-resistive,rotate=180,speed=64000000,fps=30
# --- end adafruit-pitft-helper Tue  8 Oct 20:11:48 UTC 2019 ---

The screen doesn't seem to have no other ports than the GPIOS with I connected it to the PI. It doesn't even has a HDMI port like the ones I keep seeing nowdays on the web.

Here is another site about it: https://world.taobao.com/item/536714483958.htm And I can also take pictures with it and what I've described so far.

Right now, I am thinking to make an sd card with clean Raspbian image and try to configure that to see if I manage to get it work this way. If so, than the problem may be with the Octoprint build, if not than maybe the screen is just false advertised as touch so I consider buying one which is known for working both with Octoprint and Raspbian.

Once you have the Desktop booted (sudo raspi-config to make sure that it auto-logs-in as pi to the GUI), then setup the browser to go into kiosk mode. Search the forum here for "kiosk" for details.

And yet, if the touch aspect of this isn't working, maybe this just isn't going to work.

Yesterday night, I installed the latest Raspbian image ( Raspbian Buster with desktop) on a fresh sd card and configured it on my RPI 3, then followed the same tutorial from the beginning. This time, the screen worked from the first try, without the need to install X11, nor to enable it, just like I expected, but with the touch functionality still not working.

What I noticed, that the person who made the tutorial, said at the end that he still needs to use a keyboard and mouse, also translating the Chinese description of the screen, nowhere mentions that is touch compatible (maybe the "TFT" means that, I don't now, I wasn't familiar with the term until now).

Now, I am thinking to order the same screen from the aliexpress link from above just to see if my unit is broken or not (curiosity killed the cat) and also I am after buying a screen that certainly works. Any recommendations?

Also, I am going to try the helping script, you mentioned on the clean Raspbian image, maybe it will act differently now that the desktop environment is predefined, reset the image and try the Chinese version of the tutorial and finally, the kiosk mode. But overall, I am still going to buy a new one. :slight_smile:

The last link you provided includes the text "tftlcd" so the TFT part indicates a touchscreen add-on.

Alright, I see that it connects via a double-row of GPIO pins. So in theory it's using SPI. Did you go into sudo raspi-config, Interfaces and turn that on?

I turned on the GUI, but SPI I don't recall... And yes, sorry for missing that, in my head I have all the things I want to describe and on paper... Anyway, I was thinking about that maybe the pins doesn't go where I assumed they do, because I simply inserted them starting from the right corner until the middle of the Pi, so that the screen lays on the USB drives (the GPIO's being in front of me and the USB ports on the left side), but I didn't had the time to check the layouts of both the Pi's and the screen's. Today I left everything at home, but when I'll get there I will check that too. Thanks!

For every single install and/or upgrade and/or "what if?" attempt I make, I create a markdown document which describes every command I ran and any errors I got. Each microSD card gets a tiny numbered label and goes into a database.

If you're rigorous like this, you can always just go back to your digital notes and know how to recreate this nine months from now, for instance.

So, I enabled SPI on the Raspbian image running Raspberry Pi 3 and the lcd screen stopped displaying information, just turned black, but if I switched to the HDMI output, the GUI worked without problems. When I started the GUI for the screen, manually from the terminal using this command

sudo FRAMEBUFFER=/dev/fb1 startx

I received this error:

modprobe: FATAL: Module g2d_23 not found in directory /lib/modules/4.14.50-v7+

So, I googled it and what I've found is to update the Raspberry Pi using

sudo rpi-update

... and the RPi3 now simply doesn't want to start, it remains blocked on the booting phase, without loading the operating system (I can't connect to it via SSH, both the display and the HDMI output doesn't show a thing).

I took the sd card from the RPI3 and installed into RPI2, there the operating system booted without an issue, but with the same symptoms, when SPI is enabled, the screen displays black. So I swapped the memory card with the Octoprint operating system on it, enabled SPI, the screen showed TouchUI plugin's interface, but without touch functionality.

My next steps are to determine if my RPi3 is broken and if so, how can I revert the kernel update and restore it to a working state, and to found out why the screen turns black when SPI is enabled.

You'll be interested to read this (regarding that rpi-update command).

Did the mcufriend come with any instructions/documentation whatsoever? You'd think that they could tell you what's required for this.

The thing is that I received it as a gift and only the screen, so probably the instructions were on the site from where the screen was ordered. I am going to try to reach out to the persons from I received it, maybe they still have some information about it, but I don't have high hopes. I've found the same screen with slightly different instructions , in one of my local online stores and I am probably gonna order it tomorrow, because I am really really curious if if just my screen not working or all mcufriend screens need extra steps to enable every functionality. Worst case scenario, I might just return it and get a screen that is known for sure that it is working with Octoprint. For sure, it is strange for me that on their official website, they are not offering any information...

As for the rpi-update command, it seems that I've learned it on the hard way, but it seems that with a fresh Raspbian image to be working, I just hope I didn't damaged something permanently on my RPI3.

In my humble opinion, anything you buy from Adafruit is backed by great documentation and examples. I've never had a problem with a single item from them. Yes, it's more expensive than the direct sites but at least I'm not wasting hours of my time.

1 Like

After all, I ordered another screen from my local online shop, and after that I went to Aliexpress to look for screens there. To be honest, I think these screens are wrongly labeled as touch, because the ones which are confirmed in the comments and questions, are at least double the price, starting from $20, while the $5-$10 range have touch or tft only in their title as clickbaits. On the other hand, when you said original Adafruit, I remembered that Black Friday is on the corner, and maybe I can get some good deals, because I wanted to order some other stuff too. :smiley:

I will get back with the second screen's results, after I receive it next week.

I will tell you from experience that there are resistive and capacitive touchscreens. I consider the first type "pound on the screen" and the second type "what you expect". The capacitive are more money of course but less frustration.