Show Those Bitmaps Proudly!

Show Those Bitmaps Proudly! © GPL3+

Yes, you CAN load and display BMPs from that card reader on the back of your tiny TFT screen!

  • 580 views
  • 0 comments
  • 6 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
DSD TECH 1.8 Inch TFT LCD Display Module with SD
×1
5182558
Flash Memory Card, SD Card
This display requires a micro SD card (2G or less works)
×1
Mfr 25frf52 1k sml
Resistor 1k ohm
×1
Mfr 25fbf52 2k21 sml
Resistor 2.21k ohm
×3
Adafruit industries ada239 image 75px
Solderless Breadboard Full Size
×1
12002 04
Breadboard (generic)
I used a mini which snapped into place
×1

About this project

This started off as a Halloween costume prop; I wanted a TOS tricorder. The tricorder screen was almost a perfect match for a 1.8" TFT, so I bought one. It was not functional, so I returned it and got the DSD Tech model (with a yellow header with 11 pins and 4 connectors for the SD card.

https://www.amazon.ca/DSD-TECH-Display-Interface-Arduino/dp/B07WDJ3TV6/ref=sr_1_1?keywords=dsd+tech+1.8+tft&qid=1574109714&sr=8-1

I tried the Adafruit ST7735 driver, but could not get it to read the BMPs from the SD card reader. I switched to the Arduino TFT driver, but it was very slow and would stop working after loading several BMPs. Someone in the forum (David Prentice??) helped me by encouraging me to go back to the Adafruit driver.

After much research and plenty of mistakes, I got my tricorder simulator to work! I did not want others to go through the same hassles I did, so I wanted to post a very simple sketch that will:

1) initialize the display;

2) initialize the card reader;

3) load a BMP from the card reader; and

4) display the BMP on the screen.

In the Arduino TFT tutorial, I read that you needed to use hardware SPI to get both the screen and the card reader to work simultaneously. That is what I have done. However, I saw so many instances where people switched pins 9DC and 8RST that I decided to try that. Both seemed to work, so I ran a sketch using both configurations that cycled through about 24 BMPs. The average for the Arduino-recommended configuration (9DC and 8RST) was 25 milliseconds shorter that the average for the switched configuration (9RST and 8DC) that so many people were using. The diagram is below:

I hope everything is correct! (This is my first Fritzing!)

The DSD Tech 1.8 TFT screen with SD has slightly odd pin labels:

  • RS seems less common than DC;
  • CLK seems less common than SCK; and
  • SDA seems less common than MOSI.

The code is in the "Software" section. Nowhere could I find documentation on the line:

SdFat SD;

I cannot say what that does. I am a newbie leading newbies.

The BMP I used (which must be in the root directory of the SD card) is here:

I have a short video, but I do not know how to embed it here.

Code

Rose BMP DemoArduino
/*
Rose BMP Demo
by KodiakBart, Nov 2019
Designed for the DSD Tech 1.8" TFT screen and Adafruit drivers
To allow simultaneous screen and card reader functions,
use hardware SPI, not software SPI
(although pins 8 and 9 can be swapped)
The pin breakout DSD Tech 1.8" TFT screen is as follows:
 VCC........5V
 GND........GND
 GND........
 NC.........
 NC.........
 NC.........
 CLK........13 (or SCK)
 SDA........11 (or MOSI)
 RS.........9  (or DC)
 RST........8  (or RESET)
 CS.........10 (or SS)
Solder a four-pin header to the SD connections on 
the DSD Tech 1.8" TFT screen
 SD_MISO....12
 SD_SCK.....13 (connected to screen CLK above)
 SD_MOSI....11 (connected to screen MOSI above)
 SD_CS......4
The SD card will work if it is 2G or less and formatted as FAT (FAT16)
To fit on the screen, all image files on the card must be pre-sized 
to 160 by 128 pixels or less and must be 24-bit RGB BMPs
The BMP file names must be no longer than 8 characters, 
however, when using many BMP files, the file names will eat up memory,
so use two-letter names
*/
// Libraries used
#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
// Set SPI constants
#define SD_CS    4    // SD card select pin
#define TFT_CS  10    // TFT select pin
#define TFT_DC   9    // TFT display/command pin
#define TFT_RST  8    // Or set to -1 and connect to Arduino RESET pin
// Set SD speed constant in Mhz (maybe try 10 if 4 does not work)
#define MYSDMHZ 4   // For SD.begin() below
// This is required
SdFat SD;
// Create a card reader object
Adafruit_ImageReader myReader(SD);
// Create a screen object
Adafruit_ST7735 myTft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
// Create an image object for loading into RAM
Adafruit_Image myImage;
void setup(void) {
 // Init a variable to hold the status from image-reading functions
 ImageReturnCode myStat; 
 // Initialize the TFT screen
 myTft.initR(INITR_BLACKTAB);
 // Rotation can be portrait (0 or 2) or landscape
 // Set TFT rotation to landscape (could be 3, but upside down)
 myTft.setRotation(1);
 // Clear screen to green to indicate that the screen works
 myTft.fillScreen(0x1F42);
 // Pause for dramatic effect
 delay (1000);
 // Initialize the card reader
 // Note: Some breakouts may require 10 MHz
 if(!SD.begin(SD_CS, SD_SCK_MHZ(MYSDMHZ))) {
   for(;;); // Fatal error, do not continue
 }
 // Draw the picture called "ro.bmp" (with "/" root directory indicator
 // found on the root directory of the cared reader)
 // at location 0,0 (top left corner of the screen)
 myStat = myReader.drawBMP("/ro.bmp", myTft, 0, 0); 
 // Pause again
 delay (3000);
 // Clear the screen to black
 myTft.fillScreen(0x0000);
}
void loop() {
}

Schematics

Rose BMP Demo
My first try at Fritzing! I hope it is accurate.
Dsd tech 1 8 tft wsd bb bxh8cpvrxo

Comments

Similar projects you might like

Morse Code Communication Using Laser Module (Both)

Project tutorial by SURYATEJA

  • 2,201 views
  • 1 comment
  • 12 respects

Play Dinosaur Game Using Arduino and Python3

Project tutorial by Jalal_Mansoori

  • 1,329 views
  • 1 comment
  • 7 respects

Serial Pong

Project showcase by Cody Brooks

  • 3,515 views
  • 2 comments
  • 12 respects

Arduino Burglar

Project showcase by paolo_cravero

  • 4,064 views
  • 2 comments
  • 8 respects

UFO Attack!

Project tutorial by MrNonesuch

  • 1,883 views
  • 6 comments
  • 10 respects

Arduino-ESP WiFi Integration

Project in progress by Turai Botond

  • 10,475 views
  • 11 comments
  • 55 respects
Add projectSign up / Login