Select Color Display For ESP32
Select Color Display For ESP32
by 陳亮
This instructables show something about selecting a color display for your ESP32 project.
The content is intended to be updated from time to time, I will add more details if I found new display or library update.
You can also help me enrich the content by leaving comments below.
You can run various IoT projects prefectly without any There are various real time information in your server or
display. But not all IoT project only feed data in single Internet, such as all rooms temperature in your home,
direction (IoT to server), some IoT also gather real time server CPU usage, weather forecast, news, stock price,
information from the server for displaying. your downloading le is done, your Youtube channel
views :>
My previous instructables, ESP32 Photo Clock is am
example, it download a current minute photo from the
Internet, decode the JPEG photo and display it.
Many Arduino projects use monochrome display, one of processing power (16 MHz vs 240 MHz dual core), much
the reason is the limited resources of a MCU. 320 pixels more RAM (2 KB vs over 200 KB) and much more ash (32
width, 240 pixels height and 8 bits color for each RGB KB vs 4 MB), so it is capable to utilize more color and
color channel means 230 KB for each full screen picture. higher resolution image for displaying. At the same time
But normal Arduino (ATmega328) only have 32 KB ash it is capable to do some RAM hungry process such as
and it is time consuming (over a second) to read data Animated GIF, JPEG or PNG le decoding, it is a very
from SD card and draw it to the color display. important feature for displaying information gathered
from the internet.
ESP32 have changed the game! It have much faster
Note: https://www.instructables.com/id/IoT-LED-Cheering-...
I think this is the lowest resolution color display you can powered by a battery.
nd in the market, it is a 0.96" 96x64 color OLED.
I have tried to use it in my previous instructables:
OLED have a big advantage, the pixel only draw power if
it lights up. On the other hand, LCD back light always https://www.instructables.com/id/Arduino-MINTIA-Ga...
draw full power even you are displaying a black screen.
So OLED can help save some power for the project
This is a 1.5" 128 x 128 color OLED, this form factor is very t for smart-watch-like wearable project. The most barrier of
select this should be the price tag is around 4 times of a normal LCD.
This is the highest resolution color OLED I can nd in hobby electronics market, it is a 1.69" 160x128 color OLED. Due to
the large size breakout board, I have no idea how to use it yet.
ST7735 is a very popular LCD driver model for the few pixels variation. Some library di erential it by red,
resolution 128x128 and 128x160. It may cause by its green or black tag but the tag color may not always help.
popularity, there are many manufacturer produce The worst case is alter the tag option one by one until
compatible product. However, they are not fully you can see a ne result. The above last picture is an
compatible. example of using wrong tag option, you can nd 3 pixels
height noise bar on the top.
The initial code have some variation, the color order can
be RGB or BGR and the y coordinate range also have a
https://youtu.be/eRBSSD_N9II
https://youtu.be/6rueSV2Ee6c
https://youtu.be/qESHDuYo_Mk
ST7735 still have another odd size color display, 0.96" 128x64. The resolution and form factor seems aim to replace 0.96"
mono OLED SSD1306.
https://youtu.be/OrIchaRikiQ
It is a 2.2" 176x220 color LCD. It is relatively fewer size JPEG image and double the FPS ;>
projects using this chips and resolution. It may caused
by the success of its chip family brother, ILI9341 (0.2" Here are my project(s) using this display:
larger in size but have near double resolution).
https://www.instructables.com/Play-Video-With-ESP3...
Lower resolution still have its advantages, e.g. it can save
half of the processing power on decoding the full screen
https://youtu.be/mVriPOfqwtk
This is another display since popularity of wearable gadget. You can treat it as a 240x240 display but without four corners.
Note:
This display is not 5V I/O tolerant. If you are using a 5V dev board like Arduino Nano, every I/O line should insert a 2.2K
resistor in the middle.
https://youtu.be/kJrAFm20-zg
Note: https://www.instructables.com/id/Battery-Powered-E...
This display is not 5V I/O tolerant. If you are using a 5V
dev board like Arduino Nano, every I/O line should insert https://www.instructables.com/id/Kids-Photo-Album-...
a 2.2K resistor in the middle.
https://youtu.be/NtlEEL7MkQY
https://youtu.be/RncmrGAzw7k
The display result is very good but the vendor not provide a breakout board option, so you need wire it yourself.
It is a 2.8" 240x320 color LCD. The vendor not provide a breakout board option, so you need wire it yourself.
https://youtu.be/25ymuV51YQM
https://youtu.be/qid3F4Gb0mM
ST7789 also a common driver chip in ESP32 community. picture is a 1.3" 240x240 IPS color LCD.
One of the reason is ESP32 o cial development kit using
it. As same as ILI9341, ST7789 also can drive 240x320 This also the highest pixel density color display in my
resolution. drawer. As same as normal LCD, it can direct operate in
3.3 V, so it is very good for making slim wearable device.
I have no 240x320 ST7789 display in hand, the above
https://youtu.be/A961iGsJwA0
https://youtu.be/KzDC02wg8z0
https://youtu.be/Zk81_T8c20E
This is a 3.0" 240x400 IPS color LCD. This is the only wide screen LCD in hobby electronics market I even seen.
9-bit SPI
https://youtu.be/bwFF9-9kMog
https://youtu.be/YxjuuCFhlqM
This is a 3.5" 320x480 color LCD. This resolution is a burden for normal MCU, it require over a second to ll full screen
using Ucglib.
https://youtu.be/NkE-LhtLHBQ
https://youtu.be/s93gxjbIAT8
https://youtu.be/hUL-RuG4MAQ
There are many display libraries that can support various hardware. I have picked 4 of most popular Arduino library for
comparison:
The above picture is the hardware support list for each library.
The display speed is one of the most important thing we consider to select which library. I have chosen TFT_eSPI PDQ
test for this comparison. I have made some e ort to rewrite the PDQ test that can run in 4 libraries. All test will run with
the same 2.8" ILI9341 LCD.
For simplify the comparison process, all display use the same connection pattern.
ESP32 Display
Pin 5 -> CS (Some display not breakout this pin, simply skip it)
Pin 16 -> DC
Pin 17 -> Reset
Pin 18 (VSPI CLK) -> CLK
Pin 23 (VSPI MOSI) -> MOSI (Some display call it Din)
https://github.com/moononournation/Arduino_graphic...
Update
As I found TFT_eSPI is the most potential display library for ESP32 in this instructables, I have paid some e ort to add
support for all my display in hand. The newly added display support marked letter M in red at the above picture, here is
my enhanced version:
https://github.com/moononournation/TFT_eSPI
Adafruit sell various display module in hobby electronics In Arduino Library Manager simply search "adafruit
market and they also have very good support in display", you can see all the family members. If you want
software level. Their display libraries all built on a parent to install it, say ILI9341, simply select "Adafruit ILI9341"
class called Adafruit_GFX, so I call it Adafruit GFX Family. and then click install. Remember also install its
This library generally support most Arduino hardware dependent library "Adafruit GFX Library".
(also ESP32).
This library method signature is very similar to Adafruit GFX, but it is tailor-made for ESP8266 or ESP32. I think the source
code is optimised for ESP32, so the PDQ result is much faster than other libraries.
You can install it at Arduino Library Manager by searching "TFT-eSPI" and then click install.
Note: The most di cult part using this library is you are required to con gure this library before you can use it. The
con guration le is located at the library folder, it should be "Arduino/libraries/TFT_eSPI/User_setup.h" under you own
documents folder. It have many comments help you to do that, please follow the comments step by step to nish the
con guration. Here is my User_setup.h for ILI9341:
<p>#define ILI9341_DRIVER</p><p>#define TFT_CS 5 // Chip select control pin D8<br>#define TFT_DC 16 // Data Command control pin
#define TFT_RST 17 // Reset pin (could connect to NodeMCU RST, see next line)</p><p>#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in
FLASH<br>#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_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts</p><p>#define SMOOTH_FONT</p><p>#define SPI_F
REQUENCY 40000000 // Maximum to use SPIFFS</p>
You can install it at Arduino Library Manager by searching "Ucglib" and then click install.
UTFT-ESP is based on the Rinky-Dink Electronics UTFT And then copy the "UTFT" folder to the Arduino library
library and added ESP8266 and ESP32 support. folder.
ESP32 + ILI9341 can run at SPI speed 40 MHz, it require some code change at library folder. The above pictures are the
ne tuned result. Here are the code change summary:
Adafruit_ILI9341
This library has already de ned SPI_DEFAULT_FREQ as 40000000 for ESP32 boards. You can also change the frequency
while init:
tft.begin(80000000);
TFT_eSPI
User_Setup.h
// #define SPI_FREQUENCY 27000000<br>// Actually sets it to 26.67MHz = 80/3<br>#define SPI_FREQUENCY 40000000 // Maximum to use SPIFFS
Ucglib
src/clib/ucg_dev_ic_ili9341.c
UTFT-ESP
hardware/esp/HW_ESP.h
OLED require 14 V to light up the pixel so it is not easy to require some electronics in the middle, most data sheet
decouple the breakout board. On the other hand, LCD have the sample circuit. You may ask your seller send a
(also IPS LCD) usually operate in 3.3 V, as same as the soft copy of data sheet to you or simply Google it by the
ESP32. In most case, there are only the LED control model number.
circuit required between LCD and ESP32, i.e. a transistor
and few resistors. So it relatively easy to make it. My special hint: I like to soldering a FPC cable with the
same pin pitch size as the LCD to help the connection
It is very important to read the data sheet rst before with the MCU. I have used this technique in these
you decide not using breakout board. The pins layout, instructables:
pin pitch size, the sample circuit connection and
maximum rating all you can nd in data sheet. The https://www.instructables.com/id/Connect-LCD-to-Ra...
maximum voltage is especially important, you should
sticky follow the rating or you will blow your LCD. The https://www.instructables.com/id/Portable-WiFi-Ana...
chip can operate in 3.3 V but LED may be 2.8 - 3.0 V so it
Great article! Very interested in round displays. There are available round displays based on
st7687s (128 * 128) and st7789 (240 * 240), but I have not found any information on practical
use.
Hi, any news on st7687s? thx
Hello! Yes, I purchased this display from keyestudio, connected it to esp32 using this library from
dfrobot. It is only necessary to consider that the pinout of the display connectors differs from
dfrobot and keyestudio.
thx a lot
Hi.
Thank you so much for such a great article. I have been trying to choose the best library to use
for a project that will use either a SSD1351 or a ST7735 both being 128x128. The key to my
project is to be able to dump a frame buffer in to the display and then recalculate the next frame
buffer. :)
I have a problem with you comparison table. What do the numbers mean. Is a higher number
better or worse when compared to other values.
Again Many thanks for all of your work :)
Bonjour merci pour ce gros projet très instructifs. J'ai acheté un mini ips (rgb)0,96"80x160 et je
n'arrive pas à trouver de librairie valide, j'utilise la librairie st7735 mais j'ai deux lignes de bruit sur
le côté et en bas. J'ai testé toutes les inclinaison mais c'est toujours la. Et j'aimerais bien afficher
Désolé il y a eu un problème je disais que j'aimerais utiliser mon écran et mon module sd en
même temps mais j'ignore comment on peut faire ?
How do you control the display's SPI without the CS pin?
CS stands for cable select, it tell the device the SPI is active for that device. If you only have 1
device connected to the the SPI, you can simply pull down the CS pin to tell it always active. It
can also simplify the code no need turn CS on and off for each message and run a little bit faster.
Some breakout board not wire out CS pin and simply pull it down for you.
Hello!
Does it have an effect, when I use the display and another I²C-sensor? Thank's for your help...
I bought a IPS130-v2.0 display that has CS connected to GND. I connected the LCD to a PIC24
(inferior uC than ESP32).
I had trouble to start the display, but searching in the internet I found that I had to use SPI mode
3. The LCD started to work.
So, basically I make a reset in the beggining (read datasheet) then next I use only SPI_DAT and
SPLI_CLK. If I destroy the sequence touching with an oscilloscope, the LCD stops to understand
the sequence DAT/CLK and I have to make another reset.
Those 2 pins must be dedicated to the display, otherwise the display will get confused without the
CS pin. One DAT/CLK to LCD and another DAT/CLK to I2C.
Hope this answer your question Stoppi71.
Thank's Emanuel for your answer. It slowly brings light into the matter...
Hello! Thank's for your instruction. I want to use your 8pin ili9486 320x480 spi display with one of
your presented libraries and esp32. 1.) Could you please tell me the connections between the
display and the esp32 and 2.) which numbers do I have to write into the line utft myglcd
(ili9486,?,?,?,?)?
Thanks a lot for your efforts, cheers stoppi
Hi stoppi71, I am using the connection setup mentioned at step 17.