NodeMCU not printing text on 16x2 LCD using I2C

I am using a 16x2 LCD to display some data for my project. I am using I2C for interfacing NodeMCU 1.0
Code is compiling and uploading successfully but it’s not displaying text.

Circuit:


Library used: LiquidCrystal_I2C.h
The project I referred to NodeMCU 16x2 LCD on Arduino IDE - Robo India || Tutorials || Learn Arduino || Robotics

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F);  // updated the address after scanning the I2C

void setup(){
  Wire.begin(2,0);
  lcd.begin(16,2);   // initializing the LCD
  lcd.backlight(); // Enable or Turn On the backlight 
  lcd.print(" Hello Makers "); // Start Printing
}
void loop(){
  // Nothing Absolutely Nothing!
}

What does the i2cscanner.ino sketch tell you? That is part of the project you reference. Does it show the LCD present?

blh64:
What does the i2cscanner.ino sketch tell you? That is part of the project you reference. Does it show the LCD present?

I used this sketch to find the address: NodeMCU i2c Scanner on Arduino IDE - Robo India || Tutorials || Learn Arduino || Robotics
It gave me 0x27
I updated the address but it was not fruitful.

Have you tried adjusting the contrast control that is generally located on the display's I2C board?

david_2018:
Have you tried adjusting the contrast control that is generally located on the display's I2C board?

Yes, I have adjusted it and set it to the maximum level.

Yes, I have adjusted it and set it to the maximum level.

Contrast post should be set at the level where the blocks are illuminated on only one row of the display.

You may have a problem with the display running at 5 volts while the nodemcu runs at 3.3 volts, you should be using a level shifter.

Might be a problem with the library, there are a lot of LiquidCrystal_I2C libraries using the same file names, so hard to tell whether the one you have is compatible with a nodemcu.

Try using the hd44780 library (it should be in the library manager in the IDE), and run the FIle > Examples > hd44780 > ioClass > hd44780_I2Cexp > I2CexpDiag sketch. That will give you a lot of info in the serial monitor as well as on the LCD display.

david_2018:
You may have a problem with the display running at 5 volts while the nodemcu runs at 3.3 volts, you should be using a level shifter.

Might be a problem with the library, there are a lot of LiquidCrystal_I2C libraries using the same file names, so hard to tell whether the one you have is compatible with a nodemcu.

Try using the hd44780 library (it should be in the library manager in the IDE), and run the FIle > Examples > hd44780 > ioClass > hd44780_I2Cexp > I2CexpDiag sketch. That will give you a lot of info in the serial monitor as well as on the LCD display.

I tried changing parameters in Wire.begin() to D2 and D1 for SDA and SCL connections instead of 2 and 0.
It worked for me now!

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);  // updated the address after scanning the I2C

void setup(){
  Wire.begin(D2,D1);
  lcd.begin(16, 2);   // initializing the LCD
  lcd.home();
  lcd.backlight(); // Enable or Turn On the backlight
  lcd.print("Hello World"); // Start Printing
  delay(1000);
}

chauhannaman98:
I tried changing parameters in Wire.begin() to D2 and D1 for SDA and SCL connections instead of 2 and 0.
It worked for me now!

I didn't even notice the Wire.begin, generally that is done by the LCD library and defaults to the hardware I2C.

D1 and D2 are the default pins for an NodeMCU. Using 2 and 0 was never correct.

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