Go Down

Topic: is my SainSmart 5.0" TFT LCD broken? (Read 32 times) previous topic - next topic


Jun 02, 2015, 03:38 am Last Edit: Jun 02, 2015, 02:31 pm by snkhan
Hi guys I got myself a SainSmart 5.0" TFT LCD from ebay:

I hooked it up to my arduino uno and tried to upload the TFT bitmaplogo example from the arduino IDE, i got a fatal error saying the file ardafruit.gfx does not exit or cant be found. so i did some research on the web to find out the files should be placed in a folder in some specific way...did that and then the program compiled and uploaded fine.

BUT now after the program uploaded to my arduino and TFT screen hooked up just as the bitmaplogo sketch requires it. Im not seeing the arduino logo on the tft screen. only the back light is on and the lcd is making some high pitch frequency noise(hum) periodically. on the serial monitor it says sd card is found and the image is found and drawing image (pic attached) but nothing on the screen.
is my tft screen broken?
the code is provided below
thank you in advance

Code: [Select]


 Arduino TFT Bitmap Logo example

 This example reads an image file from a micro-SD card
 and draws it on the screen, at random locations.

 In this sketch, the Arduino logo is read from a micro-SD card.
 There is a .bmp file included with this sketch.
 - open the sketch folder (Ctrl-K or Cmd-K)
 - copy the "arduino.bmp" file to a micro-SD
 - put the SD into the SD slot of the Arduino TFT module.

 This example code is in the public domain.

 Created 19 April 2013 by Enrico Gueli



// include the necessary libraries
#include <SPI.h>
#include <SD.h>
#include <TFT.h>  // Arduino LCD library

// pin definition for the Uno
#define sd_cs  4
#define lcd_cs 10
#define dc     9
#define rst    8

// pin definition for the Leonardo
//#define sd_cs  8
//#define lcd_cs 7
//#define dc     0
//#define rst    1

TFT TFTscreen = TFT(lcd_cs, dc, rst);

// this variable represents the image to be drawn on screen
PImage logo;

void setup() {
  // initialize the GLCD and show a message
  // asking the user to open the serial line
  TFTscreen.background(255, 255, 255);

  TFTscreen.stroke(0, 0, 255);
  TFTscreen.println(F("Arduino TFT Bitmap Example"));
  TFTscreen.stroke(0, 0, 0);
  TFTscreen.println(F("Open serial monitor"));
  TFTscreen.println(F("to run the sketch"));

  // initialize the serial port: it will be used to
  // print some diagnostic info
  while (!Serial) {
    // wait for serial line to be ready

  // clear the GLCD screen before starting
  TFTscreen.background(255, 255, 255);

  // try to access the SD card. If that fails (e.g.
  // no card present), the setup process will stop.
  Serial.print(F("Initializing SD card..."));
  if (!SD.begin(sd_cs)) {

  // initialize and clear the GLCD screen
  TFTscreen.background(255, 255, 255);

  // now that the SD card can be access, try to load the
  // image file.
  logo = TFTscreen.loadImage("arduino.bmp");
  if (!logo.isValid()) {
    Serial.println(F("error while loading arduino.bmp"));

void loop() {
  // don't do anything if the image wasn't loaded correctly.
  if (logo.isValid() == false) {

  Serial.println(F("drawing image"));

  // get a random location where to draw the image.
  // To avoid the image to be draw outside the screen,
  // take into account the image size.
  int x = random(TFTscreen.width() - logo.width());
  int y = random(TFTscreen.height() - logo.height());

  // draw the image to the screen
  TFTscreen.image(logo, x, y);

  // wait a little bit before drawing again


i am no expert, and i am sure there are some people on here that can point you in the right direction...

What what i can gather it looks like you are using the standard TFT library, have you tried the UTFT library's by  Henning Karlsen, he has done a ton of work on this and it's a good starting point.

Personally i would use the Mega2560 + shield as this will give you the touch feature that is missing from the Uno shield and the whole package Mega+shield+display would only have only been $10 more.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131