Go Down

Topic: Can't get TFT SPI 2.8" Display to work with Arduino Mega 2560 Pro (Read 108 times) previous topic - next topic

coby1kenobi

Hi! I've been banging my head trying to get the TFT SPI 2.8" display with touch to work with an Arduino Mega 2560 Pro.
I got the display from https://shopee.ph/TFT-LCD-240x320-2.8-Module-ILI9341-i.20469516.827034804
I have the wiring as such:
TFT_DC 43
TFT_CS 53
TFT_MOSI 51
TFT_CLK 52
TFT_RST 49
TFT_MISO 50
TFT_TCS 41

I'm using a TXB0104 bi-directional level shifter to bring 5v down to 3.3v for the SPI, MOSI, MISO, and CLK pins only since there are only 4 pins available. (I have placed an order for an 8-Channel level shifter though) The rest of the pins, DC, CS, and Touch CS are shifted using resistors. It might be possible that the display is not working properly because the CS, DC pins only tap 3v instead of 3.3v. I don't have the specific resistors to make the voltage 3.3v.

I attempted to use the Adafruit_ILI93141 library but I haven't been able to get it to work for a week now. I'd really appreciate any finger-pointing in the right direction.

david_prentice

I do not know what TCB0104 is.
TXS0104 is a 4-bit level shifter from Texas Instruments

Please post a schematic of your wiring.   With values of the resistors etc.
A photo is handy too.

If everything is connected correctly your display should work with the Mega2560.
Extra eyes should help spot your wiring problem.

You also need to use compatible libraries e.g. Adafruit_ILI9341.h with HW SPI constructor.   XPT2046_TouchScreen.h

David.

coby1kenobi

Sorry, I made a typo. It should be TXB0104, not TCB0104. It will be replaced soon by an 8ch level shifter from texas instruments, the TXS0108E. 

May I ask what software I can use to make a schematic? I have attached a photo of my wiring though it is not very good. 

I am using the following libraries:
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include "XPT2046_Touchscreen.h"

The connections that cannot fit in the level shifter I have now are in between one 1k resistor and 220R resistor + another 1k resistor. I may have messed the previous up. Assuming this is fixed when the new level shifter arrives, can I ask if the connections I provided in the first post are alright?


david_prentice

Some advice:

Place any 10k resistors between Blue GND rail and breadboard rows.

Plug the screen into the breadboard.  It will lie above those 10k.

Place the 4k7 resistors across the breadboard gutter.

Connect external wires from the Arduino to the 4k7.

Even if you use a TXS0104 module you can have a similar arrangement.   i.e. with display pins neatly plugged into breadboard rows.

Yes,  4k7 + 10k would be a suitable potential divider.   But you could get away with 1k0 + 1k0.   After all,  the ILI9341 is 2.8V - 3.3V device.

You can solder two 1k0 to make a 2k0 and it will still fit neatly on the breadboard.

Forget about  the Touch pins for the moment.
Wire the TFT pins neatly.   Run Adafruit_ILI9341 examples. 
 
Remember to use the TFT_RST argument in the constructor.   Some Adafruit examples are designed to trip up users of Chinese Red SPI displays.

Oh,  if you really want to use Rats Nest wiring,  please make a table of each connection and wire colour.

David.

TFTLCDCyg

Check thread by thread there is no other option, when you use cables for prototype you must take care of many connections.

My "headache free" recommendation for this type of TFT on MEGA or UNO, is to use a CD4050BE.




I suggest creating a shield with a UNO type PCB.

To minimize wiring failures, it is best to solder all wires. To make it more comfortable to handle the TFT, use a 14-pin female header
ft81xmania.com/comunidad/

david_prentice

I agree 100% with making a ProtoShield.   Then it will work with any regular Arduino as well as evaluation boards from NXP, ST, TI, ...

The OP is using a Mega2560_Pro which does not match anything else in the world.
But since it has headers on a 2.54mm matrix you can use regular Protoboard.   Mount appropriate lengths of female header sockets and solder the connecting wiring.

CD4050 has 6 channels.
TXS0108 has 8 channels.

Personally,   I prefer using a proper 3.3V MCU in the first place.   Then buffers are not needed.

David.

TFTLCDCyg

The point is that most of us started with an arduino UNO or a MEGA, so we thought at some point of installing a TFT, but with the passage of time something else is needed: TFT´s speed, versatility with image handling , use of a TFT with touch panel, size, durability, ability to be used in sunlight, etc.

Don't get me wrong, they are excellent plates, mature and with a large number of libraries available; However, with the passage of time, the projects become specialized and require features that those first boards do not have, one of them compatibility with 3.3V logic, speed, MCU size, WiFi, among others.

However, having a special shield to handle this type of economical screens (SPI, with 3.3V logic) on MCU of 5V logic, helps to reduce project development times.
ft81xmania.com/comunidad/

david_prentice

I agree that putting the CD4050 or TXS0108 onto the Protoshield makes it "universal"
i.e. any Red SPI display can run on 5V Arduino as well as 3V Arduino.

Red SPI displays come in many sizes.  e.g. 128x128, 128x160, 176x220, 240x320, 320x480.
You can use the same 14x1 header for all these displays.

Note that you need more than 6 channels if you want to use TFT, Touch and SD card.

David.

TFTLCDCyg

In theory we could install a microSD reader with 5V logic like these for example:



I remember having built a shield to do tests with that type of external readers, I could place it under the shield with CD4050BE, which manages the lines with 3.3V logic from the ILI9341 to see how "the Franky" behaves on the arduino MEGA jejeje

Regarding the touch panel, on AVR boards it goes very well with the URTouch library. So the XPT lines could connect to digital pins directly
ft81xmania.com/comunidad/

Go Up