Problem with low contrast from HD44780 LCD with I2C backpack

Hi let me relate a little background first since it may help others who are struggling with this device.

I had one HD44780 LCD with I2C backpack. For those unsure the backpack is a device that allows you to use serial communication so only requiring 2 data pins on your Arduino board.

Here is a picture of the board

I quickly realised that the built-in LCD library could not communicate with an I2C equipped LCD.

I am quite new to Arduino so I do not understand external libraries very well and was unsure which ones to try. I found a blog that seemed to say that the Adafruit library was the best for communicating with these devices. I tried it and got nothing on the screen despite twiddling the contrast pot. So I put a scope on the relevant pins from the Arduino and confirmed there was a signal being sent. I started to suspect my board was defective so I bought another one but no luck with this either!

Eventually I found HELP! I2C LCD 16x2 display not working! - Project Guidance - Arduino Forum

So I downloaded the "Extensible HD44780 LCD library" and ran the example test sketch I2Cexpdiag

To my delight both LCDs gave output.

The only remaining problem is that one of them has very low contrast and the other is normal.

Here are images of them

Good one

Bad one

I don't think the low contrast one is physically deficient because by briefly interrupting it's power supply I can get it to display some sort of error output and this is in normal contrast.

Note these images are created after adjusting the pots for maximum contrast. The bad one is at the end of its range but as you can see, with the error signal output the contrast is good.

So, as I said I am not very competent with libraries, so I would like to ask whether there is some more I can do with Bill Perry's library to adjust the contrast of the bad one.

Here are the outputs from I2Cexpdiag

If you can't read that easily use this link output

It seems to me that the outputs indicate that all is OK, but that the LCD is connected to different memory locations for the I2C namely the good one at 0x27 and the bad one at 0x3F. I understand that the clever library takes care of these differences, so I guess this is not the issue.

Thanks in anticipation of your assistance

Mike Avison

There is a potentiometer on the backpack for adjusting the contrast. It is usually a small blue square bit with a screwdriver slot. Does adjusting it improve the contrast?

Or are you talking about the backlight brightness?

I can't see any of the pictures / images.
--- bill

bperrybap:
I can't see any of the pictures / images.

The website is blocking hot-linking. Right-click "View Image" so that one loads, then go back to this page and they will all load. :grinning:


They are unnecessarily large - many megabytes. :astonished:

groundFungus:
There is a potentiometer on the backpack for adjusting the contrast. It is usually a small blue square bit with a screwdriver slot. Does adjusting it improve the contrast?

Or are you talking about the backlight brightness?

Hi groundFungus, thanks for your reply,

re: the pots, as I said... "Note these images are created after adjusting the pots for maximum contrast. The bad one is at the end of its range but as you can see, with the error signal output the contrast is good."

re: the backlight , no the problem is with the text not the backlight. As the pictures seem to show the backlight is pretty good and bright all the time. I know pictures can be misleading, (autoexposure etc) but in this case they show the backlight faithfully.

Mike

bperrybap:
I can't see any of the pictures / images.
--- bill

bperrybap:
I can't see any of the pictures / images.
--- bill

Hi Bill thanks for the reply. So glad you took the time since it is your library I have been using.

I am very sorry about the images. Early this morning I cropped and resampled them all so I hope you can see them now. I didn't resample the program output since you would not be able to read it if I did. I will add a link below so you can just go to the website...

PS I have since noticed you have a function setContrast(contvalue), I will try using that and let you know how it goes. (Got to go running right now)

Thanks

Mike Avison

Here is the link output-from-test-sketch

OK, the re-sampled pictures load much quicker and more effectively now (thought my previous comment was typed in a place where the bandwidth/ WiFi performance is rather dubious), but it is still necessary for someone to "View Image" at least one of them, to have them all appear on the forum page.

On what voltage are you running the display?

If you have text to display, insert it into the post as text or preferably - using "code" tags - the "</>" widget top left of the reply box.

I could see the images once I did the "View Image" trick.

The setContrast() API function is a place holder that requires code to control h/w that can adjust the contrast.
There is no code for that yet. Also, the h/w on the backpack you are using does not have the capability to control the contrast, so it could not be implemented on that device anyway.
At some point, I'll update the code, documentation and examples to show how to create the h/w to use it for the pinIO class.
It will require adding a few additional components (couple of resistors and a capacitor) , and using an additional Arduino pin.

A bit on the "error signal output" you refer to.
Since you unplugged and plugged the display back in, the display is put back into its default mode.
The default/powerup mode is: 8 bit interface data, 1 line display, 5 x 8 font
Vs 4 bit mode and multi line mode.
In single line mode the duty cycle to the LCD pixels is twice as fast. This alters the contrast.
This is why you see a contrast change.

Does the contrast change much or at all when you turn the pot?

I would guess there is a voltage issue from either a main power issue or contrast pot issue.
I have seen LCDs "work", but not correctly when there is no main power. They seem to be able to pull enough power through either the contrast pin or the data pins to kind of sort of work.
I've also seen issues with the contrast pot on backpacks before.

Can you measure a few voltages?

Primary Voltage (LCD pin 2)
Contrast Voltage (LCD pin 3) , see if it changes when you turn the pot and see if matches the voltage of the lcd that is working.

--- bill

bperrybap:
At some point, I'll update the code, documentation and examples to show how to create the h/w to use it for the pinIO class.
It will require adding a few additional components (couple of resistors and a capacitor) , and using an additional Arduino pin.

That would be interesting, as the resistors would have to have a total value less than 150 Ohms. :roll_eyes:

bperrybap:
I could see the images once I did the "View Image" trick.

The setContrast() API function is a place holder that requires code to control h/w that can adjust the contrast.
There is no code for that yet. Also, the h/w on the backpack you are using does not have the capability to control the contrast, so it could not be implemented on that device anyway.
At some point, I'll update the code, documentation and examples to show how to create the h/w to use it for the pinIO class.
It will require adding a few additional components (couple of resistors and a capacitor) , and using an additional Arduino pin.

A bit on the "error signal output" you refer to.
Since you unplugged and plugged the display back in, the display is put back into its default mode.
The default/powerup mode is: 8 bit interface data, 1 line display, 5 x 8 font
Vs 4 bit mode and multi line mode.
In single line mode the duty cycle to the LCD pixels is twice as fast. This alters the contrast.
This is why you see a contrast change.

Does the contrast change much or at all when you turn the pot?

I would guess there is a voltage issue from either a main power issue or contrast pot issue.
I have seen LCDs "work", but not correctly when there is no main power. They seem to be able to pull enough power through either the contrast pin or the data pins to kind of sort of work.
I've also seen issues with the contrast pot on backpacks before.

Can you measure a few voltages?

Primary Voltage (LCD pin 2)
Contrast Voltage (LCD pin 3) , see if it changes when you turn the pot and see if matches the voltage of the lcd that is working.

--- bill

Hi I measured the voltage and immediately started to worry about my wiring!

The primary voltage feed from the Uno board must have pulled out sometime and I accidentally put it back into the 3.3V feed. When I corrected this both boards are equally bright (after twiddling back the pots). It was just a coincidence that one of the boards worked perfectly on 3.3V.

I am very sorry to have wasted your time with this stupid mistake. I know that on the forum advice page it says double check your wiring before posting. My only defense is that because one worked I assumed it was not a simple wiring error.

I have learned my lesson.

Thanks again to you Bill and to Paul_B and to groundFungus

Paul__B:
That would be interesting, as the resistors would have to have a total value less than 150 Ohms. :roll_eyes:

Huh? The contrast control circuit would be a simple RC network low pass filter to convert the PWM signal from the Arduino pin to an analog voltage that is fed into the contrast input of the LCD.

--- bill

mikeavison,
Don't sweat it. Often it is the simple things that trip us up.

I did something similar doing some hurried testing but in my case it literally caught the ESP module I was using on fire. :astonished:
And one time I hooked up the pins to a DSB1820 backwards (top view of pinout vs bottom view) and when it wasn't working I foolishly touch it, and it instantly left a nice little white semi circle burn on my index finger.
I was surprised but the temp sensor still worked.

--- bill

bperrybap:
Huh? The contrast control circuit would be a simple RC network low pass filter to convert the PWM signal from the Arduino pin to an analog voltage that is fed into the contrast input of the LCD.

Yes, however we know that the contrast ladder in the display board has a value of 11k (five 2k2 resistors) and is connected to the 5 V Vcc rail, and requires a minimum of something like 4.2 V and up to 4.8 V, so in order to pull the contrast pin down to 0.2 V, it requires an impedance of about 440 Ohms.

OK, I will grudgingly allow that a total resistance of no more than 400 Ohms may suffice as when set to a PWM of zero, it will be holding the contrast voltage on pin 3 at 0.2 V. If you wanted to (be able to) drop that voltage further you would require a correspondingly lower resistance.

Note that if you have a push-pull PWM drive - as generated by analogWrite, your working PWM range will be in the order of 0 to 10 (corresponding to 0.2 to 0.8 V). :grinning: