Arduino uno with TFT7735 1.8" not working (yet)

This is the first time that i want to use a TFT screen ( as a newbee).

I bought a TFT st7735 1.8"display

I want to hook it up to a Arduino uno.

The library i found GitHub - Bodmer/TFT_ST7735: Arduino graphics library for ST7735 displays with propotional fonts

Is there a better one?

The connectionpins supplied by the supplier :
The most concise wiring IO: (at least only 3 IO)

1.RST - Directly connected to the MCU reset signal side of this IO can be saved
2.CS - then low, long-term chip select this IO can save
3.AO - then IO control register selection
4.SDA - then IO control data transfer
5.CLK - then IO control SPI bus
6.LED - then high-level 3.3V backlight is always bright This IO can be saved

IO used for standard wiring: (6 IOs)

1.RST - then IO control LCD reset
2.CS - then IO control chip select
3.AO - then IO control register selection
4.SDA - then IO control data transfer
5.CLK - then IO control SPI bus
6.LED - then IO control backlight off or PWM control brightness

i found in the samples of github.com/Bodmer/TFT_ST7735:

sclk 13 // Don't change, this is the hardware SPI SCLK line
mosi 11 // Don't change, this is the hardware SPI MOSI line
cs 10 // Chip select for TFT display
dc 9 // Data/command line
rst 7 // Reset, you could connect this to the Arduino reset pin

The physical pins on the bought tft screen are (they do not compare with the pins in the picture of the supplier):

VCC = 3.3v or 5v?
GND = Ground
GND = Ground
NC = Not connected
NC = Not connected
NC = Not connected
CLK = to pin 13 ?
SDA = to pin 11?
RS = to pin ?
RST = to pin 7?
CS = to pin 10?

I read somewhere in this forum that i need to use 1k2 resistors. Is this correct?

Can somebody please help me to get this working without any smoke.

Do i need to provide more info?

Thanks in advance.

Do not believe Ebay vendors. This display must have 3.3V logic signals.

Bodmer gives practical advice for wiring to the 5V Uno. i.e. use series resistors.

Life is simpler with a 3.3V Due, STM32, Teensy. You do not need any level shifters.
Some Uno clones have switchable 3.3V / 5V GPIO.

David.

so this should work ? :

VCC = 3.3v (Uno has 3.3v onboard)
GND = Ground
GND = Ground
NC = Not connected
NC = Not connected
NC = Not connected
CLK = to pin 13 with 1k2 resistor in serie ?
SDA = to pin 11 with 1k2 resistor in serie ?
RS = to pin ? with 1k2 resistor in serie ?
RST = to pin 7? with 1k2 resistor in serie ?
CS = to pin 10? with 1k2 resistor in serie ?

Looks about right to me.

Bodmer suggests series resistor values on his wiki. I would expect anything from 1k2 to 10k to work.

Personally, I just run at 3.3V. It is a lot easier.

David.

These are the pins used by default in the User_Setup file:

#define TFT_CS 9 // Chip select control pin
#define TFT_DC 8 // Data Command control pin
#define TFT_RST 7 // Reset pin (could connect to Arduino RESET pin)

TFT signal line DC may be called RS or AO

Yes, you need those 5 series resistors, just as you listed.

Some displays have a 5V to 3.3V regulators fitted, in that case VCC can be connected to 5V

Tried to do the test if it is working but i failed.
I order to avoid bad contacts, i soldered everything.
Installed Bodmer Library without any problems.
I run one of the examples but no succes.
The tft screen gets white when i put the 3.3 v on
I can upload the program without any problems.

The hookup is done as :

VCC = 3.3v (Uno has 3.3v onboard)
GND = Ground (uno has 2 so i used both)
GND = Ground
NC = Not connected
NC = Not connected
NC = Not connected

CLK = to pin 13 with 4k7 resistor in serie
SDA = to pin 11 with 4k7 resistor in serie
RS = to pin 8 with 4k7 resistor in serie
RST = to pin 7 with 4k7 resistor in serie
CS = to pin 9 with 4k7 resistor in serie

Can somebody help me out?

You can connect VCC to the 5V pin on the Uno. The Red pcb has got an AMS1117 LDO regulator.
The 4k7 series resistors make the Uno 5V GPIO "safe" for the 3.3V display logic pins.

I would expect the display might "work" with 3.3V on VCC pin but the AMS1117 requires 5V for normal operation i.e. an input voltage higher than output voltage.

David.

I changed the VCC to the 5V pin and it is still the same.
A least no smoke :wink:
The TFT screen is still "white" and it looks it is "turned" on.

Do i need to change something in the demo programma's? with the above pinsetting?

Your link in #0 shows a Red 128x160 display. These are very common. The pins are:

LED
SCK
SDA
A0
RESET
CS
GND
VCC

There are plenty of tutorials for wiring these up.
The pin names do not coincide with your message #5.

Bodmer replied to you in #4.
I would follow his advice to the letter.

Post a photo of your actual wiring. A fresh pair of eyes might spot your problem.
First off. Verify that your pcb matches the link in #0. Is it Red?

David.

Finally back home so i can upload some pictures as David asked for.
I hope that somebody can tell me what i am doing wrong.

The photo's can be found at:
http://www.ge.tt/1LzBrAq2

@Smitty,

The photo in the first link of the original message shows a Red 128x160 3.3V display.
The photo of your actual display shows a Red 128x160 5V display.

I am guessing that the chip is a 74HC245. This performs level shifting. The board looks similar to a ILI9225 display. The ILI9225 display does not like 3.3V logic.

The reason for the strange pin layout is to mate LCD_CS with A5 on your Uno. VCC mates with 5V pin. The display sticks out of the left side of the Uno.
Install the Adafruit_ST7735 library via the Library Manager.

Edit the constructor in the examples:

// Option 1: use any pins but a little slower
//Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);
Adafruit_ST7735 tft = Adafruit_ST7735(A5, A3, A2, A1, A4);

Run all the examples with this constructor. Make sure everything is 100%.

Then you can re-wire for the hardware SPI. No resistors. Straight jumpers between LCD_SCK to D13, LCD_SDA to D11. Choose any pins except D0, D1, D11 for LCD_A0, LCD_RESET, LCD_CS. One jumper LCD_GND to GND. Jumper LCD_VCC to 5V.

The hardware SPI will run faster.

Bodmer's library and PDQ_ST7735 will work faster. For a small screen speed does not really matter.

Please let us know how you get on.

David.

@David,

As promised my feedback.
Both options are working fine!
I have a little noise at 2 sides of the display.
I think only one row (one horizontal en one vertical). Can that be adjusted?

Not that it is working, can I use the SD slot? and if so how do i have to connect this?

Is this the smartest display i could buy regarding price or are there better "standard 1.8" tft " displays?

Thanks for your great help. It is really appriciated!!

I had never seen this type of display. I know plenty of the 3.3V type from #0 link.

In theory the SD should have 3.3V logic. It MUST have 3.3V for power (as supplied by the AMS1117)
In practice, the SD seems to tolerate 5V logic (there are series resistors).

I always use 3.3V GPIO e.g. from Xmega, SAM, SAMD, STM32,
I put SD and TFT on the same hardware SPI bus. Separate TFT_CS and SD_CS lines.

I suggest that you do the same. The TFT has HC245 level shifter. The SD might even use the HC245 too. Or just rely on the SD being 5V tolerant.

Personally, I make proper adapter shields for displays e.g. with mating headers.

David.

I am playing for a while now with the TFT7735 and it does want i want till now.
Now I want to connect a seperate sd card to it ( because of the space i need not the built in) but I am not get it to work.

What i did :
connected to a UN0 using 1.8.5

TFT7735 :
SCK/CLK = pin 13
SDA/MOSI = pin 11
CS = pin 7 // Chip select control pin
DC / RS = pin 9 // Data Command control pin
RST = pin 8 // Reset pin (could connect to Arduino RESET pin)
libriary from bodmar

running sketch below and it is running oke.

#include <TFT_ST7735.h> // Hardware-specific library

TFT_ST7735 tft = TFT_ST7735();       // Invoke custom library
int x;
int y;
void setup(void) {
 
tft.init();   // initialize a ST7735S chip
tft.setRotation(1); 
tft.fillScreen(ST7735_BLACK);
delay(1000);       
}

void loop() {
  
    
tft.fillScreen(ST7735_BLACK);
uint8_t radius=5;
  for (uint8_t radius=2; radius < tft.height()/2-5; radius=radius+2) {
        tft.drawCircle(80, 64, radius, ST7735_GREEN);
   delay(100); 
}
  }

Connect a sd card to the Arduino.
pinsetting :
GND = GND
VCC = 5v
MISO = 12(er staat moso op de kaart)
MOSI = 11
SCK = 13
CS = 4

When i run sketch belo, it is running without any problems and the tft screen is still connected.
(using the standard sd libriary)

/*
  SD card read/write

 This example shows how to read and write data to and from an SD card file
 The circuit:
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 4 (for MKRZero SD: SDCARD_SS_PIN)

 created   Nov 2010
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe

 This example code is in the public domain.

 */

#include <SPI.h>
#include <SD.h>

File myFile;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }


  Serial.print("Initializing SD card...");

  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  myFile = SD.open("test.txt", FILE_WRITE);

  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to test.txt...");
    myFile.println("testing 1, 2, 3.");
    // close the file:
    myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }

  // re-open the file for reading:
  myFile = SD.open("test.txt");
  if (myFile) {
    Serial.println("test.txt:");

    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
}

void loop() {
  // nothing happens after setup
}

When I want to use them both, i get the message "initialization failed! , using the sketch below
It looks that i have a kind of conflict but I how no clue how to solve it.

#include <TFT_ST7735.h> // Hardware-specific library


#include <SPI.h>
#include <SD.h>

File myFile;

TFT_ST7735 tft = TFT_ST7735();       // Invoke custom library
int x;
int y;



void setup(void) {
tft.init();   // initialize a ST7735S chip
tft.setRotation(1); 
tft.fillScreen(ST7735_BLACK);
delay(1000);      

Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }


  Serial.print("Initializing SD card...");

  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

 
}

void loop() {
  
    
tft.fillScreen(ST7735_BLACK);
uint8_t radius=5;
  for (uint8_t radius=2; radius < tft.height()/2-5; radius=radius+2) {
        tft.drawCircle(80, 64, radius, ST7735_GREEN);
   delay(100); 
}


// open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  myFile = SD.open("test.txt", FILE_WRITE);

  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to test.txt...");
    myFile.println("testing 1, 2, 3.");
    // close the file:
    myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }

  // re-open the file for reading:
  myFile = SD.open("test.txt");
  if (myFile) {
    Serial.println("test.txt:");

    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }


  }

Could somebody help me out?

Try turning on transaction support in the setup file:

#define SUPPORT_TRANSACTIONS

see the comments at the end of the setup file.

Hello Bodmer,

In the User_Setup.h I deleted the // before the #define SUPPORT_TRANSACTIONS.
The program gets bigger as you already suggested.

Now I get initialization done." but I get the error opening test.txt.
(I also run only the read/write test as the code above, and that is working).

is looks we are a step further....

any suggestions how to solve it?

thx for the reply.

Try initialising the sd library before the tft in the setup().

Hello Bodmer,

i tested as you said which the sketch below.
The result is the same .

in monitor i get :
Initializing SD card...initialization done.
error opening test.txt

other suggestions?

#include <TFT_ST7735.h> // Hardware-specific library

#include <SPI.h>
#include <SD.h>

File myFile;
TFT_ST7735 tft = TFT_ST7735();       // Invoke custom library
int x;
int y;
void setup(void) {
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  Serial.print("Initializing SD card...");
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    return;
  }
  Serial.println("initialization done.");

tft.init();   // initialize a ST7735S chip
tft.setRotation(1); 
tft.fillScreen(ST7735_BLACK);
delay(1000);      

tft.init();   // initialize a ST7735S chip
tft.setRotation(1); 
tft.fillScreen(ST7735_BLACK);
delay(1000);      

 
}

void loop() {
  
    
tft.fillScreen(ST7735_BLACK);
uint8_t radius=5;
  for (uint8_t radius=2; radius < tft.height()/2-5; radius=radius+2) {
        tft.drawCircle(80, 64, radius, ST7735_GREEN);
   delay(100); 
}


// open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  myFile = SD.open("test.txt", FILE_WRITE);

  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to test.txt...");
    myFile.println("testing A, B, C.");
    // close the file:
    myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }

  // re-open the file for reading:
  myFile = SD.open("test.txt");
  if (myFile) {
    Serial.println("test.txt:");

    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
}

It looks as if your display is similar to the common 5V ILI9225 boards as in #10.

Bodmer's TFT_ST7735 library will expect you to use hardware SPI pins.
The SD library expects you to use hardware SPI pins.

It should not make any difference whether you use the onboard SD or an external SD holder.
Post a photo of schematic or the actual wiring. What does your external SD holder look like?

My ILI9225 is not readable. Even though the chip uses 4-wire SPI with separate SDI, SDO pins. TFT_SDO is not connected.
Your ST7735 uses a single bidirectional SDA pin. I doubt if your board is readable.

There should be no conflict with TFT_SDI, TFT_SDA, SD_MOSI on the MOSI line .
TFT_SDO on my board is not connected. So you only have SD_MISO on the MISO line.

Life would be a lot simpler if you used the onboard SD. We could be fairly certain that your board behaves like my ILI9225 board.

David.

David wrote :

It looks as if your display is similar to the common 5V ILI9225 boards as in #10.
=> is correct, it is the same board.

Bodmer's TFT_ST7735 library will expect you to use hardware SPI pins.
The SD library expects you to use hardware SPI pins.
=> I understand.

It should not make any difference whether you use the onboard SD or an external SD holder.
Post a photo of schematic or the actual wiring. What does your external SD holder look like?
=> see attached link.
link to setup

My ILI9225 is not readable. Even though the chip uses 4-wire SPI with separate SDI, SDO pins. TFT_SDO is not connected.
Your ST7735 uses a single bidirectional SDA pin. I doubt if your board is readable.
=> i do not understand, could please explain a little more?

There should be no conflict with TFT_SDI, TFT_SDA, SD_MOSI on the MOSI line .
TFT_SDO on my board is not connected. So you only have SD_MISO on the MISO line.
=> i do not understand, could please explain a little more?

Life would be a lot simpler if you used the onboard SD. We could be fairly certain that your board behaves like my ILI9225 board.
=> so if i use the onboard SD then how to connect the SD on the tft board to the Uno?

cs = pin 4
mosi = pin 11
sck = pin 13
miso = pin 12

(I made the wires mosi and sck as short as possible)