Go Down

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


Wow!  I actually didn't expect anyone would respond to this, being an old thread, and my being satisfied with a half-baked workaround.  But it looks like there is an easy correct fix, but unfortunately I have to press for some kindergarten-level hand-holding to be able to follow your advice(s).  Here's where I am:
  • I have the Qianson 1.8" SPI TFT Display, and it's apparently working, except for initializing offset when using ST7735_BLACK option.  I don't see a GREENTAB2 option in graphicstest sketch, or the Adafruit_ST7735.cpp file.
  • I did discover by using BLACKTAB option in sketch, and in Adafruit_ST7735.cpp, adding colstart = 2, and rowstart = 1 in the initialization procedure for option BLACKTAB, everything worked, including colors.  But I don't think I should be altering formal library code. Here's the code, see very bottom.
Code: [Select]

// Initialization for ST7735R screens (green or red tabs)
void Adafruit_ST7735::initR(uint8_t options) {
  if(options == INITR_GREENTAB) {
    colstart = 2;
    rowstart = 1;
  } else if(options == INITR_144GREENTAB) {
    _height = ST7735_TFTHEIGHT_128;
    _width = ST7735_TFTWIDTH_128;
    colstart = 2;
    rowstart = 3;
  } else if(options == INITR_MINI160x80) {
    _height = ST7735_TFTHEIGHT_160;
    _width = ST7735_TFTWIDTH_80;
    colstart = 24;
    rowstart = 0;
  } else {
    // colstart, rowstart left at default '0' values

  // if black, change MADCTL color filter
  if ((options == INITR_BLACKTAB) || (options == INITR_MINI160x80)) {
    colstart = 2; // #*001 This row added to correct screenfill offset  <== These two lines
    rowstart = 1; // #*001 This row added to correct screenfill offset <==

  • Now regarding your input, I'm sorry, but I couldn't find a User_Config.h file. Should that exist, or do I create one?  If so, I'll need info on how to use it.
  • I have no clue about a mfr panel register - but it looked like that was not your favorite thing, anyway
  • I saw a lot of references to MADCTL in the .cpp file. Again, it's unfamiliar to me, so I'm not clear on what it means to set BGR bit to 0x36. I took a guess and changed the #define MADCTL_BGR 0x08 to 0x36.  That didn't work.  If there's something to read on it, I'll be glad to do my part

I'm sure this is going to be pretty straight-forward, and I thank you for your elp.


The assumption was you were using the library linked to in post #1 of this thread, which is here. That library has it's own examples.

You do not need  the Adafruit libraries and it is unlikely you will get the display you have working with them unless you understand the control register settings.

Formerly Rowboteer (now a broken user profile!)


Oops! My bad.  I jumped in to the tail end of the thread, and, being new, assumed this Adafruit library was just what people used.

I have torn down my breadboard to pursue the wifi function of my project, so am answering without having actually tried your recommended lib.  But, I see what you're saying, and will install and try that lib when I get back to the display part.

Thanks so much,


Hi Bodmer! I have this "clock with thermometer using DS3231 on 1.8" ST7735 display"(https://www.youtube.com/watch?v=aGMP7Hf5hLo), taken from an example of yours here: https://github.com/Bodmer/ TFT_ST7735 and adapted by 'Nicu FLORICA' here: https://github.com/tehniq3/ST7735-display/blob/master/TFT_DigitalClock_RTC.ino and I would like to use it in a display tft 2.2" ili9341; therefore, what should be changed in the code?
I do not have enough knowledge for this, so I ask for your help;
My early thanks


Apr 27, 2018, 12:51 am Last Edit: Apr 27, 2018, 12:52 am by david_prentice
The 132x162 ST7735 and the 240x320 ILI9341 are both MIPI-compliant controllers.

Although the tft.begin() sequence will be different for each controller the general purpose graphics work exactly the same.  i.e. you just #include the relevant library header file and call the constructor.

So if you draw a line or fill a circle,   you give the same instructions to the library and the library gives the same commands to the controller.

Ok,  you might want to increase the size of the geometry on the bigger display.

If you look at Bodmer's TFT_eSPI library for Expressif MCUs,   you just change the target controller in the User_Setup.h file.



Hi David, I was happy to receive your reply!
Due to my inexperience, I ask you: what should I change in the code here:
At line 34 #include, should I replace <TFT_ST7735.h> with <TFT_ILI9341.h>?
And in the sequence, lines 37, 72, 74, etc., should also be changed?
Sorry, like I said, I'm inexperienced in that!
Thanks ++


Apr 27, 2018, 09:09 am Last Edit: Apr 27, 2018, 09:18 am by david_prentice
First off.   Please use the link icon (12th from left) when pasting a URL.
It means that readers can use a Tablet or mobile device.

There are several changes at first glance e.g.
Code: [Select]

//#include <TFT_ST7735.h> // Graphics and font library for ST7735 driver chip
#include <TFT_ILI9341.h> // Graphics and font library for DIFFERENT driver chip
#include <SPI.h>

//TFT_ST7735 tft = TFT_ST7735();  // Invoke library, pins defined in User_Setup.h
TFT_ILI9341 tft = TFT_ILI9341();  // DIFFERENT class constructor, pins defined in User_Setup.h
// see User_Setup.h: RST --> D7, CS --> D9, D/C --> D8, DIN --> D11, CLK --> D13

The beauty of C++ is that you have now got a completely different object called tft.
It is a different class but the methods have the same names and behave the same way.

Subsequent colours are named specifically.   This is crazy.   Rename to universal names e.g. TFT_xxx
Code: [Select]

//  tft.setTextColor(ST7735_YELLOW, ST7735_BLACK); // Note: the new fonts do not draw the background colour
  tft.setTextColor(TFT_YELLOW, TFT_BLACK); // Note: the new fonts do not draw the background colour

Untested.   The screen geometry is different.   You might want to change some dimensions.

Oh.   Thankyou for a well constructed question.   I hope that I have answered ok.
Ask if you are unsure.    It really helps to quote line numbers and references.

Note that most Red ST7735, Red ILI9341 boards expect 3.3V logic signals.    Bodmer gives advice on how to provide 3.3V signals from a 5V Uno or Mega.
Life is simpler with a proper 3.3V Zero, Due, ...



Hi bodmer,

thank you for that fantastic, fast library.

Is there a simple way to detect if the display is connected or not?

Is there a bit more detailed version of the keywords.txt where i can see the expected parameters?


Go Up