LiquidCrystal_I2C.h


#1

I wonder where should I download LiquidCrystal_I2C.h used by the LCD kit?

https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library does not compile.
https://hmario.home.xs4all.nl/arduino/LiquidCrystal_I2C/ compiles, but LCD remains blank.

I was testing with this sketch, which is a reduced version of losant-kit-lcd:

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F, 16, 2);

void
setup()
{
  lcd.begin(16, 2);
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Hello LCD");
}

void
loop()
{
}

#2

Thanks for that catch. The library we used is:

I am updating the instructions now. If you have any troubles with that, let me know.


#3

Changing to marcoschwartz’s library still does not help: the LCD is still blank. (using the code in post-1; my DSL is down at the moment so I can’t try the official code with MQTT connection, and I doubt it would make any difference because I carefully copied everything related to LCD)

A few doubts are:

  • I don’t see any code choosing which pins are used
  • LCD module is powered at 5V. How could it communicate at 3.3V logic?
  • I2C communication requires a 4.7K pullup, but there isn’t a resistor in the kit.

I have already tried swapping SDA/SCL lines, powering LCD at 3V3, and replacing the jumper wires. None of these helped. In each case, the red LED on the back of LCD lights up, but LCD itself remains blank.

I could test the LCD with a Huzzah Feather, if you tell me how to set the pins.


#4

Other problems with the instructions:

  • Neither the instructions nor the store page list the LCD module itself in the “kit should include the following items” list; they don’t mention the model number of the LCD.
  • In the instructions, “wiring” figure connects VIN-GND and GND-VCC, which would be a disaster if someone reads the figure but not the text.
  • In the instructions, “wiring” figure connects SCL to the rightmost pin on the bottom row of NodeMCU board. That pin is D0, not D1 as specified in the text.

#5

I think I may know what it is. Have you turned the potentiometer on the back of the LCD?

It adjusts the text brightness on the LCD screen itself. Some of the LCDs come with this turned all the way down.


#6

After turning the knob on the back of LCD all the way to the right, 16 white blocks appears on the row near the parallel pins.
It seems that ESP8266 is not communicating with the LCD module, because the backlight isn’t on despite lcd.backlight(); code.


#7

Hey @yoursunny, can you please try the instructions from this blog post. It’s a simplified setup and what the kit instructions are based on. Want to start with something simple so we can see where the problem might be.


#8

I tried the code from “How to Connect an LCD Display to ESP8266 NodeMCU” blog post, but it still doesn’t work:

The same code can display text on ESP8266 Witty Cloud board, connecting SCL-GPIO5 SDA-GPIO4:

But backlight won’t turn on in either case.


#9

@yoursunny, for your backlight problem, can you make sure the two pins on the back of the chip are properly tied together?

I’m also running everything on the NodeMCU to see if I can duplicate.

Could you run this: http://playground.arduino.cc/Main/I2cScanner

It will verify that you have the correct I2C address. It may change. It’s the 0x3F address on this line:

LiquidCrystal_I2C lcd(0x3F, 16, 2);

#10

Also, just as a sanity check, how did you install the LiquidCrystal_I2C library? Did you use Arduino’s library manager?


#11

There isn’t a jumper cap when the LCD module comes in. I put on a female-female dupont wire and the backlight turns on, but the LCD only displays one line of black squares instead of HELLO WORLD.

The library is installed by git clone https://github.com/marcoschwartz/LiquidCrystal_I2C.git into My Documents\Arduino\libraries. Frank’s library is not installed.

I2cScanner says No I2C devices found. I guess this means a faulty connection?
Since LCD is displaying text correctly on the other ESP8266, the problem might be in the NodeMCU.
I’ll test other pins and test D1/D2 with LEDs to see what’s going wrong.


#12

I moved to SCL-D5 SDA-D6, and inserted Wire.pins(12, 14); at top of setup() function.
I2cScanner finds 0x3F correctly, and HELLO WORLD is displayed.
This means either D1 or D2 pin isn’t connected.

Then I did the LED test: D1/D2 - (+)LED(-) - 330Ohm - GND; sketch blinks pin 5 and 4.
D1 blinks correctly, but D2 remains off all the time.
If I use a jumper wire to connect LED(+) to NodeMCU’s header (where “D2” is printed), it also doesn’t blink.
If I use a jumper wire to connect LED(+) to ESP-12E’s GPIO4 pin (on the raised chip), the LED blinks.
Thus, the faulty connection is between ESP12-E and NodeMCU PCB.


#13

@yoursunny, I’m sorry to hear that you got a funky nodeMCU. If you DM me your order number, I’ll ship a new one out to you tomorrow. I’ll make sure to test it personally before it goes out too.


#14

I see the documentation has been updated, but it still contains the following errors:

  • Neither the instructions nor the store page list the LCD module itself in the “kit should include the following items” list; they don’t mention the model number of the LCD. It’s sufficient to say “16x2 LCD with Hitachi HD44780 compatible controller, I2C address 0x3F”. (when I purchase the kit I was thinking about displaying graphics on the LCD, but this isn’t possible)
  • “environment setup” section screenshot suggests installing Frank de Brabander's library, but the post above suggests installing Marco Schwatz's library.
  • “wiring” fritzing figure connects SCL to the rightmost pin on the bottom row of NodeMCU board. That pin is D0, not D1 as specified in the text.
  • Also, I haven’t tried the exact steps in the tutorial, but #define MQTT_MAX_PACKET_SIZE 256 might be necessary, based on my experience with another application sending commands with similar size.