I dont quite understand how TFT ST7735 displays work

I have both a 1.44" and a 0.96" TFT ST7735 display and a Rasberry Pi Pico.

I've checked many tutorials but they just define CS, RESET and DC (That's labeled A0 on the larger one?) and then use Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);, but somehow the other pins are pre-selected? What does that mean?

If the code doesn't use SCL, MISO and MOSI why do you even need to connect those pins? And if MOSI = SDA why is MISO defined if not used?

I'm just really confused at this point.

I've currently this code:

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library

#define TFT_CLK 18
#define TFT_MISO 16
#define TFT_MOSI 19

#define TFT_CS   10
#define TFT_RST  9
#define TFT_DC   8

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);

void setup(void) {
  tft.initR(INITR_BLACKTAB); // Initialize a ST7735R chip
  tft.fillScreen(ST7735_BLACK);
  
  tft.setCursor(0, 0);
  tft.setTextColor(ST7735_WHITE);
  tft.setTextSize(1);
  tft.println("Sten");
}

void loop() {
  // put your main code here, to run repeatedly:
}

Larger displays only show white screen and the other just a lighter dark color.

Yes, and they expect you to connect the SPI pins, SCK, MOSI and MISO up for your particular board. Although MISO is often not used on a display.

On a lot of Arduinos the hardware SPI pins are fixed and cannot be assigned to other pins so there no point in them being required to be defined.

1 Like

On the RPi-pico there are two SPI buses: SPI0 and SPI1.

SPI0 works like the SPI bus on the arduino UNO, it does not define the MISO, MOSI or SCK pins. Only the default pins should be considered. For the RPi-pico they are:

SPI0    ST7735
SCK      18
MOSI     19
CS       17
RST      21
DC       20

SPI1    microSD
SCK      14
MISO     12
MOSI     15
CS       13

3V3, GND


microSD on SPI1and SdFatV2

ST7735_RPI_Pico.zip (886.6 KB)

1 Like

Hmmm, I've connected the pins as you mentioned on your SPI0, but If I write:

tft.fillScreen(ST7735_BLACK);

I get a completly white screen (even with the tft.println("Sten"); code)

And if I write:
tft.fillScreen(ST7735_WHITE);
I get a black screen with a colored line at the left of the screen:

I looked at this site, so if I get it to work, I could connect multiple displays to the different CLK, CS etc specific ports without specifying anywhere which ports is used for what display?

My goal is to connect 3 of these displays, 4 if possible, and a SD card module.

Definitions:

#define TFT_CS   17
#define TFT_RST  21
#define TFT_DC   20

Or maybe I didn't understand this. Im not familiar with UNO, should I be using the SPI1? What do you mean that it does not define the MISO, MOSI or SCK pins?

Share a photo to verify how you have connected your TFT.

The MISO, MOSI and SCK pins, within the GFX/ST7735 libraries, are established as the default pins of the MCU. In the case of SPI0, it is not necessary to define them, just set CS, DC and RST.

To load bmp images from a microSD reader connected to SPI1 on the RPi-pico, the SdFat library can be used. In the example that I attached is the complete example and the images that must be placed on the microSD card.

Make sure the pins on the RPi-pico are correctly soldered, check the continuity of each wire. I checked the wiring again with an SSD1331, and it works correctly

1 Like

Hard to take a clear picture but I've verified that this is the current wiring:

SCL -> GP18
SDA -> GP19
RES -> GP21
DC -> GP20
CS -> GP17

I've also checked the soldering and wires with a multimeter.

I just thinks its so weird that fillScreen BLACK fills the screen with white, and vice versa. But I atleast get some result..

BLK is backlight control pin, right? Nothing seems to change when i connect it to 3.3v.

I tried the same wiring & code setup on my larger 1.44" display and it worked! (The colored pixel line is still present at the side but not a big issue).

Now I just need to figure out why my smaller display is behaving like it does.

Is it possible its something to do with the pin being labeled as "A0" on the larger display and "DC" on the smaller?

UPDATE: I figured it out! I tested another brand new small display of the same sort and it worked . I must've messed up the backlight by connecting the backligt control pin to 3.3v.

I'll look up how I can reset it.

Thank you very much for the help! I would've never figured out that there was specific pins for analog, spi etc.

Please upload a photo of your screen working, in which you can see that line with multicolored pixels. It seems to me that you only have to adjust a line or two within the library. It is simple to implement. By the way, you can share your working TFT with us.

Indeed, we must know the correct function of each pin, otherwise what we connect will not respond as we expect.

It's great that you were able to isolate the problem and that the wiring was correct.

The line are not an issue anymore, they boot up with a line but after adjusting the knob/volume it disappears.

B̶u̶t̶ I̶'m̶ s̶t̶i̶l̶l̶ n̶o̶t̶ s̶u̶r̶e̶ if̶ I̶ c̶a̶n̶ r̶e̶s̶e̶t̶ t̶h̶e̶ b̶a̶c̶k̶l̶i̶g̶h̶t̶ o̶n̶ t̶h̶e̶ f̶i̶r̶s̶t̶ d̶i̶s̶p̶l̶a̶y̶, a̶l̶l̶ I̶ c̶a̶n̶ f̶i̶n̶d̶ i̶s̶ t̶h̶a̶t̶ i̶t̶ u̶s̶e̶s̶ P̶W̶M̶. D̶o̶ y̶o̶u̶ k̶n̶o̶w̶ h̶o̶w̶ I̶ c̶a̶n̶ d̶o̶ t̶h̶a̶t̶?̶ N̶o̶w̶ i̶t̶'s̶ j̶u̶s̶t̶ a̶ l̶i̶g̶h̶t̶g̶r̶a̶y̶ s̶c̶r̶e̶e̶n̶ (̶i̶t̶s̶ n̶o̶t̶ c̶o̶n̶n̶e̶c̶t̶e̶d̶ i̶n̶ t̶h̶e̶ p̶i̶c̶t̶u̶r̶e̶)̶.
Got scared when I saw "PWM", but it was as simple as connecting a potentiometer to the BLK pin. All three displays are working now, thanks again for the help!!

I'm working on a volume control hub and 3d print a box, I'll also add a IR transmitter to control my fan leds & speed, and I'll try and add pictures (gifs if possible) instead of text for Spotify etc:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.