Introduction: ESP32 and ILI9486 Display - PlatformIO

This project is a basic test of a ILI9486 display connected to a ESP32 micro-controller. The code will display some text and the background color will change every 10 seconds. This project uses code from the TFT_eSPI example - TFT_Print_Test. Thank you very much to Bodmer for his amazing work!

https://github.com/Bodmer/TFT_eSPI/tree/master/exa...

All code for this project is located in the folder:

https://github.com/LaZorraTech/ESP32-and-ILI9486-D...

The display has the following specs:

Driver: ILI9486

Size: 3.5"

Resolution : 320x480

Bus: 8bit

Touch: Yes

Supplies

ILI9486 3.5" Display

https://www.amazon.com/gp/product/B075FP83V5/ref=p...

ESP32 Board - Lots of options available - This is the one used in this project

https://www.microcenter.com/product/613822/inland-...

Jumper Wires

https://www.amazon.com/gp/product/B07GD2BWPY/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

Step 1: Wiring Connections

Display -> ESP32

TFT_DC -> 18 // Data Command control pin (Labelled as LCD_RS on my display)

TFT_CS -> 33 // Chip select control pin

TFT_RST -> 32 // Reset pin

TFT_RD -> 2

TFT_WR -> 4 // Write strobe control pin

TFT_D0 -> 12 // Must use pins in the range 0-31 for the data bus

TFT_D1 -> 13 // so a single register write sets/clears all bits

TFT_D2 -> 26

TFT_D3 -> 25

TFT_D4 - > 21

TFT_D5 -> 5

TFT_D6 -> 27

TFT_D7 -> 14

GND -> GND

3.3V -> 3.3V Connect both 3.3V and 5.0 V

5.0V -> 5.0V Connect both 3.3V and 5.0 V

Step 2: PlatformIO - Code

Copy the code from the github folder into the src/main.cpp.

(This is the modified TFT_Print_Test mentioned earlier.)

Step 3: PlatformIO - Platformio.ini

Add this line to your platformio.ini file to load the TFT_eSPI library:

lib_deps = bodmer/TFT_eSPI@^2.3.59s

(Make sure you have the necessary libraries!)

Step 4: PlatformIO - User_Setup.h

Click on .pio to expand it.

Click on libdeps/esp32dev/TFT_eSPI to expand it.

Find the User_Setup.h file and open it.

Make the following changes:

Comment out the #define ILI9341_DRIVER (line 39)

Enable the #define ILI9486_DRIVER (line 46)

Comment out lines 157 to 159 ("For NodeMCU - use pin numbers...")

Enable the #define TFT_PARALLEL_8_BIT (line 224)

Cut and paste the pin definitions from the main code (lines 227-241)

All other values at the end of the file, I did not modify.

In the end, your User_Setup.h should look like the photos. I've included it in the github folder if needed for reference.

Step 5: End Result

Build it and upload it to your ESP32 and cross your fingers!

And hopefully the end result is a working display. Once you get the hang of modifying the User_setup.h file it's easy enough to try other examples from Bodmer's 480x320 examples.

Wishing you luck with this!