In this example, we'll show how to display a 128x160 pixel full color bitmap from a microSD card.

We have an example sketch in the library showing how to display full color bitmap images stored on an SD card. You'll need a microSD card such as this one.

It's really easy to draw bitmaps. We have a library for it, Adafruit_ImageReader, which can be installed through the Arduino Library Manager (Sketch→Include Library→Manage Libraries…). Enter “imageread” in the search field and the library is easy to spot:

You'll also need an image. We suggest starting with this bitmap of a parrot.

If you want to later use your own image, use an image editing tool and crop your image to no larger than 160 pixels high and 128 pixels wide. Save it as a 24-bit color BMP file - it must be 24-bit color format to work, even if it was originally a 16-bit color image - because of the way BMPs are stored and displayed!

Copy the parrot.bmp to the microSD card and insert it into the micro SD card holder on your shield or breakout board.

Breakout Wiring

Shield users can skip directly to the "Example Sketch" section.

Wire up the TFT as described on the wiring & test page and add the two wires for talking to the SD card. Connect CARD_CS (the unconnected pin in the middle) to digital pin 4 (you can change this later to any pin you want). Connect MISO (second from the right) to the Arduino's hardware SPI MISO pin. For Classic arduinos, this is pin 12. For Mega's this is pin 50. You can't change the MISO pin, it's fixed in the chip hardware.

Example Sketch

If you have the breakout, open the File→examples→Adafruit ImageReader Library→BreakoutST7735 - 160x128 example.

If you have the shield, open the File→examples→Adafruit ImageReader Library→ShieldST7735 example.

Now upload the example sketch to the Arduino. It should display the parrot image. If you have any problems, check the serial console for any messages such as not being able to initialize the microSD card or not finding the image.

This guide was first published on Aug 29, 2012. It was last updated on Mar 14, 2024.

This page (Displaying Bitmaps) was last updated on Mar 08, 2024.

Text editor powered by tinymce.