Draw Bitmap Images on ST7735 TFT with Arduino and SD Card

Drawing bitmap images (.BMP format) on ST7735 TFT display is quite easy because they are uncompressed images unlike JPEG images (.JPG format).
This post shows how to draw bitmap images on the ST7735 TFT using Arduino UNO board where the Arduino loads the BMP images from SD card and print them on the display.

The ST7735 TFT is a color display that uses SPI protocol, it has a resolution of 128×160 pixel. This display works with 3.3V only.
To see how to interface Arduino with ST7735 TFT display, visit the following post:
Arduino ST7735 1.8″ TFT display example

Hardware Required:

  • Arduino UNO, or similar board   —> Board details
  • ST7735S TFT display module
  • microSD card with FAT16 or FAT32 file system
  • microSD card module adapter
  • Push button
  • 5 x 1k ohm resistor
  • Breadboard
  • Jumper wires
Arduino with SD card and ST7735 TFT display
Arduino with SD card and ST7735 TFT display

Arduino with ST7735 TFT and SD card circuit:
The following image shows project circuit diagram.

The ST7735S shown in project circuit diagram has 8 pins: (from right to left): RST (reset), CS (chip select), DC (or D/C: data/command), DIN (data in), CLK (clock), VCC, BL (back light) and Gnd (ground).

The ST7735S display module is supplied with 5V. GND pin is connected to Arduino GND pin, VCC and BL pins are connected to Arduino 5V pin.
In the display module there is AMS1117-3V3 voltage regulator which supplies the display controller with 3.3V (because it works with 3.3V only). The regulator steps down the 5V that comes from the Arduino board into 3.3V.

Arduino SD card ST7735 TFT display circuit
Arduino uno with ST7735 TFT display and microSD card adapter

All Arduino UNO output pins are 5V, connecting a 5V pin directly to the ST7735 display board may damage its controller circuit. To avoid that, I connected each control line of the display to the Arduino board through 1k ohm resistor.

So, the ST7735TFT display is connected to the Arduino board as follows (each one through 1k ohm resistor):
RST pin is connected to Arduino digital pin 5,
CS pin is connected to Arduino digital pin 6,
DC pin is connected to Arduino digital pin 7,
DIN pin is connected to Arduino digital pin 11,
CLK pin is connected to Arduino digital pin 13.

In this project I used microSD card module, this module is supplied from circuit 5V source that comes from the Arduino UNO board. This module contains AMS1117-3V3 voltage regulator which is used to supply the micro SD card with 3.3V. Also this module contains an IC which is 74LVC125A and it’s used as level translator (from 5V to 3.3V).

The microSD card module is connected to the Arduino as follows (from left to right):
The first pin of the micro SD card module (GND) is connected to Arduino GND,
The second pin of the micro SD card module (VCC) is connected to Arduino 5V,
The third pin of the micro SD card module (MISO) is connected to Arduino digital pin 12,
The fourth pin of the micro SD card module (MOSI) is connected to Arduino digital pin 11,
The fifth pin of the micro SD card module (SCK) is connected to Arduino digital pin 13,
The last pin of the micro SD card module (CS) is connected to Arduino digital pin 10.

The digital pins 10, 11, 12 and 13 are hardware SPI module pins of ATmega328P microcontroller (Arduino UNO microcontroller). The SD card and the ST7735 TFT share the same SPI bus.

The button which is connected to Arduino digital pin 2 is used as ‘next image’, when pressed the display will show the next image.

Arduino with ST7735 TFT and SD card code:
As an addition to Arduino SPI library and SD library which are both built-in libraries (comes with Arduino IDE), the following code requires two libraries from Adafruit Industries:
The first library is a driver for the ST7735 TFT display which can be installed from Arduino IDE library manager (Sketch —> Include Library —> Manage Libraries …, in the search box write “st7735” and install the one from Adafruit).

The second library is Adafruit graphics library which can be installed also from Arduino IDE library manager.

Both libraries can be installed manually, first download them from the following 2 links:
Adafruit ST7735 TFT library    —->  direct link
Adafruit graphics library        —->  direct link

After the download, go to Arduino IDE —> Sketch —> Include Library —> Add .ZIP Library … and browse for the .zip file (previously downloaded).
The same thing for the other library file.

Hints:
There is no need to specify image names, the Arduino will search and draw all the BMP images located in the main root of the SD card.

The 4 libraries are included in the main code as shown below.
Including Arduino SPI library is optional!

The ST7735 TFT module pins (RST, CS and DC) connections are defined as shown below:

The other display pins (DIN and CLK) are connected to Arduino hardware SPI pins (digital pin 11 and digital pin 13).

The Adafruit ST7735 library is initialized with this line:

And the TFT display is initialized using the following command:

Rest of code is described through comments.

Full Arduino code:

Arduino with ST7735 TFT and SD Card Video:
This project was tested with original Samsung 32GB and 4GB micro SD cards.
The following video shows my breadboard test circuit of Arduino UNO board, ST7735 TFT display, and microSD card (with reader):

Arduino with ST7735 TFT and SD Card Proteus Simulation Video:
The video below Proteus simulation of this project.
Note that Proteus simulation circuit is not the same as real hardware circuit, project hardware circuit diagram is shown above.

Proteus simulation file download link is below, use version 8.6 or higher to open it:
download

SD Card image file download (images are included):
download

Bitmap images download link:
download
Images are downloaded from https://wallpaper.mob.org/


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

15 thoughts on “Draw Bitmap Images on ST7735 TFT with Arduino and SD Card”

  1. Thanks for posting this! Lifesaver! I used an st7789 and it worked just fine, just set the initializer to st7789 and also include the adafruit st7789.h. My colors did come out inverted so I had to also add a tft.invert(0) command. Thanks again!

  2. Hello, Thank you for your information. I have problem. I used winimage program but i have error. SD card failed. I dont know it. Do u have any idea?

  3. Everything works very well. But I would also like to display a graphic and simple text. If I first display the generated txt and graphically and then the images (.bmp) everything is still ok. But when I switch back to the graphic, it is displayed very pale and fuzzy. Only after a restart I can see the text and graphics again rich in contrast.

  4. How would you go about making this automated (with a delay) instead of using a button to rotate the images?

  5. Hello,
    I’m trying to do your project with an Arduino UNO, the same SD module but with a 0.96 “7-pin screen and I can’t get it to work.
    Any advice?? For example, how do I have to put the pins on the screen?
    Thank you

    Hola,
    Estoy tratando de hacer su proyecto con un Arduino UNO, el mismo módulo SD pero con una pantalla de 0.96” de 7 pines y no consigo que funcione.
    Algún consejo?? por ejemplo, cómo tengo que poner los pines de la pantalla?
    Gracias

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top