Go Down

Topic: Parallel TFT 3.5" Touch Screen on ESP32 (Read 266 times) previous topic - next topic


Hi all,
I purchased a screen from Amazon and am struggling to get it to work on my ESP32-WROOM-32D board. I've had some success with getting the display output working using the TFT_eSPI library however it seems as though the touch functionality is only supported using SPI, which the screen does not support as it is parallel only. The IC driver is the ILI9488 and it has pins D0-7, RST, CS, RS, WR & RD.

I've been trying for hours using various libraries and felt the most confident with a fork of the Adafruit_Touchscreen library https://github.com/s60sc/Adafruit_TouchScreen, however after altering the TFT_eSPI config, the Adafruit Touchscreen.h file and selecting the correct pins in the Touchscreen object of the ESP32testTouch file, I still only get a working display output with zero touch functionality.

Here is my User_Setup.h file from the TFT_eSPI library:
Code: [Select]
// See SetupX_Template.h for all options available
#define ESP32_PARALLEL
//#define ILI9486_DRIVER
#define ILI9488_DRIVER
// ESP32 pins used for the parallel interface TFT
#define TFT_CS   27  // Chip select control pin
//#define TOUCH_CS   27
#define TFT_DC   14  // Data Command control pin - must use a pin in the range 0-31
#define TFT_RST  26  // Reset pin
#define TFT_WR   12  // Write strobe control pin - must use a pin in the range 0-31
#define TFT_RD   13
#define TFT_D0   16  // Must use pins in the range 0-31 for the data bus
#define TFT_D1   4  // so a single register write sets/clears all bits
#define TFT_D2   23
#define TFT_D3   22
#define TFT_D4   21
#define TFT_D5   19
#define TFT_D6   18
#define TFT_D7   17
#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts

Here are the first lines of the Adafruit TouchScreen.h file:
Code: [Select]
// Touch screen library with X Y and Z (pressure) readings as well
// as oversampling to avoid 'bouncing'
// (c) ladyada / adafruit
// Code under MIT License

#include <stdint.h>

// ESP32 specific
#define ESP32_WIFI_TOUCH // uncomment to use parallel MCU Friend LCD touchscreen with ESP32 UNO Wifi
#ifdef ESP32
#define ADC_MAX 4095  // maximum value for ESP32 ADC (default 11db, 12 bits)
#define aXM 14  // analog input pin connected to LCD_RS
#define aYP 12  // analog input pin connected to LCD_WR
#define ADC_MAX 1023  // Arduino
#define NOISE_LEVEL 4  // Allow small amount of measurement noise

and my TouchScreen object:
Code: [Select]
const int XP = 18, XM = 14, YP = 12, YM = 17;
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

... which I got the values of XP, YP, XM & YM by cross-referencing with this third-party table: here

Could anyone please provide any guidance on how to use a parallel display with a ILI9488/ILI9486 driver on an ESP32? Or any libraries I could try?
If not could anyone recommend any touchscreen suggestions that are easy to get going with my microcontroller?

Many thanks,


I see your post is getting old, so you've probably solved it already?

Anyways, here is a couple of things to be aware of for you and other users seeking information on this topic:

First: Be aware that the ESP32 works with 3.3v logic on the pins. AFAIK the TouchScreen library is designed for 5v (Arduino) logic. If you get the touch shield to work, you will be challenged with calibration issues. I'm just about to try the same for myself (another go), after i realized the following:

 The XP, YP, XM and YM pins are not the same on all displays even if they look identical. I have three different versions on my bench, and the all look exactly the same.
My exact cases are like this:

Display 1: YM and XP maps to D0 and D1 respectively. XM and YP maps to CS and RS respectively (on the back of the display).
Display 2: YM and XP maps to D7 and D8 respectively. XM and YP maps to CS and RS respectively.
Display 3: YM and XP maps to D7 and D8 respectively. XM and YP maps to RS and WR respectively.

There may (probably) be other variation.

The first thing to figure out is which four pins are actually wired to the touch sensor. I suggest ohm meter. Measure from D0 to each of the analog pins while touching the display. Then do the same for D1, D7 and D8. Whichever two pins on the analog side (RD, WR, RS/DC, CS, RST) you find active, needs to be connected to analog pins on the ESP32.

If you can't find any pins that react to touching, there might be other combinations. Trial and error is the last resort :)

Or maybe you just have a faulty touch sensor...


I suggest that you just plug the Blue 3.5 inch Shield into a Uno.

MCUFRIEND_kbv will identify the controller.  And identify the Touch Pins and calibrate the Touchscreen.

Note the results.    Use with your ESP32.   Obviously translating Uno pin numbers to ESP32 GPIO numbers.


Go Up