Waveshare 4.0 TFT Screen Library

Hi,

I have purchased a 4.0 inch WaveShare TFT screen ( im trying out loads to see which works best ).

The driver is a bit poor, and i was wondering what other people have used?

The spec is here

Key Parameters
LCD Type TFT
LCD Interface SPI
LCD Controller ILI9486
Touch Screen Type Resistive
Touch Screen Controller XPT2046
Colors RGB, 65K colors
Resolution 480x320 (Pixel)
Aspect Ratio 8:5
I/O Voltage 3.3V/5V

Interface

Symbol Arduino / NUCLEO PIN Description
5V 5V 5V power input
GND GND Ground
SCLK D13 SPI clock
MISO D12 SPI data input
MOSI D11 SPI data output
LCD_CS D10 LCD chip select
LCD_BL D9 LCD backlight
LCD_RST D8 LCD reset
LCD_DC D7 LCD data/command selection
TP_BUSY D6 Touch panel busy
SD_CS D5 Micro SD card chip select
TP_CS D4 Touch panel chip select
TP_IRQ D3 Touch panel interrupt

ideally id love to use the mcufriend library david has written as its awesome.

Waveshare are pretty good for information e.g. https://www.waveshare.com/w/upload/1/17/4inch_TFT_Touch_Shield_Schematic.pdf

You will see that it is actually a parallel 8080-16 interface which is driven by Shift Registers.
The ILI9486 controller has a native SPI interface but TFT modules with native SPI interface are more expensive than the parallel modules.

The shift register is a bit of a kludge. It does not run as fast as the native SPI. The Waveshare implementation is write-only. Many RaspberryPi screens do a similar hack.

Bodmer has a driver for the "shift register SPI".

It would be really nice to use a genuine ILI9846 native-SPI. I have only ever seen HX8357-D, ILI9481, ILI9488 native-SPI. The ILI9486 has an advantage over SPI 9481, 9488.

David.

Thanks David,

Can you help me understand how I use the TFT_eSPI library of Bodmer ?

I'm extremely new to this TFT minefield and would appreciate any help you can give me.

I can see 6 libraries on his github page

but the only slightly relevent one TFT-eSPi seems to be for the ESP8266 and ESP32, where as i want to drive it from an arduino uno

Bodmer has good wiring diagrams. Follow his advice.

Bodmer has LOTs of examples. Try them all.

If you have a problem, you can quote which example and what problem. Bodmer has many followers. If they can replicate your problem, they can possibly advise. And Bodmer gets the feedback.

Ah-ha. I thought that you had ESP8266 or ESP32.
Bodmer has libraries for several AVR targets e.g. Mega2560 and Due. I am not sure if his Shift-Register-SPI code is for Uno. But at least he has no worries about SPI speed.

David.

Hi Ian, none of my Github libraries support that display with the UNO.

This library looks like it will work.

Had a closer look and it appears to be for the ESP32 ONLY...

I am sure that someone has written a simple library for the Waveshare.

From guesswork, all that is needed is to write 8-bit commands and 8-bit parameters with SPI.write16() instead of 8-bit. Writing a 16-bit pixel is done with write16().

I do not own a Waveshare. I do not want to own a Waveshare.
Surely Waveshare provide a library already.

David.

david_prentice:
I do not own a Waveshare. I do not want to own a Waveshare.

David.

hehe!!!! that made me chuckle!!!!!

David,

would you be able to recommend a good 4 inch screen with good driver support ?

I know this is an old thread, but I have written a library for this screen. It provides an 'Adafruit_GFX' style graphics interface, and touchscreen support that's reasonably easy to use. You can find it here:

I've run it on an Uno, a Mega, and a Wemos D1 R1 (but that required re-wiring). It is substantially faster than the one the Waveshare website points people to, and has more functionality.

Hi, i tried your libary on Uno and it was much more fluid, than the original libary. Somehow i cant get it running on a teensy 3.6, the original works. I needed to switch the dip. Im new to the mcu World, any tips or hints would be awesome. Thanks.