Introduction
The liquid crystal display module based on SPI communication interface, provide 3.5 "TFT LCD, resistive touch screen, built-in Flash flash and SD card external expansion storage. This TFT panel connects directly on top of an Arduino pin compatible device.
Specification
- Model: DM-TFT35-107
- Display size:3.5"
- Operating voltage: 3.3V or 5V
- Resolution ratio: 320x240
- Communication Interface: SPI
- Flash memory: 4MB
- Operating temperature: -10~70℃
- Support micro-SD card
- Support both Arduino and mbed
- Size: 65.14*78.10 (W*H)mm
- Viewing area:52.56*70.08(W*H)mm
- Weight: 56.4g
Pin layout
1.Pin layout:This display uses a SPI interface for TFT, Touch, SD-card and external flash memory.
2.Pin function:This TFT panel connects directly on top of an Arduino pin compatible device.
Basic display Tutorial
1.First download the DmTftLibrary from here: dmtftlibrary.
2.Extract the content to your Arduino library folder. In Windows this is usually located in Arduino IDE folder\libraries. Check Arduino's official guide if you want more information on how to install the Arduino Library The official guide of Arduino
3.Start Arduino IDE, you can find ready to run Examples in the menu. File--> Examples-> DmTftLibraries. select the right board and COM port: DM-TFT35-107
4.Open the Example and upload to your Arduino board.
Display Sample Code
Basic function could be found from the library file <libraries\DmTftLibrary\DmTftBase.h>
#include <SPI.h>
#include <DmTftSsd2119.h>
DmTftSsd2119 tft = DmTftSsd2119(10, 9);// Define the function body
void setup ()
{
tft.init();//Initialization screen
}
void loop()
{
tft.drawString(5, 10," Romantic cabin");//Displays a string
int x=160,y=50;
tft.drawLine (x, y, x-80, y+30, YELLOW );//Draw line
delay(1000);
tft.drawLine (x, y, x+80, y+30, YELLOW );
delay(1000);
tft.drawLine (x-60, y+25, x-60, y+160, BLUE );
delay(1000);
tft.drawLine (x+60, y+25, x+60, y+160, BLUE );
delay(1000);
tft.drawLine (x-60, y+160, x+60, y+160,0x07e0 );
delay(1000);
tft.drawRectangle(x-40, y+50,x-20, y+70, 0x8418); //Draw rectangle
delay(1000);
tft.drawRectangle(x+40, y+50,x+20, y+70, 0x07ff);
delay(1000);
tft.fillRectangle(x-20, y+100, x+20, y+160, BRIGHT_RED);//Draw fill rectangle
delay(1000);
tft.drawLine (x, y+100, x, y+160, WHITE );
delay(1000);
tft.fillCircle(x+120, y-20, 20, RED );//Draw fill Circle
delay(1000);
}
Touch screen Smaple code
#include <SPI.h>
#include <DmTftSsd2119.h>
#include <DmTouch.h>
#include <utility/DmTouchCalibration.h>
DmTftSsd2119 tft = DmTftSsd2119();
DmTouch dmTouch = DmTouch(DmTouch::DM_TFT35_107);
DmTouchCalibration calibration = DmTouchCalibration(&tft, &dmTouch);
bool calibrated = false;
void setup() {
dmTouch.setCalibrationMatrix(calibration.getDefaultCalibrationData((int)DmTouch::DM_TFT35_107));
tft.init();
dmTouch.init();
}
void loop()
{
uint16_t x, y ;
bool touched = true;
if (dmTouch.isTouched()) {
dmTouch.readTouchData(x,y,touched);//x, y coordinates read contacts
calibration.drawCalibPoint(x, y);//In a display of contact
}
}
Display a pictures from a SD card
It requires a special format for the displaying picture: 16bit RGBRGB bmp You could download the convert tool here:ImageConverter
Anyway, there is converted picture in the library folder (DmTftLibrary\examples\DM-TFT35-107). You could have a try with it first.
1.Copy the converted picture to the SD. 2.Plug SD card in the touch screen. 3.Download the following program
#include <SPI.h>
#include <SPIFlash.h>
#include <SD.h>
#include <DmTftSsd2119.h>
#include <DmDrawBmpFromSdCard.h>
#define TFT_CS 10
#define SD_CS 8
#define F_CS 6
#define T_CS 4
DmTftSsd2119 tft = DmTftSsd2119(10, 9);
DmDrawBmpFromSdCard drawImage = DmDrawBmpFromSdCard();
void setup()
{
pinMode(TFT_CS, OUTPUT); // Set CS SPI pin HIGH for all SPI units, so they don't interfere
digitalWrite(TFT_CS, HIGH);
pinMode(T_CS, OUTPUT);
digitalWrite(T_CS, HIGH);
pinMode(SD_CS, OUTPUT);
digitalWrite(SD_CS, HIGH);
pinMode(F_CS, OUTPUT);
digitalWrite(F_CS, HIGH);
Serial.begin(9600);
tft.init();
SD.begin(SD_CS);
}
void loop() {
drawImage.drawImage("logol565.bmp", tft, 0, 0);//Display picture
delay(6000);
drawImage.drawImage("logo1888.bmp", tft, 0, 0);
delay(6000);
}