Skip to content

Program to load a BMP image from an SD Card and display it on 3.5" TFT LCD Touchscreen Displays (using ILI9486 Driver) with Arduino UNO R3/R4 and MCUFRIEND Library

License

Notifications You must be signed in to change notification settings

Aditya-A-garwal/Arduino-TFT-LCD-3-5-SDCard-BMP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Load BMP Image from SD Card And Display It On a 3.5" TFT LCD Touchscreen With Arduino UNO R3/R4

GitHub License GitHub forks GitHub Repo stars GitHub issues GitHub closed issues GitHub pull requests GitHub closed pull requests GitHub Actions Workflow Status

Overview

This repository contains a program to load a BMP Image from an SD Card and display it on a 3.5" touch screen display shield with an Arduino UNO R3/R4, as shown below -

Image of LCD Touch Shield from Top Image of LCD Touch Shield from Bottom

Most 3.5" LCD Touch displays use the ILI9486 Display Driver and include a resistive touchscreen. The PCB Layout & silkscreen text may vary slightly between displays. This does not change their behaviour and functionality. This repository depends on the following libraries -

The program has been written using PlatformIO, and has been tested on the Arduino UNO R3, Arduino UNO R4 Minima & Arduino UNO R4 WiFi.

The loadBMP, read16 and read32 functions in src/main.cpp have been taken from this example in the MCUFRIEND repository, for fair use and educational purposes. All code taken from other repositories belongs to their respective authors and are protected by their respective licenses.

Tip

A detailed tutorial on how to use this repository is available at https://dumblebots.com/2024/07/07/using-3-5-tft-lcd-display-with-ili9486-arduino-part-4-images-bitmaps-sd-card/. The tutorial includes a comprehensive explanation of the code and how to use it.

Building/Uploading With PlatformIO

Since this project has been written using PlatformIO by default, simply run the following commands to fetch the libraries, build the project and upload the program -

pio pkg install
pio run
pio run --target upload

Building/Uploading With Arduino IDE

Create a new sketch and copy the contents of src/main.cpp from this repository into the default .ino file. Create a new tab/file in the IDE named constants.h and copy the contents of src/constants.h from this repository into this file.

Install the Adafruit Touch Screen Library and Adafruit GFX Library from the Library Manager (under Sketch>Include Library>Manage Libraries...)

Download this repository as a ZIP file and install it by navigating to Sketch>Include Library>Add .ZIP Library, and selecting the downloaded file from the file explorer.

After this, you can Build and Upload the program as usual.

Using the Example

Format an SD Card with a FAT32 filesystem with a single drive. Load a BMP Image whose dimensions are under 320x480 into the SD Card and plug the SD Card into the slot situated on the back of the display. A BMP Image File is included in the repository in case one is not immediately available.

As soon as the program is uploaded, the display should turn red and the image should be slowly painted on the display, starting from the top-left corner.

Example bitmap image drawn on top-left corner of ILI9486 TFT LCD display

Troubleshooting

Some common problems and their solutions -

Problem Solution
Display stays white after uploading program Non-Standard Driver (not ILI9486)
Display not responding after touch Try changing the order of the touch pins in src/constants.h file, i.e. swap the values of XP, YP, XM and YM
Compilation issues related to SPI Update the Arduino IDE version and/or install the SPI library
Display Flickering/Arduino is reset automatically Faulty Power Supply/Cable

About

Program to load a BMP image from an SD Card and display it on 3.5" TFT LCD Touchscreen Displays (using ILI9486 Driver) with Arduino UNO R3/R4 and MCUFRIEND Library

Topics

Resources

License

Stars

Watchers

Forks