3.2" TFT LCD With SD and Touch For Arduino

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Quickstart Guide  

3.2” TFT LCD with SD and Touch for Arduino


Product Name 
Mega with adjustable TFT shield
 —SKU 20‐011‐C45

QUICK SPECS:
Brief Description

Included Items:

-3.2” 320x240 pixel SSD1289-

based TFT LCD with integrated

SD card reader and touch

screen
The Arduino libraries needed to use this display can
-TFT shield for Arduino Mega Getting Started:
be downloaded as a single package at:
with adjustable backlight potenti- Congratulations on your purchase of the SainSMART 3.2” TFT
https://www.dropbox.com/s/
ometer with touch screen and SD reader for Arduino Mega.. These
egguwqx49qr143i/3_2_LCD_Libraries.zip?dl=0
items have been paired to provide you with a working solution

Also Needed: to quickly create your Arduino display project


-UTFT
-Arduino Mega 2560 or ADK
The UTFT library by Henning Karlsen provides an easy
First, unpack your items and inspect for damage. The LCD
way to interface with many popular TFT modules.
module docks onto the shield which then plugs directly onto the

Additional Notes: Arduino Mega board. Use caution when inserting and removing
- ITDB02_Touch
-This item is not suitable for the modules to prevent damage to the interface pins. The LCD
ITDB02_Touch is the legacy version of Henning Karlsen’s
the Arduino UNO due to the will function when the Arduino is powered from either the USB
UTouch library. The UTouch library does not function
number of I/O pins required interface or external power adapter.
properly with the touch controller used on the 3.2” TFT.
for operation

Next, you will need to download and install the needed libraries
-UTFT_SDRaw
-Because of the voltage, logic found in the list to the right. While not mandatory, these librar-
UTFT_SDRaw is an alternative to Henning Karlsen’s
levels, and shield require- ies will allow to you get up and running with your LCD quickly
UTFT_TinyFAT and allows the loading of raw bitmap
ments this item is not suitable and provide an easy way to interface to the hardware through
images to the LCD from the SD card. It uses the standard
for use on the Arduino DUE the Arduino IDE.
SdFat Arduino library for card access.

Visit http://arduino.cc/en/Guide/Libraries for information about


-UTFT_Buttons_ITDB
installing additional Arduino libraries.
UTFT_Buttons_ITDB is a modified version of Henning

Karlsen’s Buttons library that has been adjusted to work


sainLABS with the ITDB02_Touch library
engineering
LCD and Shield pinouts:
Pin Descrip ons:
LCD:
Pin(s) Descrip on

LCD_VCC  +5V supply  TECHNICAL SUPPORT

SainLABS products are engi-


GND  LCD ground bus 
neered with the hobbyist in mind:

LEDA+  LCD backlight supply   our products are supported

through the local and online


DB0—DB15  LCD 16‐bit parallel data interface  SainLABS Community.

LCD_RS, LCD_WR,  LCD data flow control lines 
LCD_RD, LCD_CS,  LEARNING SERVICES
LCD_RST  Not sure what steps to take

TP_CLK, TP_CS,  Touch Panel data flow control  next? Visit http://sainlabs.org to


TP_DIN, TP_BUSY,  lines  find classes and maker-spaces in
TP_DOUT, TP_IRQ 
your area!
SD_CS, MISO, CLK,  SD card slot data control lines 
MOSI  (SPI) 
INVENTOR PORTAL

Do you have a great new idea

but don’t know where to turn? At

Pin(s)‐ Arduino pin in () Descrip on SainLABS, we offer services to


Shield:
+3V3 (3.3V), +5V (5V)  +3.3V and +5V supply  help inventors get products to

GND (GND)  LCD ground bus  market through our own facto-

ries. Visit http://sainlabs.org for


LEDA+ (5V)  LCD backlight supply  
more information.

DB0—DB15 (D37‐D30, D22‐ LCD 16‐bit parallel 
D29)  data interface 

LCD_RS (D38), LCD_WR (D39),  LCD data flow control 
LCD_RD (3.3V), LCD_CS (D40),  lines 
LCD_RST (D41) 

Note: The F_CS pins are not  TP_CLK (D6), TP_CS (D5),  Touch Panel data flow 


used, as the 3.2” LCD does not  TP_DIN (D4), TP_BUSY (D7),  control lines 
come with the flash chip. All  TP_DOUT (D3), TP_IRQ (D2) 
unlabeled pins are NC (not 
SD_CS (D53), MISO (D50),    SD card slot data con‐
connected)  CLK (D52), MOSI (D51)  trol lines (SPI) 

sainLABS
engineering
Assembling the shield and LCD to the Mega:
Begin by carefully star ng the rear 
connector of the TFT shield onto 
the Arduino Mega.  Go slowly and 
Need Accessories?
ensure that all pins are inserted 
Visit http://sainsmart.com for all
correctly and are straight. 
of your maker needs!

INVENTOR PORTAL
Press down on the shield to seat 
Do you have a great new idea
all three connectors fully onto the 
but don’t know where to turn? At
Arduino Mega. Check to ensure all 
SainLABS, we offer services to pins are seated fully. 
help inventors get products to

market through our own facto-

ries. Visit http://sainlabs.org for

more information. Start the LCD display connector 


into the 40‐pin header on the TFT 
shield, ensuring that all pins are 
properly aligned. 

While applying pressure to the 


underside of the TFT shield, fully 
seat the LCD connector onto the 
TFT shield header using a slight 
rocking mo on. 

Finished! Your LCD is now ready to 
use. 

To adjust the backlight: using a non‐conduc ve 


sainLABS tuning wand or screwdriver, turn the poten ometer 
engineering screw on the TFT shield while the unit is powered to 
achieve the desired brightness level. 
Using the LCD: UTFT example sketch
The UTFT library is used to display content to the LCD. UTFT alone does not handle any of the 
touch or SD card access func ons.  

UTFT Demo Sketch

This sample program allows you

test the LCD for proper opera-

tion. If the program runs without


From the Arduino IDE, open the  error, proceed to the next section
UTFT_Demo_320x240 sketch from 
to test the touch panel.
the AVR category.  

Extending the Program

Once you are able to view the

demo, why not make your own

graphics? Read through the

documentation provided with the

UTFT library to learn how to use


The configura on of the example sketch from the download link on page 1 should be correct for 
this type of display. Line 31 declares the display model for UTFT (for more informa on on the sup‐ library functions.

ported displays, see the UTFT documenta on). This will allow UTFT to correctly communicate with 
this LCD.  INVENTOR PORTAL
 
31 UTFT myGLCD(SSD1289,38,39,40,41); Do you have a great new idea

but don’t know where to turn? At


*SSD1289— declares the type of display
SainLABS, we offer services to
*38, 39, 40, 41— defines the pins UTFT should use
help inventors get products to

market through our own facto-

ries. Visit http://sainlabs.org for

more information.

Select the correct board and port from the 


Arduino IDE in the ‘Tools’ menu. Upload the 
sketch and if all goes well, the LCD demo 
should run in a loop. 

Additional Resources sainLABS


engineering
Visit http://sainlabs.org for additional information and to download
the UNO Starter Kit Learning and Project Guide.
Using the Touch Panel: ITDB02_Touch example
sketch

ITDB02_Touch example From the Arduino IDE, open the 


ITDB02_Touch_Bu on_Test sketch from 
The ITDB02_Touch_Button_Test
File ‐> Examples ‐> ITDB02_Touch 
example sketch will allow you to

test operation of the touch panel

and ensure that your libraries are The configura on of the example sketch from the download link on page 1 should be correct 
properly installed. for this type of display. Lines 22 and 23 declare the display model and touch pins for UTFT and 
ITDB02_Touch. Lines 37 and 40 set the correct display and touch orienta on so that the LCD 
and touch panel are in sync. 
 
Extending the program  
22 UTFT myGLCD(SSD1289, 38, 39, 40, 41);
Once you can use the buttons in
23 ITDB02_Touch myTouch(6, 5, 4, 3, 2); TIP: If you do not see 
the demo sketch, read through
line numbers in the 
the ITDB02_Touch documenta- ————— IDE— click File, then 
tion to learn how to take touch choose Preferences. Be 
37 myGLCD.InitLCD(LANDSCAPE);
sure that ‘display line 
input from your new project.
————— numbers’ is checked. 

INVENTOR PORTAL 40 myTouch.InitTouch(LANDSCAPE);


Do you have a great new idea

but don’t know where to turn? At

SainLABS, we offer services to

help inventors get products to

market through our own facto-

ries. Visit http://sainlabs.org for


Select the correct board and port from the 
more information. Arduino IDE in the ‘Tools’ menu. Upload the 
sketch and if all goes well, you will see a bu on 
matrix and entry display. Typing numbers and 
pressing ‘Enter’ will empty the buffer and start a 
new line. Tap away! 

sainLABS
engineering
Reading from SD: UTFT_SDRaw example
NOTE: SD card access can be achieved with the standard SDFat Arduino library alone. 
UTFT_SDRaw allows an easy way to also load bitmap images directly to the LCD from SD card. 
Images must be in ‘565’ .raw format. The UTFT library includes an image converter in the ‘Tools’ 
folder within the library. Images must be uploaded to a FAT forma ed SD card prior to inser ng 
SdRaw example sketch
into the LCD card slot.  
This example will ensure that all

functions of your LCD and shield


Prepare your SD card for this demo  are in order. The SD card can
by ensuring that is forma ed with 
also be accessed by any sketch
the FAT file system. Then copy the 
contents of the ‘Image‐files’ folder  using the SdFat Arduino library.
from the library download to the  The SD card slot uses the stand-
SD card. This will allow the demo 
ard SPI interface pins.
sketch access  

Extending the program

Now that you can load images

from SD, ad some cool custom


With the SD contacts facing 
up, carefully insert the SD  images to your next project, or
card into the slot on the  even create a picture slideshow!
back of the LCD and ensure 
that it is fully seated. 
INVENTOR PORTAL

Do you have a great new idea

but don’t know where to turn? At

SainLABS, we offer services to


From ‘Examples’ in the Arduino 
IDE, open the SdRaw_320x240  help inventors get products to

test sketch.  market through our own facto-

ries. Visit http://sainlabs.org for


The configura on of the example sketch from the download link on page 1 should be correct 
more information.
for this type of display. Lines 33 and 50 declare the display model and touch pins for UTFT and 
ITDB02_Touch. Line 81 sets the correct touch orienta on. 
 
33 UTFT myGLCD(SSD1289, 38, 39, 40, 41);
—————
50 ITDB02_Touch myTouch(6, 5, 4, 3, 2);
—————
81 myTouch.InitTouch(LANDSCAPE);

Select the correct board and port from the 


Arduino IDE in the ‘Tools’ menu. Upload the 
sketch and if all goes well you will see the demo 
play, loading images from the SD card. 

sainLABS
engineering

You might also like