Go Down

Topic: Turning off an LCD from code (Read 20476 times) previous topic - next topic


Sep 14, 2009, 07:26 am Last Edit: Sep 14, 2009, 07:27 am by agnt666 Reason: 1
[size=14]This is a follow up to my previous question : Interfacing with a Winstar WH1602B LCD Screen

Is there any way turn off the LCD from code ?  

I tried using the lcd.noDisplay(); but that only hides the text displayed on the screen; ie the screen still remains on.[/size]


try putting the lcd pin 15 to arduino digital pin 13.
ive been using digital pin to turn on the backlight:

int backLight = 13;    // pin 13 will control the backlight

void setup()
 pinMode(backLight, OUTPUT);
 digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.


You could have the power of the LCD controlled by another pin. But you'd need a transistor or something of the sort to do it without damaging your pins.

What most people do, is control the backlight with PWM. That way, you can just turn off the Backlight anytime you want. But that won't turn off the LCD it self, just the backlight.

Hope this gives you a general idea.


There are two options, I've used both.

1. Use a transistor to switch the display's +5v on/off using a digital pin. Then you would need to initialize the display every time to switch it on.

2. Use one or two digital pins to control the backlight and contrast of the LCD. If you feed the positive side of the contrast pot with a digital pin, you can easily "switch off" the display with a single digitalWrite(). Remember to control the backlight in the same way.

I prefer (2). It's a lot less hassle as you only need to initalise the LCD once.


But keep in mind, if you're trying to save battery, turning off just the back light leaves the LCD driver itself powered. (They can take a decent amount of power)

But yeah. Back light is way easier.. by the way.. using PWM to control the back light may be better.. as you can control the brightness and obviously turn it off from the same pin.

Go Up