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
@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.
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
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?
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.
@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.
@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).
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());