Pages: [1]   Go Down
Author Topic: Can the Sainsmart 3.2" TFT be turned on & off?  (Read 3024 times)
0 Members and 1 Guest are viewing this topic.
Melbourne, Australia
Offline Offline
Newbie
*
Karma: 2
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all,
I bought a Mega2560 with the 3.2" Touch screen and shield from Sainsmart to build a vehicle battery monitor. Everything has worked amazingly well and with all of the info and code libraries around getting most things running has been fairly quick and easy! However, since this monitor will run 24/7, I'm concerned about the lifetime of the touchscreen and backlight. Does anyone know of a way to turn this screen off & on? The .lcdOff() and .lcdOn() functions don't work with this model. Even a hardware mod would be acceptable. :-)
cheers, Bernie


* ppm_1.JPG (86.77 KB, 882x497 - viewed 139 times.)
Logged

0
Offline Offline
Shannon Member
****
Karma: 199
Posts: 11650
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A p-channel MOSFET to switch the Vcc input to the LCD?

You'd have to ensure all the signal lines were low or INPUT before powering it down.  For instance
the IRL5602S is a logic-level p-channel device.
Logged

[ I won't respond to messages, use the forum please ]

France
Offline Offline
God Member
*****
Karma: 34
Posts: 978
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello and welcome smiley

I modified the UTFT library like this. It is the turn on/off sequences, as described in the SSD1289 datasheet. It works, but does not control the backlight. Better than nothing smiley

Code:
void UTFT::lcdOff()
{
cbi( P_CS, B_CS );
switch ( display_model )
{
case PCF8833:
LCD_Write_COM( 0x28 );
break;

//I added this ------------------------
case SSD1289:
//turn OFF
LCD_Write_COM_DATA( 0x07,0x0000 );
LCD_Write_COM_DATA( 0x00,0x0000 );
LCD_Write_COM_DATA( 0x10,0x0001 );

//only standby mode ON: no visible difference?
//LCD_Write_COM_DATA( 0x10, 0x0001 );
break;
//-------------------------------------
}
sbi(P_CS, B_CS);
}

void UTFT::lcdOn()
{
cbi( P_CS, B_CS );
switch ( display_model )
{
case PCF8833:
LCD_Write_COM( 0x29 );
break;

//I added this ------------------------
case SSD1289:
//turn ON
LCD_Write_COM_DATA( 0x07, 0x0021 );
LCD_Write_COM_DATA( 0x00, 0x0001 );
LCD_Write_COM_DATA( 0x07, 0x0023 );
LCD_Write_COM_DATA( 0x10, 0x0000 );
delay(30);
LCD_Write_COM_DATA( 0x07, 0x0033 );
LCD_Write_COM_DATA( 0x11, 0x60B0 );
LCD_Write_COM_DATA( 0x02, 0x0600 );
LCD_Write_COM( 0x22 );

//only standby mode OFF: no visible difference?
//LCD_Write_COM_DATA( 0x10, 0x0000 );
break;
//-------------------------------------
}
sbi( P_CS, B_CS );
}

Look here: http://arduino.cc/forum/index.php?topic=125856.0 . If you do the hardware modification described in this topic, please report if it worked for you smiley

PS, I have exactly the same display, do you also have about 1 to 2mm slack at the left side, that you have to press to get uniform lighting?
« Last Edit: December 24, 2012, 10:01:14 pm by guix » Logged

Melbourne, Australia
Offline Offline
Newbie
*
Karma: 2
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Happy Christmas (athiests and all smiley-wink ) and thanks for the replies.
A MOSFET might work.. thanks for the suggestion.
I'll investigate guix's code and minor hardware hack first since it's less "invasive".

Actually, a combination of both suggestions might give "fade" control: I wonder if a FET-based circuit could be used to replace the pot..?
Perhaps later.

>>PS, I have exactly the same display, do you also have about 1 to 2mm slack at the left side, that you have to press to get uniform lighting?
You mean physically put pressure on the edge of the display nearest the 40-pin conn?
... I looked closely and I can see that edge is raised about 0.5mm above the PCB.. perhaps by the flexible flat-ribbon that bends around beneath it.
I can press this gently down at each corner and it extinguishes the light that seeps out from beneath.
In my case it doesn't have any visible effect on the screen lighting however.
In the attached photo, you can see that the plastic frame around the display is intended to locate into the small hole on the PCB.
Perhaps holding each corner down after applying a small drop of CA glue (a.k.a. Superglue) might help if it affects the lighting on your display?
thanks again,
Bernie


* utft_corner_raised_0.JPG (62.45 KB, 832x763 - viewed 66 times.)
« Last Edit: December 25, 2012, 08:56:40 am by berniew » Logged

UK
Offline Offline
Full Member
***
Karma: 1
Posts: 129
mini mini mini
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If this is the setup with the mid-board with a multi turn pot for the backlight all you need to do is pop a PNP transistor in the place of the pot controlled from a PWM source, it's also not a bad idea to rig up a separate 3.3v supply too, as if you plug the board into a Arduino mega1280 it wont do the FTDI chip any good smiley
Logged

Melbourne, Australia
Offline Offline
Newbie
*
Karma: 2
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks beige,
I thought of using a FET because the response might be more linear and wouldn't load the PWM line?

>>pop a PNP transistor in the place of the pot controlled from a PWM source
 PNP?
I'm not overly skilled in analog electronics, but I thought NPN would work. Collector connected to +ve 3.3V, Emitter to the backlight control line (pot removed) and Base to the PWM output via a 1K resistor.
.. it didn't work  smiley-sad
regards, Bernie
Logged

North Queensland, Australia
Offline Offline
Edison Member
*
Karma: 64
Posts: 2100
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Mine has the same problem.

It appears someone has removed the TFT cover to flip over the navigation panel ( the same display is available with icons in that area ). I guess the gap is a result of dismantling the display.

You could make a frame of electrical tape around the display to tightly hold it down.

Logged


Melbourne, Australia
Offline Offline
Newbie
*
Karma: 2
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some progress.
Thanks to all, I have a simple mod that allows me to control the backlight (on/off only, no fancy fading) using a spare digital output pin.
The transistor is necessary because the backlight draws close to 100mA. The digital outputs can source (or sink) a maximum of 40mA. There could be tears..
Remove the trimpot, solder 1 x PNP transistor and 1 x resistor (nominally 1K)
In the attached circuit diag and code example, I've used digital pin 8 to control the backlight.

Software still isn't entirely resolved, though I have a simple workaround.
I'd like to use guix's UTFT library mod, but it doesn't seem to toggle pin 8.
I don't yet know enough about writing to these port registers to change it nor can I find good docs about port/pin mappings.
( I WILL fix this because it's a better way to do this).
For the moment though, I left guix's library mods in place (they seem to shut down the display, though not the backlight) and added a line in my arduino sketch immediately after the call to turn the LCD on or off.
eg:
Code:
       const int backlight_pin = 8;
       const int backlight_on = 0;
       const int backlight_off = 255;

...

        myGLCD.lcdOn();
        analogWrite(backlight_pin, backlight_on);         

...

        myGLCD.lcdOff();
        analogWrite(backlight_pin, backlight_off);         




* backlight_control_0.JPG (69.94 KB, 1175x585 - viewed 132 times.)
« Last Edit: December 26, 2012, 01:42:49 am by berniew » Logged

Melbourne, Australia
Offline Offline
Newbie
*
Karma: 2
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've created a new thread that describes how to fade and control the backlight because although the info came from this thread, it's actually a slightly different subject to controling the display and modifying the UTFT library.
It's here.
cheers, Bernie
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yeah,good info to me ,I'm not overly skilled in analog electronics, but I thought NPN would work.thanks for your sharing.
Logged

UK
Offline Offline
Full Member
***
Karma: 1
Posts: 129
mini mini mini
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nicely done, sorry I wasn't a bit clearer, was suffering from the 25th...
Logged

Melbourne, Australia
Offline Offline
Newbie
*
Karma: 2
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No worries, beige and kerryjosper. It ended up being exactly what beige suggested. The only improvement to this might be a FET instead of the transistor, as suggested by MarkT.
Logged

Pages: [1]   Go Up
Jump to: