Help: MCUFRIEND 3.5" TFT LCD 480x320 & ESP32 (SOLVED)

Hello,

How to wire this 3.5" TFT LCD 480x320 to ESP32?

Which library should use?

Hoping someone with better knowledge than me would reply, guide me please.

Thanks for the helpers! :slight_smile:

Google "TTGO D1 R32"

This board will receive your shield.
You have to make a minor hardware mod.

TFT_eSPI and MCUFRIEND_kbv both support these parallel shields.
Please say which controller is mounted on your shield e.g. by using tft.readID()

You have to configure User_Setup.h for Bodmer's library.
The hardware mod is shown in Bodmer's docs. The mod works for MCUFRIEND_kbv too.

David.

David... thanks a lot for the guidance, very appreciated.

Downloaded MCUFRIEND_kbv from here, then uploaded graphictest_kbv.ino sketch to ESP32.

Nothing change on LCD, still displaying white screen.

But serial monitor showing ID = 0xD3D3

Maybe wrong wiring, will double/triple check the wire setup.

You must do the hardware mod. Some of the A0-A5 pins on the TTGO board are analog only. Hence the need for hardware mod.

The TFT control signals must be digital.

Yes, these shields "work" on the ESP32 but are a bit wasteful. Most of your GPIO pins are used up.
It is a lot better to use SPI screens with an ESP32 or ESP8266.

If you don't tell me your controller ID I can't tell you if I support it or if Bodmer supports it. Or not at all.
0xD3D3 just implies that you have a write-only shield. Your photo shows a read-write shield. So your wiring is wrong.

The shield plugs straight into a Uno. The Uno can tell you the ID and even which pins are used by the Touch Panel.

Please do not install from ZIP. God gave you the Library Manager.

David.

1 Like

Finally it works... :slight_smile: :slight_smile: :slight_smile:

For anyone who also has difficulties like me, here is the steps to make 3.5" MCUFriend TFT LCD works on ESP32:

1. Wiring
Follow wiring guidance by David Prentice in this post :

#if defined(ESP32)       //regular UNO shield on TTGO D1 R32 (ESP32)
#define LCD_RD  2  //LED
#define LCD_WR  4
#define LCD_RS 15  //or LCD_CD - hard-wired to A2 (GPIO35) 
#define LCD_CS 33  //hard-wired to A3 (GPIO34)
#define LCD_RST 32 //hard-wired to A4 (GPIO36)

#define LCD_D0 12
#define LCD_D1 13
#define LCD_D2 26
#define LCD_D3 25
#define LCD_D4 17
#define LCD_D5 16
#define LCD_D6 27
#define LCD_D7 14

2. Library
Download MCUFRIEND_kbv library from here

3. Edit
Edit the pinout definition in graphictest_kbv.ino file for matching with ESP32 pinout

#define LCD_CS 33 // Chip Select goes to Analog 3
#define LCD_RS 15 // LCD_RS = Register Select or LCD_CD = Command/Data goes to Analog 2
#define LCD_WR 4 // LCD Write goes to Analog 1
#define LCD_RD 2 // LCD Read goes to Analog 0
#define LCD_RESET 32 // Can alternately just connect to Arduino's reset pin

4. Upload
Finally upload graphictest_kbv.ino to test the LCD.

If it doesn't work, double/triple check the wiring. It use many wires, wrong wiring could happen.

NOTE: This 3.5" MCUFriend TFT LCD use 3.3V, it become very very hot when use 5V.

Thanks a lot David Prentice for kindly helping me, much appreciated.

2 Likes

Google "TTGO D1 R32"

Boards are available on Ebay. You must make a minor hardware mod. There are diagrams on Bodmer's website.

If you bought this board, you can plug the shield straight into the Arduino header sockets. (with the hardware mod)

The Mcufriend shields are designed to work from 5V supply and use 3.3V reference for the logic.

The TFT panels come in many shapes and sizes with different controllers.

The backlight LEDs often take too much current. You can feel them getting warm/hot.

On the older mcufriend pcbs there is a separate AMS1117-3.3 regulator for the backlight.
Current pcbs should have a series resistor for the backlight because it is powered from 5V pin. I have never seen a series resistor.

David.

Hello David,

Please I need your help.

I'm having MCUFRIEND 3.5" TFT LCD display, but ESP8266+ (https://robotdyn.com/wifi-nodem-esp8266-32m-flash-ch340g.html).

Pins structure - (https://hackster.imgix.net/uploads/image/file/127871/NodeMCU_Pinout.png?auto=compress%2Cformat&w=740&h=555&fit=max).

In the official Adafruit_GFX.cpp in Arduino IDE they made reference to compatibility with ESP8266.

#include "Adafruit_GFX.h"
#include "glcdfont.c"
#ifdef AVR
#include <avr/pgmspace.h>
#elif defined(ESP8266) || defined(ESP32)
#include <pgmspace.h>
#endif

I need your help with connecting to the right pin.

Thanks in advance
Muda

It is simple maths.

Remove your shoes. Count your fingers and toes.

Count the number of LCD_xx pins on a Mcufriend parallel display shield.
Count the number of GPIO pins on a ESP8266.

Allocate a toe for each GPIO pin.

The ESP8266 works very well with SPI displays e.g. Red ILI9341 SPI boards.
Bodmer's TFT_eSPI library works with both ESP32 and ESP8266.

ESP32 does have enough pins for a parallel display. Both MCUFRIEND_kbv and TFT_eSPI will work with ESP32 but it is still a waste of pins.

David.

Thanks David.

I'm just new to this. I'll give it another go.

Cheers mate.

Hello,
Do you know someone who tried to use an SPI port expander like the MCP23S17 successfully?
Could this be a solution to control this display with an ESP8266?

Go on. If you want to use an ESP8266 buy an SPI display.

Bodmer supports most of the common SPI displays.

He even supports the Shift Register Abortion displays beloved of RaspberryPi. (only because RPi does not have enough pins for parallel)

David.

Is there a speed advantage going with parallel bus interface and this display, over SPI interface displays?

Not really. An ESP32 (or ESP8266) can drive the controller at maximum speed via SPI (and DMA)

A Parallel driver tends to involve a lot of bit-mangling. And mangled ports can't use DMA.

Bodmer has excellent SPI library for ESP32 and ESP8266.

Yes, he can support an 8080-8 parallel but only for ESP32.
Parallel only "wins" when you have a hardware bus driver e.g. on some STM32 chips.

David.

Thanks David! Yep, been quite happy using Bodmer's library to drive SPI display!

Just to clarify and add to David's excellent advice above, here is how I successfully connecting ESP32 with some old "non Serial (without SPI)" TFT LCD.

CODE CHANGES
Within the graphictest_kbv code (see link above):
rem out following lines of code

/* *** following is for UNO etc Not ESP32 ***
#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
*/

replace above with following for ESP32

// *** enable following is for ESP32 ***
#define LCD_CS 33 // Chip Select ESP32 GPIO33
#define LCD_RS 15 // LCD_RS = Register Select or LCD_CD = Command/Data
#define LCD_WR 4 // LCD Write goes to ESP32 GPIO4
#define LCD_RD 2 // LCD Read goes to ESP32 GPIO2
#define LCD_RESET 32 // ESP32 GPIO32

WIRING ESP32 to TFT

/*
// *** Wiring for ESP32 ***
LCD_RD ESP GPIO2
LCD_WR ESP GPIO4
LCD_RS ESP GPIO15
LCD_CS ESP GPIO33
LCD_RST ESP GPIO32

LCD_D0 ESP GPIO12
LCD_D1 ESP GPIO13
LCD_D2 ESP GPIO26
LCD_D3 ESP GPIO25
LCD_D4 ESP GPIO17
LCD_D5 ESP GPIO16
LCD_D6 ESP GPIO27
LCD_D7 ESP GPIO14
*/

POWER SUPPLY TO TFT LCD
My LCD by www.mcufriend.com requires both +3.3v and +5v BUT the ESP32 only has a 3.3v supply pin So to get the display working I needed to provide an external 5v supply.

In the future I'd only purchase more recent design TFTs with a SPI capability and only requiring 3.3v.

Attached is a pdf of the original UNO to TFT wiring showing that this parallel data method uses up a lot of the UNO pins

Cheers

UNO to TFT Connections.pdf (665 KB)

Здравия всем! Да простит мне автор темы... У меня дисплей очень похожий. Но, на синей плате и с контроллером 9486. Так вот, будучи установленным в плату Ардуино, он успешно работает только с библиотекой MCUFRIEND_kbv. Все иные нагло игнорирует. А вот с платой ESP32, этот дисплей вообще отказывается сотрудничать. Может кто нибудь уже занимался подобным - буду рад и благодарен любой помощи.
Hello everyone! Forgive me the author of the topic ... My display is very similar. But, on the blue board and with the 9486 controller. So, being installed in the Arduino board, it successfully works only with the MCUFRIEND_kbv library. All others blatantly ignore. But with the ESP32 board, this display refuses to cooperate at all. Maybe someone has already done something like this - I will be glad and grateful for any help.