Go Down

Topic: Cheap 1.8" TFT (ST7735R) how to wire? (Read 10524 times) previous topic - next topic

K5CZ



I'm very confused how to wire this display to my Arduino Mega 2560. I found code below, but I'm not sure what is what due to different labeling. Adafruit's tutorial for similar display is for UNO and Mega is mentioned vaguely.

Code: [Select]

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library
#include <SPI.h>

#define sclk 13
#define mosi 11
#define cs   53
#define dc    8
#define rst   0

...

Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);



Code: [Select]

GND       GND
VCC       +5V
RESET     0 (?)
AO        8 (?)
SDA       20-SDA (?)
SCK       21-SCL (?)
CS        53-CS (?)
SCK_SD    52-SCK (?)
MISO_SD   50-MISO (?)
MOSI_SD   51-MOSI (?)
CS_SD     4 (?)
LED+      +5V (?)
LED-      GND (?)


At first, I want to test TFT. The SD slot at last.

K5CZ

Finally, I use this and it works:

Code: [Select]

#define cs   4 //CS
#define sclk 5 //SCK
#define mosi 6 //SDA
#define dc   7 //A0
#define rst  8 //RESET

Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);


..\Arduino\libraries\Adafruit_ST7735\examples\graphicstest\graphicstest.ino

MarkT

Thanks for documenting that - is the display module an eBay one?  If so do you have a link
so others can know how to get an identical unit?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

K5CZ

I bought it here (the prices are unbelievable):

http://www.aliexpress.com/wholesale?SearchText=1.8%22+SPI+TFT+LCD+PCB

This is mine:
http://www.aliexpress.com/store/product/Freeshipping-1-8-Serial-SPI-TFT-Color-LCD-module-with-PCB-board-128x160-with-SD-Card/620726_816360549.html

K5CZ

My latest wiring for Due/Mega/Uno for SPI displays (now I have three different types of SPI displays, but wiring is equal)

Code: [Select]

#if defined(__SAM3X8E__)
#define TFTcs   PIN_SPI_SS0  //CS - CE            (pin 77)
#define TFTsclk PIN_SPI_SCK  //hw SPI - SCK       (pin 76)
#define TFTmosi PIN_SPI_MOSI //hw SPI - SDA - DIN (pin 75)
#define TFTdc   49           //A0 - DC - RS - D/C
#define TFTrst  48           //RESET
#endif

#if defined(__AVR_ATmega2560__)
#define TFTcs   SS           //CS - CE            (pin 53)
#define TFTsclk SCK          //hw SPI - SCK       (pin 52)
#define TFTmosi MOSI         //hw SPI - SDA - DIN (pin 51)
#define TFTdc   49           //A0 - DC - RS - D/C
#define TFTrst  48           //RESET
#endif

#if defined(__AVR_ATmega328P__)
#define TFTcs   SS           //CS - CE            (pin 10)
#define TFTsclk SCK          //hw SPI - SCK       (pin 13)
#define TFTmosi MOSI         //hw SPI - SDA - DIN (pin 11)
#define TFTdc    9           //A0 - DC - RS - D/C
#define TFTrst   8           //RESET
#endif



Wirings for "hw SPI" pins are mandatory, rest of the pins are movable to another pins.
Definition of TFT display in the *.INO can be:

(example for Adafruit's libraries):
Code: [Select]
Adafruit_ILI9340 tft = Adafruit_ILI9340(TFTcs, TFTdc, TFTrst);
or
Code: [Select]
Adafruit_ST7735 tft = Adafruit_ST7735(TFTcs, TFTdc, TFTrst);

(example for Universal TFT library):
Code: [Select]
UTFT myGLCD(TFT01_22SP,TFTmosi,TFTsclk,TFTcs,TFTrst,TFTdc);
or
Code: [Select]
UTFT myGLCD(ITDB18SP,TFTmosi,TFTsclk,TFTcs,TFTrst,TFTdc);
or
Code: [Select]
UTFT myGLCD(TFT01_18SP,TFTmosi,TFTsclk,TFTcs,TFTrst,TFTdc);

PedroDanny

I have the same 1.8" TFT and a Arduino Mega but i don't understand how i can wire then, and the code how can i read an image from my sd card? some one have an example?

boi_goog

is ST7735S compatible with ST7735R?

K5CZ


is ST7735S compatible with ST7735R?

Almost yes.

Adafruit-ST7735-Library
Code: [Select]

tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip
tft.initR(INITR_REDTAB);   // initialize a ST7735R chip


boi_goog

oh ok that's nice, thank you so much.

deseipel

Can you detail the Hardware SPI wiring for the DUE?  I have the Adafruit 1.8" TFT w/SD & Joystick and a Due and I'm using their library & sdfat and I can't get the simple examples to work at all.  just a white screen. 

Go Up