3.5-inch ILI9488 Color Touchscreen
Module Source
Purchase Link: https://item.taobao.com/item.htm?spm=a1z09.2.0.0.38d22e8dm6PlFb&id=38842179442&_u=62t4uge57f1d
Baidu Netdisk Download Link: http://www.lcdwiki.com/zh/3.5inch_SPI_Module_ILI9488_SKU:MSP3520
Specifications
Operating Voltage:3.3V
Operating Current:20MA
Module Dimensions:56.34(H) x 98.00(W)
Pixel Resolution:320(H) x 480(V)RGB
Driver Chip:ILI9488
Communication Protocol:SPI
Pin Count:14 Pin (2.54mm pitch header)
Hardware Connection
- VCC: Connect to the 5V of the development board.
- GND: Connect to the GND of the development board.
- CS: Chip select, connect to digital pin 10 of the development board.
- RESET: Reset, connect to digital pin 9 of the development board.
- DC (or RS): Data/command control, connect to digital pin 8 of the development board.
- SDI/MOSI (or TFT_MOSI): Master Out Slave In, connect to digital pin 11 of the development board.
- SCK (or TFT_SCK): Clock, connect to digital pin 13 of the development board.
- LED: Backlight control, can be directly connected to A3 or 3.3V or 5V of the development board through a current-limiting resistor, or connected to a PWM output to control brightness.
- SDO/MISO (or TFT_MISO): Master In Slave Out, if you need to read data from the TFT, this line needs to be connected to digital pin 12 of the development board. This pin is not used in this example and has no function.
- T_CLK: Touchscreen clock, connect to digital pin 6 of the development board.
- T_CS: Touchscreen chip select, connect to digital pin 7 of the development board.
- T_DIN: Touchscreen data input, connect to digital pin 4 of the development board.
- T_DO: Touchscreen data output, connect to digital pin 5 of the development board.
- T_IRQ: Touchscreen interrupt, connect to digital pin 3 of the development board.
Usage Method
If you use the ATMEGA328P to control this screen, you need to use a level shifter module or modify a pair of solder pads on the screen. In our actual tests, we found that when we connected the display directly without using a level shifter module, it either did not work at all or only displayed half the screen with garbled output. This is because the screen's pins can only accept a high level of 3.3V, while the development board outputs a high level of 5V. Since we did not have a level shifter module, we used the method provided by the screen manufacturer: the shorting method. Since we did not have a level shifter module, we used the method provided by the screen manufacturer: the shorting method. This shorting method is simple to operate, involves short wiring, and does not require external devices. The downside is that the module generates a lot of heat during operation.
The shorting method involves shorting the J1 component position (as shown in the figure below) and soldering on the back of the module. After shorting, the module's VCC pin must be connected to a 5V power supply (not connected to a 3.3V power supply).
Installing Library Files
File download
📌 Download Center(Click the link)
📌 In the Download Center->Module Porting Manual Download [Not porting Code],you will find the compressed file for this chapter.
Unzip the above zip file and place it in the project folder.
Official example:https://github.com/imageguy/projects/tree/main/touchscreen/lcdwiki
Enter the code:
/******************************************************************************
* Test Hardware: LCSC ColorEasyDuino Development Board
* Version Number: V1.0
* Modified By: www.lckfb.com
* Modification Date: March 28, 2024
* Function Overview:
*****************************************************************************
* Open-source development board hardware and software information and related projects hardware and software information on official website
* Development board official website: www.lckfb.com
* Technical support resident forum, any technical problems are welcome at any time to exchange learning
* LCSC Forum: club.szlcsc.com
* Follow our Bilibili account: [立创开发板], stay toned to our latest news!
* We focus on cultivating Chinese engineers rather than profiting from board sales.
******************************************************************************/
#include "LCDWIKI_SPI.h" //Hardware-specific library
#include "LCDWIKI_TOUCH.h" //touch screen library
LCDWIKI_SPI mylcd = LCDWIKI_SPI(ILI9488_18,10,9,8,A3); //hardware spi, cs, cd, reset, led
LCDWIKI_TOUCH my_touch(7,6,5,4,3); //tcs,tclk,tdout,tdin,tirq
//define some colour values
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
void setup()
{
mylcd.Init_LCD(); //屏幕初始化
mylcd.Fill_Screen(BLACK); //全屏显示黑
//触摸初始化
my_touch.TP_Init(mylcd.Get_Rotation(),mylcd.Get_Display_Width(),mylcd.Get_Display_Height());
mylcd.Set_Text_Mode(0);
//display 1 times string
mylcd.Fill_Screen(0x0000);
mylcd.Set_Text_colour(RED);
mylcd.Set_Text_Back_colour(BLACK);
mylcd.Set_Text_Size(1);
mylcd.Print_String("Hello World!", 0, 0);
mylcd.Print_Number_Float(01234.56789, 2, 0, 8, '.', 0, ' ');
mylcd.Print_Number_Int(0xDEADBEF, 0, 16, 0, ' ',16);
}
void loop(void)
{
my_touch.TP_Scan(0);
if (my_touch.TP_Get_State()&TP_PRES_DOWN)
{
mylcd.Print_String("x = ", 0, 64);
mylcd.Print_Number_Float(double(my_touch.x), 4, 64, 64, '.', 0, ' ');
mylcd.Print_String("y = ", 0, 84);
mylcd.Print_Number_Float(double(my_touch.y), 4, 64, 84, '.', 0, ' ');
}
delay(5);
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62