My problem is that no matter what I do. I am always getting lines across the screen. Even after uploading.
I have wired up and uploaded all of the TFT libraries. I have used three Arduino UNO's and completely new set of wires just to be sure.
Each program compiles, as it should because its a library. In 3 of the projects the Arduino reads the pots for a couple of the examples and displays the changing values on the serial monitor and nothing happens on the TFT.
I have gotten the Bitmap sketch to work on the serial monitor. reads image and prints. but nothing on the screen.
I have tried both hardware SPI pins and also have defined my own.
Have been searching for solutions to my problem and have found a few possible fixes, and alas, still no fix.
these included.
An update of the IDE to 1.5.4.
An updated library.(Added correctly)
Included and tried the Arduino nightly library's
I am starting to believe it may be faulty. If anyone would care to input that would be really appreciated. and thanks for taking the time to help. I will provide any requests of further information.
Thanks.
Here is what I am talking about. See attached photo.
+5V: +5V
MISO: 50 on Mega 2560 (Miso on ADK)
SCK: 52 on Mega 2560 (Sck on ADK)
MOSI: 51 on Mega 2560 (Mosi on ADK)
LCD CS: pin 10
SD CS: pin 4
D/C: pin 9
RESET: pin 8
BL: +5V
GND: GND
Thanks for the reply. I have it wired exacttly as you described. see pic.
I Am using Arduino uno
This is the color code sketch from one of the examples.
/*
TFT Color Picker
This example for the Arduino screen reads the input of
potentiometers or analog sensors attached to A0, A1,
and A2 and uses the values to change the screen's color.
This example code is in the public domain.
Created 15 April 2013 by Scott Fitzgerald
http://arduino.cc/en/Tutorial/TFTColorPicker
*/
// 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
#include <TFT.h> // Arduino LCD library
#include <SPI.h>
TFT TFTscreen = TFT(cs, dc, rst);
void setup() {
// begin serial communication
Serial.begin(9600);
// initialize the display
TFTscreen.begin();
// set the background to white
TFTscreen.background(255, 255, 255);
}
void loop() {
// read the values from your sensors and scale them to 0-255
int redVal = map(analogRead(A0), 0, 1023, 0, 255);
int greenVal = map(analogRead(A1), 0, 1023, 0, 255);
int blueVal = map(analogRead(A2), 0, 1023, 0, 255);
// draw the background based on the mapped values
TFTscreen.background(redVal, greenVal, blueVal);
// send the values to the serial monitor
Serial.print("background(");
Serial.print(redVal);
Serial.print(" , ");
Serial.print(greenVal);
Serial.print(" , ");
Serial.print(blueVal);
Serial.println(")");
// wait for a moment
delay(33);
}
I have the same problem on my arduino uno + tftscreen 1.77.
I try with two uno, two screen, same result.
I have check wiring a lot of time, i do the same thing that on example. It doesn't work (i have black stripes on the screen and no display.
But i note if i swith DC and CS (in the software or on the arduino), the display become normally and i can see the last screen off the last program had running. This display is frozen (with example displaytext, i can see the value on the screen, but i can't change it.
But if i wired correctly (in reswitching dc and cs), i lost the display but the program is running(i see that with the serial monitor)
My advice would be remove everything else until you get the TFT working. Just wire up the UNO to the TFT and I think it'll probably work. Then you can work out what interaction with the other board is causing the problem.
arduinodlb:
I notice you have another board there.
I think the 'Other Board' might just be a printout of the instructions
Right you are Sir. I was looking at the first photo.
The second photo wiring looks good. I would grab a multimeter and check the continuity of every wire from the bottom of the arduino to the contact pad on the TFT. If they all look good, I'd double check by putting pressure on the wires while running the sketch to see if it affects the display at all. If all of this produces no changes, and you've double checked your software, then perhaps you do indeed have a faulty display.
Re: Arduino 1.77" SPI LCD Module with SD Just will not work?faulty?
« Reply #8 on: Today at 01:00:13 am »
Quote from: A.R.Ty on December 02, 2013, 11:12:05 pm
How do you power the TFT ?
Huh? The photos clearly show 5V and ground going to the relevant pins of the display.
i meant: did you power the tft with the ARDUINO or with i.e. an external power supply ?
If you power it directly with the ARDUINO check the datasheet for the power consumption - maybe teh tft sucks to much power from the ARDUINO.
So, try to power from external...
i try to power the tft with external supply, same result
I check the continuity of every wire from the bottom of the arduino to the contact pad on the TFT, all looks good.
I have already test it on two arduino uno
I can read and write on the sd card, all the examples program works correctly for the sd card.
But not for the screen. I try everything, i do not have more idea.
I see on the net, other people have exactly the same problem (four black stripes), it's curious if it's an hardware pb, that is exactly the same error display for all.
And i try with an other tft 1.77 (the same model, buy at the same time on radiospare), and the result is the same.
Could be - but at all i would contact the seller and ask him for a working code - otherwise send it back !
If he i making offers for an ARDUINO it has to work; otherwise every Triade-GangSta sells some "junk", labeled ARDUINO compatible
Hi All, been reading this with interest and have two TFT modules bought via RS Components, certified Arduino genuine part. Both these modules have four 'dead' horizontal stripes.Tested both with the MEGA 2560 and both give the same fault as described above.
Here's a funny thing. Just disconnected the Back light and you'd think the back light would go out. Actually, no, it does not! In fact, it gets brighter.
I've had the same problem! I've downloaded arduino software nightly build and the stripes…are gone away! But i've had another problem...the tftbitmaplogo example not functioning. "File arduino.bmp not found". I've deleted the function loadimage and substituted with the function bmpDraw founded in the adafruit library Adafruit_ST7735 downloaded from adafruit website spitfbitmap. Full code here:
/*
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
http://arduino.cc/en/Tutorial/TFTBitmapLogo
*/
// include the necessary libraries
#include <SPI.h>
#include <SD.h>
#include <TFT.h>
// 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
// this variable represents the image to be drawn on screen
TFT tft = TFT(lcd_cs, dc, rst);
void setup() {
pinMode(10, OUTPUT);
// initialize the GLCD and show a message
// asking the user to open the serial line
// initialize the serial port: it will be used to
// print some diagnostic info
Serial.begin(9600);
while (!Serial) {
// wait for serial line to be ready
}
// try to access the SD card. If that fails (e.g.
// no card present), the setup process will stop.
Serial.print("Initializing SD card...");
if (!SD.begin(sd_cs)) {
Serial.println("failed!");
return;
}
Serial.println("OK!");
MyLoadImage("arduino.bmp",50,50);
}
void loop() {
}
void MyLoadImage(char *filename, uint8_t x, uint8_t y){
#define BUFFPIXEL 20
File bmpFile;
int bmpWidth, bmpHeight; // W+H in pixels
uint8_t bmpDepth; // Bit depth (currently must be 24)
uint32_t bmpImageoffset; // Start of image data in file
uint32_t rowSize; // Not always = bmpWidth; may have padding
uint8_t sdbuffer[3*BUFFPIXEL]; // pixel buffer (R+G+B per pixel)
uint8_t buffidx = sizeof(sdbuffer); // Current position in sdbuffer
boolean goodBmp = false; // Set to true on valid header parse
boolean flip = true; // BMP is stored bottom-to-top
int w, h, row, col;
uint8_t r, g, b;
uint32_t pos = 0, startTime = millis();
bmpFile = SD.open(filename);
if(bmpFile != NULL){
Serial.println("File caricato!");
}
tft.begin();
tft.background(0,0,0);
if(read16(bmpFile) == 0x4D42) {
Serial.print("File size: "); Serial.println(read32(bmpFile));
(void)read32(bmpFile); // Read & ignore creator bytes
bmpImageoffset = read32(bmpFile); // Start of image data
Serial.print("Image Offset: "); Serial.println(bmpImageoffset, DEC);
// Read DIB header
Serial.print("Header size: "); Serial.println(read32(bmpFile));
bmpWidth = read32(bmpFile);
bmpHeight = read32(bmpFile);
if(read16(bmpFile) == 1) {
bmpDepth = read16(bmpFile); // bits per pixel
Serial.print("Bit Depth: "); Serial.println(bmpDepth);
if((bmpDepth == 24) && (read32(bmpFile) == 0)) { // 0 = uncompressed
goodBmp = true; // Supported BMP format -- proceed!
Serial.print("Image size: ");
Serial.print(bmpWidth);
Serial.print('x');
Serial.println(bmpHeight);
// BMP rows are padded (if needed) to 4-byte boundary
rowSize = (bmpWidth * 3 + 3) & ~3;
// If bmpHeight is negative, image is in top-down order.
// This is not canon but has been observed in the wild.
if(bmpHeight < 0) {
bmpHeight = -bmpHeight;
flip = false;
}
// Crop area to be loaded
w = bmpWidth;
h = bmpHeight;
if((x+w-1) >= tft.width()) w = tft.width() - x;
if((y+h-1) >= tft.height()) h = tft.height() - y;
Serial.print("TFT width: ");
Serial.println(tft.width());
Serial.print("TFT height: ");
Serial.println(tft.height());
// Set TFT address window to clipped image bounds
tft.setAddrWindow(x, y, x+w-1, y+h-1);
for (row=0; row<h; row++) { // For each scanline...
// Seek to start of scan line. It might seem labor-
// intensive to be doing this on every line, but this
// method covers a lot of gritty details like cropping
// and scanline padding. Also, the seek only takes
// place if the file position actually needs to change
// (avoids a lot of cluster math in SD library).
if(flip) // Bitmap is stored bottom-to-top order (normal BMP)
pos = bmpImageoffset + (bmpHeight - 1 - row) * rowSize;
else // Bitmap is stored top-to-bottom
pos = bmpImageoffset + row * rowSize;
if(bmpFile.position() != pos) { // Need seek?
bmpFile.seek(pos);
buffidx = sizeof(sdbuffer); // Force buffer reload
}
for (col=0; col<w; col++) { // For each pixel...
// Time to read more pixel data?
if (buffidx >= sizeof(sdbuffer)) { // Indeed
bmpFile.read(sdbuffer, sizeof(sdbuffer));
buffidx = 0; // Set index to beginning
}
// Convert pixel from BMP to TFT format, push to display
b = sdbuffer[buffidx++];
g = sdbuffer[buffidx++];
r = sdbuffer[buffidx++];
tft.pushColor(tft.Color565(r,g,b));
} // end pixel
} // end scanline
}
}
}
}
uint16_t read16(File f) {
uint16_t result;
((uint8_t *)&result)[0] = f.read(); // LSB
((uint8_t *)&result)[1] = f.read(); // MSB
return result;
}
uint32_t read32(File f) {
uint32_t result;
((uint8_t *)&result)[0] = f.read(); // LSB
((uint8_t *)&result)[1] = f.read();
((uint8_t *)&result)[2] = f.read();
((uint8_t *)&result)[3] = f.read(); // MSB
return result;
}