Arduino 4inch TFT LCD Foldable Touch Screen 480x320

Overview

This product is a 4-inch resistive touchscreen display with a high-performance and user-friendly design based on the Arduino standard interface. It can be folded and parked at any angle up to 180 degrees, making it an ideal choice for Arduino developers and electronics enthusiasts. Combining resistive touchscreen technology with a high-resolution 4-inch colors display, it offers an intuitive user interface and rich display capabilities. We provide example codes for both the Arduino UNO and NUCLEO-F103RB versions.

Features

  • 4-inch screen size, compact and portable, capable of folding at any angle up to 180°;
  • The display boasts a high resolution of 480 x 320, presenting clear, sharp images and text;
  • Utilizes resistive touch screen technology, enabling touch interaction, allowing users to input and control operations directly on the screen;
  • Supports the Arduino standard interface and is compatible with the NUCLEO series of development boards;
  • Provides open-source example programs suitable for the Arduino UNO and NUCLEO-F103RB development boards.

Specifications

Driver ChipLCD control chip ST7796S, touch panel control chip XPT2046
TypeTFT
Communication InterfaceSPI
Display ColorRGB ,65K colors
Resolution480 x 320 (Pixel)
I/O Voltage3.3V/5V
Product Dimensions96mm x 66mm

Interface Definition

LabelArduino UNONUCLEODescription
5V5V5V5V Power Input
GNDGNDGNDPower Ground
CLKD13PA5SPI Clock
MISOD12PA6SPI Master Input, Slave Output
MOSID11PA7SPI Master Output, Slave Input
LCD_CSD10PB6LCD Chip Select
LCD_BLD9PC7LCD Backlight
LCD_DCD8PA9LCD Data/Command Selection
LCD_RSTD7PA8LCD Reset
SD_CSD6PB10Micro SD Card Chip Select
TP_CSD5PB4Touch Panel Chip Select
TP_IRQD4PB5Touch Panel Interrupt
TP_BUSYD3PB3Touch Screen Busy Signal

Resource Profile

Module Resource Profile is shown in the figure below:

SG-L4INCH-A Resource Profile
  • 1&2 Digital Pin Headers
  • 3 Reset Button
  • 4 ICSP Interface Selection DIP Switch
  • 5 ICSP Female Header
  • 6 SD Card Slot
  • 7 Analog Pin Headers
  • 8 Power Pin Headers

Example Program Usage

Arduino UNO

Hardware Interface Configuration Description

Module to Arduino UNO Pin Connection Definition Table:

LabelArduino UNODescription
5V5V5V Power Input
GNDGNDPower Ground
CLKD13SPI Clock
MISOD12SPI Master Input, Slave Output
MOSID11SPI Master Output, Slave Input
LCD_CSD10LCD Chip Select
LCD_BLD9LCD Backlight
LCD_DCD8LCD Data/Command Selection
LCD_RSTD7LCD Reset
SD_CSD6Micro SD Card Chip Select
TP_CSD5Touch Panel Chip Select
TP_IRQD4Touch Panel Interrupt
TP_BUSYD3Touch Screen Busy Signal
If you are using an Arduino board that has an ICSP interface, all positions of the ICSP interface DIP switch (as shown in the item 4 of Resource profile) can be set to the OFF position. If your Arduino board does not have an ICSP interface, all positions of the ICSP interface DIP switch should be set to the ON position.

Since this example program was verified on the Arduino UNO R3 board, the SRAM capacity of this board is only 2KB. Thus, the example program is divided into two project files: image display and touch.

Image Display Example Program Usage

1、Properly insert the module into the Arduino UNO development board.

2、For the image display example program "4inch_lcd_show_bmp.ino", before running this program, you should first copy the image files from the PIC folder to the SD card, which should be formatted as FAT. Then insert it into the SD card slot (see in item 6 of Resource profile).

Select the board model and port number, as shown in the figure below:

3、Next click "Compile", and if there are no compilation errors, click "Upload" to load the example onto the development board, as shown in the figure below:

4、After uploading the image display example program, the screen will sequentially display the images from the SD card.

5、If you want the screen to display other images, you can store the images in the SD card. The image format should be BMP, with a bit depth of 24, and a resolution of 480 (Width) x 320 (Height). Also, modify the content of the "char file_name[4][20]" array in line 11 of the sd_pic.cpp file, i.e., change its content to the names of the images you want to display.

Touch Screen Example Program Usage:

The touch screen example program "4inch_lcd_touch.ino", when uploaded to the Arduino UNO, will first display lines, rectangles, block fill, circles, and characters, and then enter the touch function display interface, as shown in picture below.

The "CALIB" button is for screen calibration functionality. Screen calibration parameters have already been filled in the TP_Init() function. Users can also update the values of tp_dev.xfac and tp_dev.yfac based on their own calibration results. After successful calibration, the message "Touch Screen Calibration OK!" will appear on the screen. If calibration fails, calibration will restart. If the user does not perform a calibration action within 10 seconds, the calibration process will automatically exit.

The "CLEAR" button is to clear the screen drawing board content, which can clear all the content drawn by the user on the screen drawing board. The red, green, blue, black, and yellow block buttons are for pen colors. The default pen color is black. If users want to switch colors, they can first press the corresponding color block button and then draw.

UNCLEO-F103RB

Hardware Interface Configuration Description

The module can be directly interfaced with the UNCLEO-F103RB motherboard. The wiring definitions are as shown in the table below:

LabelUNCLEO-F103RBDescription
5V5V5V Power Input
GNDGNDPower Ground
CLKPA5SPI Clock
MISOPA6SPI Master Input, Slave Output
MOSIPA7SPI Master Output, Slave Input
LCD_CSPB6LCD Chip Select
LCD_BLPC7LCD Backlight
LCD_DCPA9LCD Data/Command Selection
LCD_RSTPA8LCD Reset
SD_CSPB10Micro SD Card Chip Select
TP_CSPB4Touch Panel Chip Select
TP_IRQPB5Touch Panel Interrupt
TP_BUSYPB3Touch Screen Busy Signal
As the UNCLEO-F103RB motherboard does not have an ICSP interface, all positions of the ICSP interface selection switch (as seen in item 4 of Resource profile) need to be toggled to the ON state.

Example Program Usage Method

This example program is developed based on the HAL library. Open the project file located at STM32\4inch_lcd\MDK-ARM\4inch_lcd.uvprojx. First, click the "Build" button and wait for the compilation to complete. Then click the "Download" button, as shown in picture below. After the program is downloaded, the screen first displays some GUI function graphics, such as drawing lines, rectangles, circles, displaying characters, etc., then enters image display, and finally enters the touch function loop.

The example program has the same driver and program framework as the Arduino UNO platform. Because the STM32F103RB has sufficient SRAM and Flash capacity, all functionalities are integrated into a single project. At the same time, the SD card and its stored image format must be consistent with the Arduino UNO platform.

Resources

Schematic Diagram

Demo code

Data Manual

Product

Technical Support

Technical Support and Product Notes