How to turn backlight off/on in program ?

hello,

Is it possible to turn on/off the backlight of a standard LCD (16x2, this without integrated buttons & LiquidCrystal.h) ?
led.nodisplay() & led.clear() only affect the text, and the backlight remains on.

I whish to "poweroff" the lcd when there is nothing to display. And, of course, "poweron" when there is anything.

Maybe with pin LED+ or LED-, attached with analogpin? digitalpin? resistor?
I am just programmer, not electronician ...

Someone trying ?
Phil

Is it possible to turn on/off the backlight of a standard LCD (16x2, this without integrated buttons & LiquidCrystal.h) ?
led.nodisplay() & led.clear() only affect the text, and the backlight remains on.

How do you turn the light on and off in your bedroom? You don't hardwire the light. You wire the light through a switch. Do the same with the LCD backlight.

If the current requirements are low enough, the Arduino digital pins can provide the needed current. Turn the pin on to make the backlight come on. Turn in off to make the backdark come on.

If the current requirements are too high, use a transistor. The Arduino turns the transistor on or off, via a digital pin, and the transistor turns the light on or off.

If it's the same as mine

 pinMode(10, OUTPUT);
digitalWrite(10, LOW);

I'll let you guess how to turn it on again.

3 Likes

As usual, you have not actually explained what configuration you are using.

We will presume it is as described in one of the tutorials and in fact pin 16 is connected to ground and pin 15 is connected to 5V to power the backlight.

Take a look at your LCD board. If resistor R8 (or possibly R9) is "101" - 100 ohms, then your illuminating LED will be drawing 20 mA which is within the capability of an Arduino pin to drive; you can connect pin 15 of the LCD module to an Arduino pin instead of Vcc and control that pin to switch the backlight.

Is it possible to turn on/off the backlight of a standard LCD (16x2, this without integrated buttons & LiquidCrystal.h) ?
led.nodisplay() & led.clear() only affect the text, and the backlight remains on.

The LiquidCrystal library that comes with the Arduino IDE deals only with the HD44780U type controller and it's 14-pin interface on your LCD module. Nothing in that library can or will control the backlight.

The other two pins (15 and 16) are typically connected to an LED backlight and there may or may not be a series dropping resistor on the pc board and it may or may not be labeled R8 or R9. It will typically be near the end of the board and you can usually follow a trace from pin 15 or 16 to that resistor if it exists. On one module that I have it is R11 and it is 0 ohms so I must use an external resistor with that module.

Pick an unused I/O pin on your Arduino and use the technique shown by KenF to control your backlight.

If resistor R8 (or possibly R9) is "101" - 100 ohms, . . .

As usual you are giving resistor numbers for the particular board(s) with which you are familiar and are counting on the reader to have a board with a similar layout.

Don

floresta:
As usual you are giving resistor numbers for the particular board(s) with which you are familiar and are counting on the reader to have a board with a similar layout.

Nevertheless, those with which I am familiar would constitute the vast majority of the cheap ones on Fleaybay, so if that is what he has, there is something like 95% chance it will match. By way of curiosity, from where did your obtain your odd one?

Paul__B:
If resistor R8 (or possibly R9) is "101" - 100 ohms,

I here use the word "If" in the logic sense. If what I state matches - as it almost certainly will - then he can proceed with the information that follows. If it does not match, then sensibly he needs to do what is suggested so often, and provide (reasonably sized - no more than 1024 by 768) photos of or weblinks to his actual component.

Nevertheless someone with little experience with these devices would assume that your authoritative reply was applicable to all LCD modules when in fact, as you have confirmed, this is not necessarily the fact. My previous statement stands.

My display is not 'odd', it is just different from the ones with which you are familiar. I purchased it from a US based non-eBay vendor about six years ago. It is an 'Orient Display' LCD model AMC2004AR-B-B6NTDW. There is a similar device currently on sale on Amazon - (http://www.amazon.com/Character-Module-Negative-Blue-AMC2004AR-B-B6WTDW/dp/B00E3FQM82). I don't normally include links to Amazon (or other stores) because they frequently become invalid before the other information in a thread is obsolete.

I really think your posts would be more valuable if you would just clarify the fact that your information is based on your personal experience with a representative bunch of LCD modules.

Don

Many thanks KenF. It works well.
And so sad for the struggles of others ... just like kids!

Phil