New library for ST7735 displays and the "Minions" TFT on eBay

The new library supports low cost ST7735 displays connected to an UNO,Leonardo or Mega via SPI, it is based on the Adafruit GFX library with encoded fonts to save space.

It is on Github.

It supports the displays advertised on eBay typically shown with a "Minions" image shown and often quoted as being of OLED type (which they are not). This particular display has an unusual x and y offset, if you use the standard TFT library you get spurious pixels on two edges. This new library has a GREENTAB2 setting for these displays.

The "minions" display is 128 x 160.

You can wire up as follows:

UNO 0V (GND) to display GND
UNO +3.3V to display VCC and BL
UNO digital pin 7 through a 1K2 resistor to display RES
UNO digital pin 8 through a 1K2 resistor to display DC
UNO digital pin 9 through a 1K2 resistor to display CS
UNO digital pin 11 through a 1K2 resistor to display SDA
UNO digital pin 13 through a 1K2 resistor to display SCL

The 1K2 resistors are required to protect the display being damaged by the 5V logic levels from the UNO, these limit the current flow. Ideally we would use a level shifter but the resistors work fine.

Note: you must power that particular display from 3.3V!

Pins, display variant and font configuration is achieved by editting the User_Setup.h file within the library.

Examples are included.

A search on eBay for OLED TFT will currently show these displays.

Also note they do not have an SD card slot.

Library has been updated to correct a bug where "black tab" displays were not correctly initialised. It now should also support the ST7735R (caveat is that I don't have one of those displays so can't test it).

Latest version is on Github.

Performance tests indicate it runs 2 to 10 times faster than the standard Adafruit library.

In true Ebay / Chinese style, the photos and descriptions seem to be untrue.

The smaller "Minions" show a pcb printed 1.44' 128128 TFT_LCD with dimensions 30x46.5 mm.
The larger "Minions" show a pcb printed 1.8' 128
120 RGB TFT_LCD with dimensions 34x54 mm.

Some of the Ebay listings for the larger board say ST7735 128x160.

I would guess that the controller is ST7735S. Have you read the the ID? There is a sketch on a current thread.

I do not have either of these "Minions" displays. I do have several red ST7735S displays.
I have never met a ST7735R or ST7735B in real life.

David.

Manufacturer ID: 0x7C
Version ID: 0x89
Module/driver ID: 0xF0

The "Minions" display has a "green tab" screen protector but has different x,y offsets compared to another green tab display I have (which works with the standard Adafruit/Arduino IDE TFT library).

You have a ST7735S.

I note that you have several different ST7735R configurations. And they seem to have very unusual pixel addressing. Where did your R displays come from? Even my oldest display has the S controller.

I am impressed by your throughput.

David.

The init code was copied from the Adafruit library, all I did was add the GREENTAB2 option to correct the x,y offset issue. I have 3 displays all have the same controller but they each need different configurations of offset and RGB or BGR colour order. This is just down to the way the controller driver is mapped to the pixel array.

Yes, my displays have different Panel settings. I have never had one with 1 or 2 pixel offset.
The ST7735 has only got a limited choice of GM[ ] configurations.
The ILI9163 can cater for many more different geometries.

The BGR, INV, SS, GS, ... can all vary for each Panel design.
If the GM[ ] setting does not match your Panel geometry, you need to calculate an OFFSET to bring the memory into view.

I have never seen an Adafruit display. Do they really contain ST7735R controllers?

David.

Latest version is on Github has been updated to improve the performance of graphics functions like drawPixel and drawLine.

The change forces the compiler to inline some assembler code (which was intended in the original library but was being optimised out by the compiler to save space!)

The library has been updated again to boost performance.

Latest version can be downloaded from GitHub.

Report any bugs on GitHub or here.

There are no pans to make further performance updates, except for bug fixes.

Benchmark from the PDQ variant of the Adafruit graphics test sketch gives these performance figures:

Benchmark Time (microseconds)
HaD pushColor 768660
Screen fill 2786712
Text 41328
Pixels 325852
Lines 289688
Horiz/Vert Lines 19756
Rectangles (outline) 13364
Rectangles (filled) 283692
Circles (filled) 71608
Circles (outline) 45664
Triangles (outline) 19128
Triangles (filled) 128952
Rounded rects (outline) 30308
Rounded rects (filled) 314052
Done!

The performance test sketch has been included in the examples as "TFT_graphicstest_PDQ3".

I am currently using 1.8" TFT with SPI communication having ST7735R driver [GREENTAB] with Adafruit GFX and ST7735 library (it has two initialization functions initR and initB. In function initR, it is mentioned that use this for REDTAB or GREENTAB) .

But now the dealer says that he has ST7735S type TFTs. What is the difference between the two in terms of both wiring and codes?

david_prentice:
I do have several red ST7735S displays.
I have never met a ST7735R or ST7735B in real life.

David.

The wiring is the same. The software is the same. The ST7735S can do hardware scrolling.

I would run the diagnostic sketch to see exactly which controller is mounted. Your "dealer" may not know.

Your Panel may need slightly different initialisation. i.e. select the XXX_TAB that works the best.

There are several ST7735 libraries e.g. from Adafruit, Bodmer, ... even me.
Most use Adafruit_GFX graphics methods. It is easy to change libraries. Often nothing more than editing an include name and constructor statement.

David.

David,
First. Thanks for the hard work on this. I am far along on a project code and saw your listing here regarding the issue with the screen showing short on 2 edges... something I'm experiencing.

I've tried to use your files on github, but in doing so loose a couple of functions that I've written code with inherent with the standard Arduino_ST7735.h /.cpp files. Example tft.background(255,255,255); kicks back that "background" is not a valid function.

I hate to bother you, but is is possible to identify just the changes you made in GREENTAB2 to fix the 2 border issue?

Thanks,
Steve

@Bwanna

David has some libraries and so do I so it is not clear whose libraries you are referring to...

background() is Arduino specific it looks like it is equivalent to:

tft.clearScreen(color);

Where the color is a 16 bit 565 encoded color. Or if you want to use 24 bit color then:

int16_t color = tft.color565(red, green, blue);
tft.clearScreen(color);

If you are using this library, then just search for "INITR_GREENTAB2" in both the TFT_ST7735.h and TFT_ST7735.cpp files insode the library folder and you will see the sections that are conditionally compiled.

If you want to change the display type assumed by the library then you would edit the User_Config.h file in the library. See comments in that file.

This thread is about Bodmer's library. Nothing to do with me. (I may have made the occasional reply)

I have just looked at the Adafruit_GFX class and the Adafruit_ST7735 class.
Neither has a background() method.

Ah-ha. Bodmer has found background() as a method in the TFT library that comes with your IDE.
Personally, I would stick with the Adafruit methods. The TFT library is not widely used (but it is supposed to work with ST7735 displays)

David.

Thanks for responding. I didn't realize and agree... best to stick with the well used method.

Would you mind an additional question?

The TFT library also has a text(string,x,y) function. This seems to combine the Arduino setCursor() and print() functions. I'm starting to redo this to accommodate, but wanted to make sure that didn't miss something and could stay with my original code.

Thanks!
Steve

You just have to think about the best way to proceed:
Either continue with TFT.h
Or use an Adafruit_GFX.h style library

If you are just modifying an existing TFT.h project, it is easier to stick with the rather un-intuitive methods.

If you are writing a new project, I would use an Adafruit style library. e.g. Adafruit_ST7735 or Bodmer's TFT_ST7735. There are several other compatible libraries.

The main advantage is that you can port your ST7735 project to work on a different controller e.g. ILI9163 or the bigger ILI9341.

So it really comes down to new project or existing project. Choose the strategy that is most suitable.

If you do go down the "re-write for Adafruit" route, you might write a helper function that combines the Arduino setCursor() and print() functions.

David.

Appreciate the advice. So far it looks like it's working, but I didn't notice my total byte count went up quite a bit using Bodmer's TFT_ST7735 file... The transition to cursor/print actually went fairly easily.

@Bwanna,

Under the bonnet (hood in the USA!) the IDE TFT libray uses the Adafruit GFX core so many of the functions should be compatible.

The sketch size depends on the fonts you have enabled, edit the User_Config.h file to disable fonts you do not need.

Good luck with your project.

hey i have an st7735R ... its a little rough and a few years old, has been left out in the rain drowned in a few puddles and spent about 2 months underwater but still works ... i can run this code on it and share results ... in trade can we maybe get it to where one of these st7735 librairies can actually send the op codes to the st7735, alot of the auto initialize stuff is stuff that can be changed on the fly it would be useful to be able to write commands and data live in program. simple function. commond and associated data variables. the adafruit library has the function in its setup routines but its not exposed to the userspace program .