# St7735 128x160 tft lcd

**URL:** <https://community.particle.io/t/st7735-128x160-tft-lcd/62503>\
**Category:** Hardware\
**Tags:** argon\
**Created:** [April 29, 2022, 1:16am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503 "2022-04-29T01:16:06Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrjack](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jrjack](https://community.particle.io/u/jrjack)\
**Post date:** [April 29, 2022, 1:16am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/1 "2022-04-29T01:16:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 29, 2022, 1:28am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/2 "2022-04-29T01:28:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jrjack](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jrjack](https://community.particle.io/u/jrjack)\
**Post date:** [April 29, 2022, 1:30am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/3 "2022-04-29T01:30:14Z")

</div>

[https://www.aliexpress.com/i/32988162684.html](https://www.aliexpress.com/i/32988162684.html)

This one.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 29, 2022, 2:05am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/4 "2022-04-29T02:05:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jrjack](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jrjack](https://community.particle.io/u/jrjack)\
**Post date:** [April 29, 2022, 2:09am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/5 "2022-04-29T02:09:46Z")

</div>

ok sounds good. thank you so much

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 29, 2022, 12:46pm UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/6 "2022-04-29T12:46:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jrjack](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jrjack](https://community.particle.io/u/jrjack)\
**Post date:** [April 29, 2022, 2:11pm UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/7 "2022-04-29T14:11:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 29, 2022, 4:33pm UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/8 "2022-04-29T16:33:15Z")

</div>

@jrjack

[Here is an example](https://go.particle.io/shared_apps/626c1236cc643600fdfa3741) 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:

```auto
 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

```

---

<div class="post-metadata">

**Author:** ![jrjack](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jrjack](https://community.particle.io/u/jrjack)\
**Post date:** [April 29, 2022, 10:25pm UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/9 "2022-04-29T22:25:33Z")

</div>

![16512710190924331286999777222954](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/c/e/ce477fbc9912476f7606082eba7a0492019f438b.jpeg)

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

---

<div class="post-metadata">

**Author:** ![dreamER](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/dreamer/32/26550_2.png) [@dreamER](https://community.particle.io/u/dreamER)\
**Post date:** [April 30, 2022, 1:42pm UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/10 "2022-04-30T13:42:40Z")

</div>

Hi,  
I believe that a good staring point is [Adafruit resources](https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts) well explained and everything in one place.  
Best,  
Arek

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [April 30, 2022, 2:04pm UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/11 "2022-04-30T14:04:56Z")

</div>

Thanks @dreamER! I have also used a font library called [RREFont](https://github.com/cbm80amiga/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.

---

<div class="post-metadata">

**Author:** ![jrjack](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jrjack](https://community.particle.io/u/jrjack)\
**Post date:** [May 7, 2022, 11:13pm UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/12 "2022-05-07T23:13:27Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/d/7/d7b1bdea788fd0a167df10850c4587f954336cca.png)

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [May 7, 2022, 11:50pm UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/13 "2022-05-07T23:50:55Z")

</div>

@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`.

---

<div class="post-metadata">

**Author:** ![jrjack](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jrjack](https://community.particle.io/u/jrjack)\
**Post date:** [May 8, 2022, 12:38am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/14 "2022-05-08T00:38:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [May 8, 2022, 1:14am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/15 "2022-05-08T01:14:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jrjack](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jrjack](https://community.particle.io/u/jrjack)\
**Post date:** [May 8, 2022, 1:25am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/16 "2022-05-08T01:25:10Z")

</div>

Tried this, no luck

```auto

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()
{

}

```

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [May 8, 2022, 2:04am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/17 "2022-05-08T02:04:37Z")

</div>

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

```auto
  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());

```

---

<div class="post-metadata">

**Author:** ![jrjack](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jrjack](https://community.particle.io/u/jrjack)\
**Post date:** [May 8, 2022, 11:43am UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/18 "2022-05-08T11:43:09Z")

</div>

> [@peekay123](#):
>
> ```auto
> 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());
> 
> ```

Awesome 🙂 thank you sooo much!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/6/4/64635adccc35238caa19e9b553ec3e98b163d026.png) [@system](https://community.particle.io/u/system)\
**Post date:** [June 7, 2022, 9:43pm UTC](https://community.particle.io/t/st7735-128x160-tft-lcd/62503/19 "2022-06-07T21:43:42Z")

</div>

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