TFT Displays

Introduction

A wide range of displays is available for use with the Arduino system. For the WeMos D1 mini system I found 3 display boards. Each of them is based a on different controller chip and has different resolution. Here they are are:

  • 64x48 pixel 0.66" TFT screen with SSD1306 controller. The SSD1306 uses the I2C bus
  • 128x128 pixel 1.4" display based on the ST7735 controller. The ST7735 uses the SPI bus
  • 320x240 pixel 2.4" display based on the ILI9341 display and the XPT2046 touch controller.
64x48 pixels with SSD1306 128x128 with ST7735 320x240 pixel touch screen with ILI9341
ssd1306.png tftScreen.png lolon2.4inch.png
Each of them has its advantages and disadvantages. The 0.66" display is really tiny and its resolution is very limited allowing to write just a few characters. In addition it is monochrome only. However, the reference display driver included in MicroPython uses this controller chip. There are also higher resolution and color screens using this controller but I did not find one with the WeMos D1 mini bus interface.

The 1.4" display is already quite a bit better even though 128x128 bit resolution is still not enough for sophisticated graphics. It is enough however to write a few lines of text and produce simply graphics, e.g. creating a graph of sensor readout results.

The 2.4" display is clearly the most powerful device, adding touch functionality. It is however so big that it is difficult to plug it onto the WeMos D1 bus, even if the connector is available. The better solution is an adapter board and a connecting cable.

Since the 1.4" display is enough for most our applications, it can be nicely plugged onto the bus just like any other sensor or actuator shield and it is substantially cheaper than the 2.4" solution, this is the device we chose for the course.

Preparing the hardware

Before using the display its solder jumpers on the back must be configured. There are 4 solder fields for configuration

  • TFT LED. his allows to control the display back light. I leave it unconfigured which results in the back light LED being permanently on
  • TFT_CS: D0. TFT_CS and TFT_DC can be selected onto D0, D3, D4 or D8 corresponding to GPIO 26, 17,16, 5. Since D3 and D4 cannot be used on the CPU with PSRAM the only selections possible are D0 and D8. I select D0 for CS and D8 for TFT_DC
  • TFT_DC: D8
  • TFT_RST is connected to the system reset
Here is a photo of the jumper settings:

tftJumpers.png

The driver software

Searching the Internet I found many display drivers none of which really satisfied me:

  • A pure Python version of a ST7735 driver for the ESP32: https://github.com/boochow/MicroPython-ST7735. This a port of a ST7735 driver written by Guy Carver for stm32 processors (https://github.com/GuyCarver/MicroPython/blob/master/lib/ST7735.py). At first glance, this is exactly what I was looking for. However, Guy Carver himself was not too happy about its speed and, compared to other drivers, it has limited functionality.
    There is a demo program putting images up onto the screen and another one exercising the driver's graphic functions like
    • drawing line
    • drawing rectangles
    • drawing filled rectangles
    • drawing text
  • A C-module of the above driver. Finding this code was not so easy. It is hidden in a fork of MicroPython, made some years back, and it was again developed for stm32 processors. Since the method of integrating C-modules into MicroPython has been made substantially easier in recent versions of MicroPython quite a bit of work was needed to adapt this driver. When trying it, it was even slower than the Python code! I figured out that the reason was the way the SPI commands are sent to the controller. If you send commands and data in large chunks then you can speed up graphics considerably. This however is true for the Python and the C code.
  • A driver for displays based on the SSD1351 controller: https://github.com/rdagger/micropython-ssd1351 The display module used has 128x128 resolution just like the module we have. The driver comes with a big number of demo programs, some of which are rather sophisticated. It also provides many more functions than the ST7735 driver. A very nice tutorial with Youtube video is also available. Unfortunately loading fonts is extremely slow.
    I decided to try porting this library to the St7735 chip in such a way that the demo programs would run with a minimum of modification. Speeding up font loading and a port of the demo programs from the above ST7735 driver should be part of the process.
-- Uli Raich - 2020-07-04

Comments

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng lolon2.4inch.png r1 manage 218.8 K 2020-07-04 - 09:45 UliRaich  
PNGpng ssd1306.png r1 manage 158.9 K 2020-07-04 - 09:44 UliRaich  
PNGpng tftJumpers.png r1 manage 626.4 K 2020-07-17 - 16:16 UliRaich  
PNGpng tftScreen.png r1 manage 144.4 K 2020-07-04 - 09:45 UliRaich  
Edit | Attach | Watch | Print version | History: r13 | r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r3 - 2020-07-17 - UliRaich
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback