Cheap Chinese TFT LCD backlight control

http://www.ebay.com/itm/391205345103?_trksid=p2060353.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

So I bought one of these.. it was pain in the butt to get it to

  • Show anything but white
  • Not be mirrored
    but I managed to get it working.. it was all just software, I'm pretty good with software.

Now the problem I'm having is that every place I go to tells me this:

Bright, 4 white-LED backlight, on by default but you can connect the transistor to a digital pin for backlight control

:o

Ok.... what does this mean? Which pin? How? Am I just very very stupid?

I'm not very good with electronics.
Basically I just stick shields on Arduino and start coding.
I've played around with the pins and only way I got something resembling dimming was to stick 100K resistor on 5V pin.

Any hints?

These must be the best supported cheap displays in the history of mankind.

You just plug them in and install a suitable library.

No, they do NOT have a controllable backlight. Yes, some controllers can dim the TFT that the backlight "shines through".

You can send the controller to sleep. You can send parts of a UNO to sleep. You can not switch the backlight off.

There is one "spare" pin A5. If you want to dismantle your shield, you could divert the backlight LEDs supply. Then attach a Mosfet to A5 and switch the backlight on and off. In fact you could glue the trivial electronics to the shield and control wire to A5. Then you have your ideal display.

David.

Well this brings me pretty close to what I want to achieve, thanks!
I just connected the A5 to 5V on the shield and now I can turn the leds on and off.

Now I just need to figure out what kind of trivial electronics I need to glue to my shield.
To me it seems I need to use relay. So if have 2 ways on the relay, one that goes through the resistor and keeps my screen dim and one that let's 5V straight to the screen and makes it bright. That way the screen would stay "sleeping" (I don't want to turn it all the way off) when nothing happens but it can be woken up (make it bright) when something interesting happens.

Or am I way off on this?

Yes, you are wrong. The backlight will take a serious amount of current. You should never switch it with a port pin. Only with a transistor/MOSFET (that is controlled by a port pin).

You should never connect a GPIO pin directly to 5V.

Surely the easiest thing to do is call tft.fillScreen(BLACK)

David.

So I need to start reading more then.
Thanks anyway! At least I have direction where to look at :slight_smile:

Yes, you need to do a bit of schoolwork on basic electronics,

I just looked at the link that you posted in message#1.

  1. The photo shows TFT LCD SHIELD (9335)
  2. The description says 18-bit colors
  3. The description says 7781 controller
  4. The description says digital 5-13 and analog 0-3

I suspect that (1) implies ILI9335 controller
It is 16-bit colors. It uses D2-D13 and A0-A4 pins.

Did you download the diagnosis sketch from the misc.ws website?
What ID does it report?

There is nothing unusual with mendacious Ebay listings. You either pay more to Sparkfun for good products and good support OR you buy cheap with lies.

David.

I did download the sketch and it reports 9335.

In the Adafruit_TFTLCD examples there's no such option but those work with 9325/9327 id.

EDIT: Oops, 9327 should be 9328

No, ILI9327 is VERY different to a ILI9325.
Yes, ILI9335 should work with tft.begin(0x9325)

From the data sheet(s), ILI9335 is just a cut-down ILI9325. So it behaves exactly the same with the basic registers and will ignore any "advanced" 9325 registers.

If you observe any "unusual" behaviour with 0x9325, please say what it is.

David.

In the Adafruit_TFTLCD both 9325 and 9328 are handled exactly the same

if((id == 0x9325) || (id == 0x9328)) {
    ...
}

The only abnormal thing with this was the mirrored output but that got fixed with Mike's code which I got from here:

Yes, ILI9328 is similar to ILI9325. No, ILI9327 is completely different.

Is your screen mirrored? I.e.. plot at (0, 0) is shown at (239, 0) ?
Is the plot(0, 0) correct but letters are printed backwards?

Both of these behaviours are easily solved. You should try every Rotation. 0 means portrait. USB cable at the top.

In the tftpaint.ino sketch, does the spot follow your stylus?
This is very common with these Touchscreens. You just swap the pins in the Touchscreen() constructor if X and Y are swapped. And you swap the MIN and MAX if the direction is wrong.

You get your display correct first. Then calibrate the Touch.

There are so many hacked versions of the original Adafruit library. Please give a link to the actual library that you are using.

If you give accurate information, you will get your display working 100%. Too often we just hear that "it does not work"

David.

First thing I said is that I've got my screen working.

Achieved by using non-hacked Adafruit library, id 9325 and Mikes mirroring code from
http://www.airspayce.com/mikem/TFTLCD-mikem.zip which I found in the Touch Screen Shield for Arduino UNO – misc.ws
which basically boils down to this:

// Mike McCauley:
// Manage variations of GRAM arrangement.
// The inexpensive 2.4" touchscreens from Ebay made by http://www.mcufriend.com
// have unusual addressing so added this:
// Some instances of this device have reversed X or Y coordinates
// If your LCD display chip has inverted X addresses define this:
//#define INVERT_X
// If your LCD display chip has inverted Y addresses define this:
//#define INVERT_Y

#ifdef INVERT_X
#define X(x) (TFTWIDTH - x - 1)
#define I_X(x) (x)
#else
#define X(x) (x)
#define I_X(x) (TFTWIDTH - x - 1)
#endif
#ifdef INVERT_Y
#define Y(y) (TFTHEIGHT - y - 1)
#define I_Y(y) (y)
#else
#define Y(y) (y)
#define I_Y(y) (TFTHEIGHT - y - 1)
#endif

So, yes, the output was mirrored. Meaning that the text was backwards. Touch works as expected.

The question was about the backlight and we've already come to the conclusion it needs some more hardware to control it.