1.44" TFT Graphic LCD screen. Why is it so hard to display images?

Hello everyone,

Fairly new user here. :slight_smile:

I have a 1.44" TFT Graphic LCD screen like this one: https://www.creatroninc.com/product/1-44-tft-graphic-lcd-128x128px/ I need this small screen to fit in a project I am working on. I also have a micro SD card breakout board like this :https://www.creatroninc.com/product/microsd-breakout/

I have been able to get the screen working to run a graphics test but my ultimate goal is to, from the push of a button on my Arduino Uno, display one image on the screen, in landscape format.

I want to store the image on a micro SD card so I purchased the breakout board but I am confused as to how to wire it to the screen and the Uno I am using for experimenting.

I am fairly new to Arduino but I have built quite a few projects. I have never used a screen before though and have been thoroughly confused by the libraries needed to load images onto the screen. It seems straight forward, there are tutorials available but they seem to be out of date with the libraries that have changed and I have yet to be able to succeed with anything other than basic graphics.

I just want one image to appear. I didn't imagine it would be so difficult. I am willing to keep trying but I could use a little help to make sure that I am wiring the SD card breakout correctly and with finding basic code that can work to display an image. Below is the first part of the code in an example I have been using to try to figure out the connections:

Any help would be greatly appreciated.

// Adafruit_ImageReader test for Adafruit ST7735 TFT Breakout for Arduino.
// Demonstrates loading images from SD card or flash memory to the screen,
// to RAM, and how to query image file dimensions.
// Requires three BMP files in root directory of SD card:
// rgbwheel.bmp, miniwoof.bmp and wales.bmp.
// As written, this uses the microcontroller's SPI interface for the screen
// (not 'bitbang') and must be wired to specific pins (e.g. for Arduino Uno,
// MOSI = pin 11, MISO = 12, SCK = 13). Other pins are configurable below.

#include <Adafruit_GFX.h>         // Core graphics library
#include <Adafruit_ST7735.h>      // Hardware-specific library
#include <SdFat.h>                // SD card & FAT filesystem library
#include <Adafruit_SPIFlash.h>    // SPI / QSPI flash library
#include <Adafruit_ImageReader.h> // Image-reading functions

// Comment out the next line to load from SPI/QSPI flash instead of SD card:
#define USE_SD_CARD

// TFT display and SD card share the hardware SPI interface, using
// 'select' pins for each to identify the active device on the bus.

#define SD_CS    4 // SD card select pin
#define TFT_CS  10 // TFT select pin
#define TFT_DC   8 // TFT display/command pin
#define TFT_RST  9 // Or set to -1 and connect to Arduino RESET pin

arduinokov:
I want to store the image on a micro SD card so I purchased the breakout board but I am confused as to how to wire it to the screen and the Uno I am using for experimenting.

Maybe this is your issue. You don't have to wire the screen and the SD together. You wire each of them to the Uno. Neither will even be aware that the other exists.

The first step is to connect and test the SD module installation by itself, using one of the simple examples.

You will need a level shifter to connect a 5V Arduino with a 3.3V SD card module.

Hello,

Thank you both for your replies. I have tested the connections for the SD breakout board and have run the "CardInfo" example from the SD library. I received the following in my Serial Monitor window (everything looks correct):

Initializing SD card...Wiring is correct and a card is present.

Card type: SDHC
Clusters: 1888256
Blocks x Cluster: 16
Total Blocks: 30212096

Volume type is: FAT32
Volume size (Kb): 15106048
Volume size (Mb): 14752
Volume size (Gb): 14.41

Files found on the card (name, date and size in bytes):
SYSTEM~1/ 2020-08-26 11:13:24
WPSETT~1.DAT 2020-08-26 11:13:24 12
INDEXE~1 2020-08-26 11:13:24 76
LIGHTN~1.CFD 2020-08-26 11:15:56 112
WALES.BMP 2020-08-26 11:15:36 8420
RGBWHEEL.BMP 2020-08-26 11:15:38 49208
MINIWOOF.BMP 2020-08-26 11:15:40 57654
PARROT.BMP 2020-08-26 11:15:42 61496
LILY128.BMP 2020-08-26 11:15:34 49290

I am running everything from 3.3V, both the screen and the SD board are working properly independently of each other.

My question is how to connect the Arduino, the screen and the SD board?

Power and Ground are obvious but both the screen and the SD board specify that the SPI interface must be wired to specific pins, MOSI = pin 11, MISO = 12, SCK = 13.

You do indeed need them both to share the SPI pins. You will also need a separate chip select connection for each to control which one you want to talk to.

Pin 10 is the default Slave Select pin, and should be used for one of the devices (if not used, it must be an OUTPUT pin).

Use any other pin for the other Slave Select.

arduinokov:
I am running everything from 3.3V, both the screen and the SD board are working properly independently of each other.

How are you running the UNO itself at 3.3v?

You may run into problems with insufficient dynamic memory (ram) depending on how you have the display set up.

Thanks to everyone for their replies, they are very much appreciated. :slight_smile:

My final intention is to use a 5V Arduino Pro Mini in my project and use a level shifter for the SD card breakout.

So if I am understanding correctly, the SD Card Breakout board should be connected to:

3.3V
GND
MOSI - pin 11
MISO - pin 12
CLK - pin 13
CS - pin 4

And the LCD screen:

5V
GND
MOSI - pin 11
MISO - pin 12
CLK - pin 13
CS - pin 10
RST - 9

Those connections will not work with a 5V Arduino, without level shifters.

My final intention is to use a 5V Arduino Pro Mini

Bad idea. You can buy 3.3V Arduino Pro Minis for $2 on eBay.

I can use a 3.3V Pro Mini but just to check, is an Arduino Pro Mini even feasible for this project? Up until now, I have been using an UNO for experimentation.

The Pro Mini is an Uno without the extra junk. Both use the ATmega328 chip.

Thanks, sorry for all the Newbie questions. :confused: David mentioned in a comment above "You may run into problems with insufficient dynamic memory (ram) depending on how you have the display set up." Does that apply to the Pro Mini?

Cheers

Assuming I'm using a Pro Min 3.3V, can pins 11, 12, and 13 share the same connections? I know it's a basic question but I am still uncertain.

VCC 3.3V
GND
MOSI - pin 11
MISO - pin 12
CLK - pin 13
CS - pin 4

And the LCD screen:

VCC 3.3V
GND
MOSI - pin 11
MISO - pin 12
CLK - pin 13
CS - pin 10
RST - 9

Does that apply to the Pro Mini?

Since the Uno and the Pro Mini (and some other Arduinos) use the exact same processor, you may run into memory problems attempting to use a large graphics library and an SD card. Both are memory intensive.

can pins 11, 12, and 13 share the same connections?

SPI devices MUST share those connections.

I just want to display up to five bmp images from the SD card. It's a very basic project.

"basic" != "simple"

Thank you for your patience in answering my Newbie questions. :slight_smile:

There are two memory issues. Your SD card needs memory for buffering what it reads from the file. I think. It certainly buffers on output.

Many graphics libraries require that you set up your image in RAM and then the library sends it to your display.All of this eats memory.

If you felt like hacking libraries, you might be able to avoid some or all of this but it would be work. I'd just buy better hardware - a Teensy perhaps.