0

I have a generic HD44780 compatible 16x2 LCD display, with an already soldered on PCF8574 module. Its backlight is blue, and the characters are supposed to be white (on blue).

It is connected to a generic "Lolin" ESP8266 module which is working fine and is not related to the problem, I hope.

Using the LiquidCrystal_I2C library available at https://github.com/lucasmaziero/LiquidCrystal_I2C, I uploaded the simple "Hello, World" sketch provided, and it works. Used the most current libraries and Arduino IDE as of 2019-03-20.

However, the text displayed is a very dim black-on-blue instead of a bright white-on-blue.

I do not have any clue on why it happens and how to fix it (and that's my question).

What I know is that if I somehow "glitch" the display (for example by disconnecting and reconnecting the power lead) it will sometimes display gibberish, but in a very clear white-on-blue, so I know the LCD hardware is not defective per se.

I also tried a few other libraries to the same effect: LiquidCrystal_PCF8574 and LiquidCrystal_I2C (the version available directly from the Arduino IDE, source at https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library)

Below, the example sketch used to generate the problem. Be aware it is for the first LiquidCrystal_I2C library I referred above, but with changes, works with the others I tried.

#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
  // initialize the LCD
  lcd.begin(); // Init with pin default ESP8266 or ARDUINO
  // lcd.begin(0, 2); //ESP8266-01 I2C with pin 0-SDA 2-SCL
  // Turn on the blacklight and print a message.
  lcd.backlight();
  lcd.setCursor(0, 0);

#if defined(ESP8266)
  lcd.print("ESP8266");
#else
  lcd.print("ARDUINO");
#endif

  lcd.setCursor(0, 1);
  lcd.print("Hello, world!");
}

void loop()
{
  // Do nothing here...
}

And a photo of the anomalous display. Turning the constrast potentiometer does not help.

anomalous display

  • what's the operating voltage on that device? How have you connected the power on it? – Jaromanda X Mar 20 at 23:22
  • Operatin voltage seems to be 3.3V. If I connect the VCC line of the display to the Vin of the ESP8266 (5V in my case), nothing works, nothing is displayed. – Flyingfenix Mar 20 at 23:29
  • Just tried connecting the i2c interface via a level converter (display side 5V, ESP8266 3.3V) and it doesn't power up. However if I power both sides of the level converter on the 3.3V rail it works "wrong" (So, no bad converter or wrong connections). – Flyingfenix Mar 20 at 23:42
  • I had a similar problem.In my case it was contrast settings. Some of these displays require negative voltage to drive contrast pin (especially when powered from 3.3V). Because this pin doesn't draw much of current, a simple 2 diode and 2 capacitors fed with square wave (can be generated from your Arduino, or 555) will be sufficient. – smajli Mar 21 at 8:37
  • @smajli, care to provide some details on how you achieved that? Free GPIOs on my project are at a premium, but it is worth the try! – Flyingfenix Mar 21 at 13:11
0

There is a chance that this LCD would need a negative voltage on contrast PIN. Below there is a simple schematic. You would need to provide pulses on the 'Pulse in' branch. Use Negative voltage branch and potentiometer to feed your contrast pin.

enter image description here

  • 1
    It's so simple that's worth a try. Will post the result as soon as possible. – Flyingfenix Mar 21 at 20:51
  • It worked nicely. However, not very practical. Why? Because the I2C module is soldered onto the LCD module, and to apply the negative voltage to the contrast pin I would need to cut its connection to the PCF8574 board and then solder an external connection to the negative voltage generator. Anyway, problem was solved, thank you very much. – Flyingfenix Apr 18 at 16:13
1

This answer is just to complement @smajli's answers posted (and accepted) before.

The problem lies in that the contrast pin has to be fed negative voltages when the module is powerered via a 3.3V supply to be able to show text in the correct white-on-blue setting and not on the faint black-on-blue.

@smajli correctly showed how the negative voltage may be generated from the normal positive supply and a pulse generator. However, in my scenario, the pulse generator was connected to the +3.3V rail instead of +5V and the pulses where generated via the ESP8266's PWM feature. Using a duty cycle of 50% it generates about -2V. I'll not reproduce his schematic here, though, but below is a photo of it assembled and in action.

enter image description here

The updated code is exactly the same, with only the PWM generation added inside the setup() function:

  pinMode(D8, OUTPUT);
  analogWrite(D8, 512);   // 10-bit!

Finally, the photo below illustrates the final result.

enter image description here

Again, thanks again to @smajli for the previous insights and answer.

P.S.: Keen readers will notice the module used now is NOT the same used when I asked the question originally. It is another generic HD44870 module, but without the I2C interface, working in 4-bit mode. However, the exact same problem (black-on-blue text) occurs when the contrast pin is set to anywhere between +3.3V and GND and is promptly solved when using negative voltage.

  • Good to see your explanation. Good effort and nice effect. – smajli 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.