Backlight on HD44780 2004 LCD Display turnes off

Hi everyone,

I've a quite puzzling problem with a HD44780 2004 LCD Display, connected to an Arduino Mega 2560 via an I2C "backpack". The code uses the LiquidCrystal_I2C.h library. I use a PWM signal on the backpack's "LED" pin to control the backlight intensity.

The components are part of a home flight simulator setup and most of the Mega's pins are used.

When I power the Arduino up, the display's blacklight turns on as intended but the moment the first characters are send to the display the display goes dark. (When you power the display up, first you get row #0 and #2 filled up with fully "filled out" characters, lines #1 and #3 stay empty. After the first content has been sent to the screen, those characters are shown correcty, but the backight stays dark.) Swapping the display/I2C backpack-unit doesn't change anything, so those components seem to be ok.

At minimum backlight intensity, the voltage measured at the supply to the I2C backpack is 4,90V
At full backlight intensity, the voltage measured at the supply to the I2C backpack is 4,82V
After the backlights goes dark unintentionally, the voltage goes back to 4,90V

You can see that the voltage drops once the backlight is turned on indicating that the overall amperage is on the high side. However, the HD44780 datasheet gives the minimum operating voltage for the itself LCD as 4,5V and for the LEDs as 4,05V, so there is plenty of margin for the backlight LEDs. Also, there is no backlight setting that brings the backlight back on.

I remember that when I was assembling all the componentes (input and output) piece by piece, the display worked fine.

Does anyone have an idea what to do to solve the problem or where to look? I've run out of ideas.

Many thanks in advance,
Frank

How did you wire this :thinking: ?

the I2C backpack gets +, GND, SDA, SDL on one side, completely normal.

The backpack comes with a jumper pulling up said LED pin. I replaced the jumper with a PWM signal to the LED pin. I don't think the problem has to do with that part. When I replace the PWM pin with the jumper, the problem stays the same.

see here for details:

What the 2 pin jumper does can vary depending on the backkpack design you have, but the most common design uses the jumper to connect VCC to the backlight anode pin.
So if you have removed the jumper and connected a PWM signal to the LCD anode pin via one of the the 2 pin jumper pins, it isn't good enough to guarantee control of the backlight.

The issue is that there is an i/o pin on the PCF8574 that controls the base pin of a transistor to turn on/off the backlight.

Not all backpacks are the same circuit design so how the backlight control and jump works can vary depending on which backpack design you have.
Most use an NPN transistor to control the ground to the cathode and the jumper pins control VCC to the backlight anode pin.
See here for a schematic of this design:

What that means is that if the transistor is off, sending VCC or a PWM signal to the LCD anode won't matter since there will be no ground signal going to the backlight cathode because the transistor is off.
i.e. the PCF8574 controls whether the LCD backlight will light up when power to the anode is applied.

Another thing that can vary is the state of the PCF8574 pin that controls the transistor after library initialization since there are multiple LiquidCrystal_I2C libraries and not all of them are the same.
If you have the backpack design shown in the link, a low turns off the backlight and a high turns it on. Since there is pullup on the transistor base signal and the PCF8574 defaults to "input" mode which is done with an internal weak pullup, it means that just applying power to the backpack will light the backpack.
Once the library starts talking to the PCF8547 chips, then the state of the backlight control pin is control by the library and must be set for each nibble sent to the LCD.
Also, some LiquidCrystal_I2C libraries turn on the backlight in begin() and some don't which means that the backlight may or may not be on after begin() returns.
The most common LiquidCrystal_I2C library does not turn on the backlight in begin() which means that the sketch code must explicitly turn it on.

The issue you are likely having is that the i/o pin from the PCF8574 is low which turns off the transistor which doesn't allow any current to flow through the backlight even if power is applied to the anode.

There are a variety of ways to resolve this. The easiest is to do it in s/w by telling the library to turn on the backlight. This will allow the anode pin to control lighting up the backlight including when a PWM signal is used.

i.e. call the backlight() function to turn on the backlight.
you can then use noBacklight() to turn off the backlight.
So even if you have a PWM signal wired up, you can turn the backlight off using noBacklight() and back on again using backlight() which will return to PWM control.

--- bill

3 Likes

another thing that you will need to verify is the backlight current load since many 20x4 LCDs will draw too much current to be directly driven by a PWM pin from an AVR.

You can avoid this by hooking up the PWM pin to the base of the transistor instead of to the anode of the LCD.
Note that if you do this you will also need to cut the trace that goes between the base of transistor to the PCF8574.

--- bill

1 Like

Hello Bill,

thank you soooo much!!!

I've got to admit, you made me facepalm real hard. I've no idea how it could escape me that the library is able to control the backlight. I thought otherwise and thought I had double checked that.

It was an on/off project for some time now and I found evidence inside the code that I changed library versions along the way. (lcd1.begin(); became lcd1.init():wink: Maybe that contributed.

Anyway, you've made my day!!

Thanks again,
Frank

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.