Go Down

Topic: New library for ST7735 displays and the "Minions" TFT on eBay (Read 9703 times) previous topic - next topic

bodmer

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.
Formerly Rowboteer (now a broken user profile!)

bodmer

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

Also note they do not have an SD card slot.
Formerly Rowboteer (now a broken user profile!)

bodmer

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.
Formerly Rowboteer (now a broken user profile!)

david_prentice

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

The smaller "Minions" show a pcb printed 1.44' 128*128 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.

bodmer

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).

Formerly Rowboteer (now a broken user profile!)

david_prentice

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.

bodmer

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.
Formerly Rowboteer (now a broken user profile!)

david_prentice

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.

bodmer

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!)
Formerly Rowboteer (now a broken user profile!)

bodmer

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".
Formerly Rowboteer (now a broken user profile!)

dhrupal93

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?

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

David.

david_prentice

#11
Sep 22, 2016, 09:20 am Last Edit: Sep 22, 2016, 09:23 am by david_prentice
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.

Bwanna

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

bodmer

@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:

Code: [Select]
tft.clearScreen(color);

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

Code: [Select]
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.
Formerly Rowboteer (now a broken user profile!)

david_prentice

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.

Go Up