St7735 128x160 tft lcd

Hello All,

I have a ST7735 based 128X160 TFT LCD that i was trying to get work with my Particle Argon. Going through the forum i wasnt able to find much help. Could someone please guide me on which library to use as well how the Argon needs to be connected. The LCD has the following pins

GND, VCC, SCL,SDA, RES, DC, CS and BL

Would appreciate any guidance.

Thanks

@jrjack, good timing. I recently modified an ST7735 library to optimize it for speed and it works with the Adafruit_GFX graphics library. However, there are different versions of ST7735 units that require minor changes in settings.

Which ST7735 (exactly) are you using?

https://www.aliexpress.com/i/32988162684.html

This one.

@jrjack, I don’t have that unit. It’s late here but I’ll share a link to a Web IDE example in the morning that you can test as a starting point.

ok sounds good. thank you so much

@jrjack, which SPI port are you expecting to use for the display and will it be the only device on the port?

This is the only device. For the spi port, whicever works the fastest :slight_smile:

1 Like

@jrjack

Here is an example and associated ST775 library that will hopefully work. My code was very specifically tuned to an Aliexpress 160x80 unit I have. So I modified portion of the code to set it back to Adafruit’s initialization code for different ST7775 display units.

In the rjack.ino example, you will see, just below the tft.begin() line in setup() two choices for configuring the display based on the “tab” or sticker color on the unit. Based on the Aliexpress link you posted, the image shows a Green tab so that is the first one to try. What you should see, if everything works, is a bouncing and rotating Amiga ball.

The wiring between the display and the Argon is as follows:

 ST7735 128x160 LCD pinout (header at the top for better viewing angles, from left):
 #1 BL    -> 3.3V or unconnected
 #2 SCL   -> SCK/D13
 #3 SDA   -> MO/D12
 #4 DC    -> D6
 #5 RES   -> D5
 #6 CS    -> A2
 #7 GND   -> GND
 #8 VCC   -> 3.3V
2 Likes

Seems to have worked. Thankyou so much :slight_smile: . Final question, i was mostly going to work with text. Where can i find some starter examples on how to style and format it?

Hi,
I believe that a good staring point is Adafruit resources well explained and everything in one place.
Best,
Arek

1 Like

Thanks @dreamER! I have also used a font library called RREFont that uses filled rectangles instead of bitmaps. The fonts (generally) use less room in flash, can be scaled in two dimensions, and are fast to render with the code I supplied to you.

In one project, I used a combination of RREFont and GFX fonts. It all comes down to what you want to do, how fast, how many fonts and much much flash space you can spare.

2 Likes

Hey @peekay123 , thank you again. I was looking at the examples for this. What is the Back light supposed to be?

@jrjack, that is to turn ON or OFF the LCD backlight. You will notice the first few lines of code set that pin HIGH to turn ON the backlight. HOWEVER, you will notice that I directed you to connect the display BL pin to 3.3v or leave it unconnected. Doing so turns on the backlight by default. So you can ignore the #define LCD_BACKLIGHT declaration and the pinMode()/digitalWrite() lines that follow the Serial.begin().

BTW, in that app you show, the pin numbers need to be set to Argon pin numbers, not Arduino pin numbers. In your case, LCD_CS is pin A2.

Thanks got it to work. one more question, how can i rotate the text so that it appears as it would in landscape mode?

@jrjack, you can’t rotate just the text. You have to rotate the display itself using the lcd.setRotation(r) command, where r is a value of 0 to 3 (90 degree rotation increments).

Tried this, no luck


void setup() 
{
  
 tft.begin();
 tft.setRotation(2);
  // Use this initializer if using a 1.8" TFT screen:
  // OR use this initializer if using a 1.8" TFT screen with offset such as WaveShare:
  tft.initR(INITR_GREENTAB);      // Init ST7735S chip, green tab

  tft.fillScreen(bgCol);

  Serial.begin(9600);

  font.init(customRect, SCR_WD, SCR_HT); // custom fillRect function and screen width and height values
//  font.setFont(&rre_8x12);
  font.setFont(&rre_chicago_20x24);

  font.setColor(255);
  
  font.printStr(ALIGN_LEFT,10,"Ambient Temp!");  // center
  font.printStr(ALIGN_CENTER,50,"100000!");  // center
   

}


void loop()
{

}

@jrjack, you need to set the rotation after the tft.initR() command. Also, the font.init() command uses “fixed” width (SCR_WD) and height (SCR_HT) values. When you rotate the display, these change. So you might want to try the following sequence that uses the width and height currently set for the display based on rotation:

  Serial.begin(9600);

 tft.begin();
  // Use this initializer if using a 1.8" TFT screen:
  // OR use this initializer if using a 1.8" TFT screen with offset such as WaveShare:
  tft.initR(INITR_GREENTAB);      // Init ST7735S chip, green tab

 tft.setRotation(2);

  tft.fillScreen(bgCol);

  font.init(customRect, tft.width(), tft.height());

1 Like

Awesome :slight_smile: thank you sooo much!

1 Like

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