Arduino 1.77" SPI TFT Blank White Screen Only

Hello all,

I have a Freetronics Eleven (100% Arduino Uno compatible) connected to an Arduino 1.77" SPI TFT LCD Display. I'm using the TFT Display Text tutorial at http://arduino.cc/en/Tutorial/TFTDisplayText. When I upload the sketch the display white backlight activates but nothing else happens. Could it be a compatibility problem with the Uno-copy board?
How do I get it to display anything?

Also, I don't have a micro SD fitted: is that necessary?

Any help would be appreciated.

Hello Thorium234,

The example doesn't require SD card and it is written for hardware SPI use which means MOSI (pin 11) and SCLK (pin 13) by default. Could you post your code and how are you connecting the 11/LCD? Regards.

p

Here is my code that I had literally copied and pasted into Arduino IDE from the tutorial to be sure I hadn't made a typo.

#include <TFT.h>  // Arduino LCD library
#include <SPI.h>

// pin definition for the Uno
#define cs   10
#define dc   9
#define rst  8  

// pin definition for the Leonardo
// #define cs   7
// #define dc   0
// #define rst  1 

// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);

// char array to print to the screen
char sensorPrintout[4];

void setup() {
  
  // Put this line at the beginning of every sketch that uses the GLCD:
  TFTscreen.begin();

  // clear the screen with a black background
  TFTscreen.background(0, 0, 0);
  
  // write the static text to the screen
  // set the font color to white
  TFTscreen.stroke(255,255,255);
  // set the font size
  TFTscreen.setTextSize(2);
  // write the text to the top left corner of the screen
  TFTscreen.text("Sensor Value :\n ",0,0);
  // ste the font size very large for the loop
  TFTscreen.setTextSize(5);
}

void loop() {

  // Read the value of the sensor on A0
  String sensorVal = String(analogRead(A0));
 
  // convert the reading to a char array
  sensorVal.toCharArray(sensorPrintout, 4);

  // set the font color
  TFTscreen.stroke(255,255,255);
  // print the sensor value
  TFTscreen.text(sensorPrintout, 0, 20);
  // wait for a moment
  delay(250);
  // erase the text you just wrote
  TFTscreen.stroke(0,0,0);
  TFTscreen.text(sensorPrintout, 0, 20);
}

I'm connecting exactly (I've double and triple checked) as per this image on the tutorial.

Might SPI work a bit differently with the eleven even though it's supposed to be Uno compatible? I don't know a lot about SPI.

Thorium234

Could you run the following code to see if the white background is real or not? I mean, if the TFTscreen.background is working.

#include <TFT.h>  // Arduino LCD library
#include <SPI.h>
#define cs   10
#define dc   9
#define rst  8  
TFT TFTscreen = TFT(cs, dc, rst);

void setup() {
  TFTscreen.begin();  
}

void loop() {
TFTscreen.background(255,0,0); // red
delay(1000);
TFTscreen.background(0,255,0); // green
delay(1000);
TFTscreen.background(0,0,255); // blue
delay(1000);
}

p

Alright. I've uploaded your code but the screen is still white i.e. there is no change in what is being displayed.

The hardwired LED to pin D13 does flash every second so the board is sending something to SCLK pin though.

It's almost like the display won't accept commands; as soon as I power up the eleven board the display just lights up the backlight and stays like that.

Thorium234

What IDE version you are using? Could you try with the Arduino IDE 1.5.6-r2?

p

I'm using version 1.0.5-r2.

I can only find my current version and the 1.5.7-r2 Beta on the Arduino download page. Where do download 1.5.6-r2?

Thorium234

Here http://arduino.cc/en/Main/OldSoftwareReleases

p

Okay, I've uninstalled my old version and started installing 1.5.6-r2 but this error came up some way through the installation process:

Error opening file for writing:

C:\Program Files (x86)\Arduino\java\bin\awt.dll

Click Abort to stop the installation,
Retry to try again, or
Ignore to skip this file.

I tried Retry but the same error happened. Any ideas?

Update: I ignored the error (and 4 or 5 subsequent and similar errors) and it installed. I tried uploading the code you've posted and it successfully compiled and uploaded but nothing different is happening with the display.

Update 2: Investigating the error I just worked out it is related to something else (that I've now dealt with) on my computer. I've re-installed 1.5.6r-2 with no errors now. However, again there is no luck with the display.

Sorry about the whole error thing.

Hello Thorium234,
Are you powering the Arduino only through the USB connector? If so, can you try using an external power supply?
It's known that some LCDs (like some modems) have high power consumption to work accordingly. Regards,

p

Palliser, so far I've only been using the USB port from my computer.

Okay, now I've plugged a 7.2V RC car battery (fully charged and hence supplying a higher value of 8.5V) into the eleven's DC jack. The display still doesn't do anything. I measured the potential difference across the +5V pin and GND pin on the display whilst powered up and it shows 4.9V from both USB and DC jack power. I suspect this is due to the eleven's on-board regulator cutting down the battery's input to the required 5V.

Perhaps the display needs its own power supply? But I fear the 8.5V from the battery would be too much going straight into the display.

Thorium234

Let's try one more thing: Could you wire your eleven with the LCD according to the arduino UNO wiring as shown in the following link?

p

It's rewired as indicated in the link and I just tried running it with both USB and then battery. I uploaded the sketch you offered above to test the tftScreen.background function but nothing happened. The screen comes on white as soon as the eleven has power. In fact, if I remove all leads but for +5V and GND to the display it still comes on white and does nothing.

Let's now test the SPI port of your eleven.
With your eleven alone, make a jumper between pins 11 (MOSI) and 12 (MISO).
The following code will send and receive a string via the SPI port.
If the test is successful, you should see the string "SPI TEST OK" in the serial monitor of the Arduino IDE.

//Loop Back test for the SPI port of the Arduino
#include <SPI.h>
char outByte [20] = "SPI TEST OK"; 
char inByte; 
int i = 0;                                                         
 
void setup() 
{
  Serial.begin(9600);  
  SPI.begin();  
  delay(100);  
}
 
void loop() 
{    
  for(i = 0; outByte [i] != '\0'; i ++)  
  {
    inByte = SPI.transfer(outByte [i]);
    Serial.write(inByte);   
  }
  Serial.println();
  delay(1000);
}

p

Okay, I've done exactly as described and I get "SPI TEST OK" printed on the Serial Monitor every second.

So this means the SPI ports and SPI library are both working with my eleven?

Thorium234

Yes. I wanted to discard a possible issue with your eleven or the SPI library. Thus, the problem could be with the TFT library or the LCD shield. Regarding both the 1.0.5 only works with the red tab that your LCD had (The plastic cover on the screen) and the 1.5.6 works with the green tab. DO you remember what tab your screen had? I'm about to sleep now but let's keep in touch. Night.

p

My display has a green tab facing downwards. Hear from you later.

Thorium234

Hello Thorium234,
Green tag. Thank for the info. This meas that you have the new version of the LCD and that runs by default with the 1.5.X.

Given that the Arduino LCD TFT library is based on the Adafruit one, please, try the following test code (equivalent to my previous one) that I have prepared using the Adafruit library and let's see how it goes.
Notes:
-Use the Arduin IDE 1.5.6-r2.
-Use the last wiring I told you from: http://arduino.cc/en/Guide/TFTtoBoards#.UyWQNNyP4p0

Here the Adafruit test code:

#include <TFT.h>
#include <SPI.h>

#define sclk 13
#define mosi 11
#define cs   10
#define dc   9
#define rst  8

Adafruit_ST7735 tft = Adafruit_ST7735(cs, dc, mosi, sclk, rst);

void setup(void) {
 tft.initR(INITR_BLACKTAB);
}

void loop() {
  tft.fillScreen(ST7735_RED);
  delay(1000);
  tft.fillScreen(ST7735_GREEN);
  delay(1000);
  tft.fillScreen(ST7735_BLUE);
  delay(1000);
}

p

Palliser, I checked my wiring to that in the link and my IDE version (1.5.6-r2 as required) and then uploaded the new test code. However, the display continues to taunt me with a blank white screen.

Thorium234

Let's try replacing the following line of code:

tft.initR(INITR_BLACKTAB);

with

tft.initG();

and also with

tft.initR(INITR_GREENTAB);

p