TFT Display (1.8", ST7735) not working with Particle photon

Despite my best efforts I can’t seem to get my 1.8" TFT LCD to work with my Particle Photon.

I have been tinkering with an Arduino Uno for maybe five months now and recently got my Particle, so I am by no means confident in my abilities. I am hoping that you guys might be able to tell me what I am doing wrong/missing in my approach.

The LCD breakout has the following PINs:

  1. VCC
  2. GND

// 5wire SPI
3. !SCL (SCLK for TFT Clock)
4. !SDA (LCD Data for SPI)
5. DC
6. RES
7. CS

// Micro SD
8. *CS
9. *MISO

// 3-axis (accelerometer)
10. x
11. y
12. z
//
13. BL (Backlight)

I dont use the Accelerometer or the Micro-SD, as my test-code will show:

// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_ST7735.h>
#include <Adafruit_mfGFX.h>

#define TFT_CS     A2
#define TFT_RST    -1
#define TFT_DC     A1
#define TFT_SCLK   A3 // !SCL ?
#define TFT_MOSI   A5 // !SDA ?


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


void setup() {
  
  tft.initR(INITR_BLACKTAB);
  tft.fillScreen(ST7735_BLACK);

  tft.setCursor(0, 0);
  tft.setTextColor(ST7735_WHITE);
  tft.setTextWrap(true);
  
  tft.print("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante..");
}

void loop() {
      tft.fillScreen(ST7735_BLACK);
      delay(1000);
      tft.fillScreen(ST7735_WHITE);
      delay(1000);
}

The firmware on Photon is version 0.6.3.

Here is the LCD breakout:

I am grateful for any help i can get, and please let me know if you need any additional information. I can say that i tried this LCD on my Arduino with 3.3V and it works perfectly.

Edit: I also want to mention that I looked at what I could find on the forum before posting this (so I know that this exists https://community.particle.io/t/solved-getting-the-st7735-to-work-with-spark/11392), but after trying alot (if not all) the different wiring-solutions I can’t help but feeling like I am missing something that is not related to the wiring (but i might be wrong of course).

Edit nr.2: I don’t know if it matters, but I am using the online IDE

  1. Make a new file and make sure you include the “ADAFRUIT_ST7735” library into this file using the online IDE.
  2. The pins seem to be correct in your example. Here’s what I used:

SDA (MOSI) = pin 11 = A5
SCL (SCK) = pin 13 = A3
SS (CS) = pin 10 = A2
DC = pin 9 = A1 (Command/Data Selection)
RES (RST) = pin 8 = A0 (LCD controller reset, active low )

  1. Paste the following code into the file: https://go.particle.io/shared_apps/5a149db37fac74cf4b0003ff

  2. Compile

Here’s my hookup:

1 Like

Hi! Thank you for your swift reply.

I followed your steps and copied the code you provided.

I did notice that when i flash it to the Particle, the screen flickers once, but nothing more. (The flicker is <0.5 sec, and it’s like when the tv has no signal - a snowstorm where every pixel flashes some random color - if that makes sense).

I will do some more reading and tinkering and come back tomorrow with a more detailed explanation.

Things I’m looking in to:

  • Could it be bad wires? (I’ve tried almost all the wires I have, and i also tested them with an LED)

  • Could it be a problem with the clock settings? (desync)

  • Could it be a speed-problem? (adjust data rate)

Is there anything else i should be looking into?

Hi,
It’s usually a case of cables not being connected (either from bad cables or misconnection). Make sure you go over the wiring properly by completely disconnecting what you already have connected. Zoom in on the picture above and make sure you the exact same wiring and it will work (unless your screen is defective).

Hmm, I find this to be rather strange.

Here is my hookup for the particle:

And this is the code:

// This #include statement was automatically added by the Particle IDE.
#include <Adafruit_ST7735.h>

#define cs   A2
#define dc   A1
#define rst  A0 

Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, rst); // hardware spi

void setup()
{
	tft.initR( INITR_GREENTAB );
     
	tft.fillScreen(ST7735_BLACK);

    tft.setCursor(0, 0);
    tft.setTextColor(ST7735_WHITE);
    tft.setTextWrap(true);
    tft.print("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla");     
    
    tft.drawLine(0, 0, tft.width()-1, tft.height()-1, ST7735_YELLOW);
    tft.drawLine(tft.width()-1, 0, 0, tft.height()-1, ST7735_YELLOW);

    tft.drawPixel(0, tft.height()/2, ST7735_GREEN);

}

void loop() {

}

And here is the hookup for the TFT on my arduino, running on 3.3V:

Can you spot any errors I might have made?

Any other tips on how to troubleshoot this is also greatly appreciated.

It all looks correctly connected. It compiles without error?
Try swapping cables one by one in case one of them is bad?

Before flashing it to the Particle Photon i verify the code and it shows no errors. (“Code verified! Great work.”).

I swapped all the wires with the ones I used to test the LCD on my Arduino, and the problem is still the same.

I did, however, notice something interesting while rewiring:
I added the following code to my loop:

void loop() {
  delay(1000);
  tft.fillScreen(ST7735_BLACK);
  delay(1000);
  tft.fillScreen(ST7735_WHITE);
}

And while rewiring i noticed that when the GND pin on my LCD was removed, the screen was switching between white and black (as the loop wants it to do). The screen becomes very poorly lit, and the text and lines in the setup() is still not shown.
(I also tried moving the text-and-lines-part of the setup to the loop, but still nothing is shown)

Does anyone know what might be causing this behaviour?