Connect 1.8″ TFT SPI to Arduino UNO

Posted on by

Test TFT connected to Arduino with the text “Scidle.com”

 If you are thinking of doing a project with Arduino UNO and need to view data without having to show them through a serial or USB port on your computer, you’ll need a small screen or display. Let’s see how to use a TFT 1.8″ by SPI. It is not designed for use with an Arduino UNO so its I/O ports do not work 3.3V but 5V. What it allows is powered at 5V, in fact if we feed it to 3.3V for use with an Arduino Nano or 3V Trinket have to short the JP1 connection to not use the voltage regulator that powers both the TFT as the SD card. In this case we will not use the SD Card, but also works at 3.3V, although explain its use in another entry.

Back of the TFT

Back of the TFT

Pins of TFT:
  • Alimentation(VCC, GND): By default must be connected to 5V, but if we short-circuit JP1 we have to feed 3.3V.
  • TFT – I/O (RESET, AO, SDA, SCK, CS): Work at logic levels from 3.3V to 0V.
  • Tarjeta SD – I/O(SCK, MISO, MOSI, CS):  Work at logic levels from 3.3V to 0V.
  • Backlighting (LED+, LED-): We connect to 3.3V (LED +) and 0V (LED-), but this way we can not control the intensity. A good way would be to use a circuit with a transistor controlled by PWM, so that by varying the duty cycle give the feeling of a variation in the intensity of light, when you are actually turning off and on several times per second, according to frequency we choose.
Pins of TFT

Pins of TFT

To connect to the TFT to an Arduino UNO have to change the levels 5V to 3.3V with 74HC245.

Before connecting, we must see settings that we have to use on 74HC245. Keep in mind that port An is 3.3V and port Bn 5V. In addition the master SPI is Arduino UNO so Bn must be An input so output being  A=B. To operate in this way the settings are /OE=L DIR=L.

74HC245 Configuration Table.

The connection with Arduino UNO  is the following (Click on image to higher resolution).

Connection between 74HC245 Arduino UNO and TFT

When everything is connected as in the scheme, we load our first test in Arduino UNO, We will need to have installed the Adafruit_GFX and Adafruit_ST7735 libraries. A sample code to start can be this:

#include <Adafruit_GFX.h>    
#include <Adafruit_ST7735.h>
#include <SPI.h>

#define TFT_CS     10
#define TFT_RST    9  
#define TFT_DC     8
#define TFT_SCLK 13
#define TFT_MOSI 11

Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS,  TFT_DC, TFT_RST);
void setup(void) {
  tft.initR(INITR_BLACKTAB);
}

void loop() {
  delay(500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_RED);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_MAGENTA);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_YELLOW);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_GREEN);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_BLUE);
  tft.println("Scidle.com");
  delay(1500);
  tft.setCursor(20, 55);
  tft.setTextColor(ST7735_CYAN);
  tft.println("Scidle.com");
  delay(1500); 
}

Test TFT 1.8″ connected to Arduino UNO

Now you can enjoy your TFT connected to Arduino UNO to make your projects more interactive and engaging.

Comments are disabled