Everyone Loves Faster ESP8266 TFT Libs

Reader [Jasper] writes in with glowing praise for the TFT_eSPI library for the ESP8266 and the various cheap 480×320 TFT displays (ILI9341, ILI9163, ST7735, S6D02A1, etc.) that support SPI mode. It’s a drop-in replacement for the Adafruit GFX and driver libraries, so you don’t need to rework your code to take advantage of it. If you’re looking to drive an LCD screen with an ESP8266 and Arduino, check this out for sure.

As a testbed, [Jasper] ported his Tick Tock Timer project over to the new library. He got a sevenfold increase in draw speed, going from 500 ms to 76 ms. That’s the difference between a refresh that’s visibly slow, and one that looks like it happens instantly. Sweet.

Improving software infrastructure isn’t one of the sexiest or most visible hacks, but it can touch the lives of many hackers. How many projects have we featured with an ESP8266 and a screen? Thanks, [Bodmer] for the good work, and [Jasper] for bringing it to our attention.

23 thoughts on “Everyone Loves Faster ESP8266 TFT Libs

  1. I came across Bodmers library yesterday and within minutes tested out the weather station example which works a treat and is so so fast compared with the other TFT libraries out there. Thanks ever so much for your hard work Bodmer, it’s turned a pass able project into one that looks awesome!!

    1. It depends what you mean by “quick”. The ESP8266 can decode a 320×240 JPEG stored in the SPIFFS memory and render it on the SPI screen in 400ms. A lot of this time is doing the maths to decode the JPEG. A raw bitmap from SPIFFS probably won’t be any faster as the much larger file size takes longer to pull out of the serial access FLASH chip.

      The library ESP8266_uncannyEyes example renders a moving eyeball with the animated eyelids onto the screen at 33 fps, so small animations are possible.

  2. on the C SDK for the ESP the hardware SPI “send” function takes 10 bytes to the send buffer. whats interesting is that i have not come across any display library that uses all bytes and only sends data 1 byte at the time. It is an easy hack to increase SPI data speed by a lot. Here is a micropython “C Module” implementation i wrote http://ideone.com/SZ62N8.

      1. The TFT_eSPI library uses the 64 byte buffer too and that is one way it achieves the high data rates. By recycling a full buffer to say clear a screen it is possible to send pixels fast (at 75Mbps with 80MHz SPI clock). The ILI9341 “nearly” manages to cope with this rate (a few duff pixels) but it is heavily overclocking the TFT driver.

  3. Are any of those chips really for 480×320 resolution or is is a typo? seems 240×320 or lower to me. I have actually tried to find cheap 480×320 on ebay with good driver support like ILI9341 for 320×240 but didn’t find anything similar for 480×320

  4. A number of display resolutions are supported. Assembled 480 x 320 TFT’s that have an SPI interface are rare. The 480 x 320 display supported by the library is an ILI9486 display designed for the Raspberry Pi by Waveshare. Clones are available 3.5″ and 4.0″ for circa $15. This RPi board design uses a 16 bit shift register (2x 74HC4094), a counter (1 x 74HC4040) and a hex inverter (74HC04). Many other RPi interface designs are sold that are not of this design so be careful if you are looking to buy a display!

    Performance is reasonable but the display circuit design limits the SPI clock rate to 20MHz. An image in the library “Tools” folder of the library shows a hack to add a write strobe that boosts the speed for block writes (e.g. clear 480×320 screen in 24ms) and faster rendering Run Length Encoded fonts (1.2ms for 72 pixel height digit). The hack also delays the Write strobe from the 74HC4040 just enough to let the circuit run at a higher 27MHz SPI clock rate too.

    The ILI9341 is typically a 320 240 TFT, these display drivers are good and almost work at 80MHz SPI clock rate (data sheet spec. is 25MHz). Expect some duff pixels at 80MHz but they seem to work reliably at 40MHz.

    For best performance run the ESP8266 at 160MHz.

    Have fun,

        1. I thought that might be the case but said to try anyway :)
          Thanks for responding. Could you follow me on Twitter (I’ll follow back) to have a connection channel and maybe in the future we have the opportunity to work together?
          Thanks in advance!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s