Example Code for Arduino-Display BMP from SD Card
This project demonstrates how to display 16-bit RGB BMP images from a micro-SD card using the 3.5 TFT Resistive Touch Shield.
Hardware Preparation
- 3.5 TFT Resistive Touch Shield (SKU:DFR0348) × 1
- Arduino Compatible Board × 1
Software Preparation
- Arduino IDE (Latest Version), Download Link: https://www.arduino.cc/en/software
- DmTftLibrary, Download Link: https://bitbucket.org/displaymodule/dmtftlibrary/get/master.zip
- DmImageConverter (for 16-bit BMP conversion), Download Link: https://bitbucket.org/displaymodule/dmtftlibrary/downloads/DmImageConverter.msi
- Arduino Library Installation Guide: https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries
Wiring Diagram
- The 3.5 TFT Resistive Touch Shield connects directly on top of an Arduino pin compatible device.
- Insert the micro-SD card into the shield’s SD card slot.
Other Preparation Work
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.
- Copy the converted picture to the SD.
- Plug SD card in the touch screen.
- Download the following program
Sample Code
#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);
}
Result
The shield will display the BMP images from the SD card in a loop (each image shown for 6 seconds).
Was this article helpful?
