I have buyd a 2.2 tft lcd on ebay and i dont know how to connect it.
Can any tell my how to connect and so that it will work with this adafruit libary
My display use this chip: ili9341
(I dont know why the title of this libary not is ILI9341 but it if this libary not will work can any give a another libary?)
Thanks
i have downloaded the ili9341 libary from adafruit and in the example i found this: #define TFT_DC 9 #define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
#define SD_CS 4
so have i only to connect the tft_dc and the tft_cs?
if no: can any give how to connect it correct and can i use this libary?
edit:
in the adafruit ili9341 libary i found this example:
/***************************************************
This is our GFX example for the Adafruit ILI9341 Breakout and Shield
----> http://www.adafruit.com/products/1651
Check out the links above for our tutorials and wiring diagrams
These displays use SPI to communicate, 4 or 5 pins are required to
interface (RST is optional)
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
Written by Limor Fried/Ladyada for Adafruit Industries.
MIT license, all text above must be included in any redistribution
****************************************************/
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);
void setup() {
Serial.begin(9600);
Serial.println("ILI9341 Test!");
tft.begin();
// read diagnostics (optional but can help debug problems)
uint8_t x = tft.readcommand8(ILI9341_RDMODE);
Serial.print("Display Power Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDMADCTL);
Serial.print("MADCTL Mode: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDPIXFMT);
Serial.print("Pixel Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDIMGFMT);
Serial.print("Image Format: 0x"); Serial.println(x, HEX);
x = tft.readcommand8(ILI9341_RDSELFDIAG);
Serial.print("Self Diagnostic: 0x"); Serial.println(x, HEX);
Serial.println(F("Benchmark Time (microseconds)"));
Serial.print(F("Screen fill "));
Serial.println(testFillScreen());
delay(500);
...
know any how to connect my screen so it works with this?
The connection must be done as below but keep in mind that you need a level shifter between your display pins and the arduino pins because your display is 3.3 V and you arduino is 5V.
with the below connections and the level shifter you can use hardware SPI.
the screen signals -----> MOSI MISO SCK DC Cs
must be connected to the Uno pins -----> 11 12 13 9 10
i will make the level shifter.
bit i dont understand where the level shifter(s) must pe placed.
so can u make a schematic and/or tell how to make a level shifter?
and wich pins need a level shifter?
Hi,
i used resistors divider as level shifter, work perfectly with 3 diff libraries.
For arduino123456789 :
i used an home-made copy of freetronics "Eleven", equivalent to UNO :
from pin 4, resistor of 1K8 in serie with resistor of 3K3 then GND.
common point of the 2 resistors wired to RESET of the TFT Display
same wiring for :
pin 5 to CS, pin 6 to D/C, pin 11 to SDI(MOSI), pin 13 to SCK.
resistor of 15R from LED (display) to 3V3
VCC (display) also to 3V3
of course GND common
SDO(MISO) from display not connected. It is an output not used in the libraries.
Just one line to modify in the sketch, example for UTFT library :
UTFT myGLCD(ILI9341_S5P,11,13,5,4,6); // Remember to change the model parameter to suit your display module!
from pin 4, resistor of 1K8 in serie with resistor of 3K3 then GND.
common point of the 2 resistors wired to RESET of the TFT Display
same wiring for :
pin 5 to CS, pin 6 to D/C, pin 11 to SDI(MOSI), pin 13 to SCK.
resistor of 15R from LED (display) to 3V3
VCC (display) also to 3V3
of course GND common
SDO(MISO) from display not connected. It is an output not used in the libraries.
Just one line to modify in the sketch, example for UTFT library :
UTFT myGLCD(ILI9341_S5P,11,13,5,4,6); // Remember to change the model parameter to suit your display module!
Regards
Jacques
can u make a schematic please?
and i will use the libary from adafruit.
edit:
need the MOSI MISO SCK DC CS and level shifter to?
if yes: can i use 4.7K ohm?
that makes from 4,5v to 2,3 v.
Vin is output of Arduino
Vout is input of display
Z1 value : 1K8 and Z2 value is 3K3
You must keep this ratio 1.8/3.3 if you choice an other value but resistors have to be different
You must put this resistor divider on the 5 signal lines from Arduino to display