Here I will setup & Connect LCD I2C Nodemcu ESP8266. I will Use 20×4 LCD display with a I2C module.

To see the output from Arduino, we need to connect LCD display with it. There is mainly two version of LCD display is available in the market. One is 16X2 display which has 2 lines & another one is 20X4 display which has 4 lines.

We will use 20 X 4 display in this tutorial because it has 20 characters each line. If you wish to buy, then buy this version. The process of connection will be the same for all the version.

The LCD module can be connected to an Arduino board in 3 ways:

  1. Direct connection from the LCD module to the NodeMCU without POT.
  2. Direct connection from the LCD module to the NodeMCU with POT.
  3. LCD Module and ESP8266 NodeMCU connected through an I2C Module.

I will show the 3rd process in this post.

To connect without any I2C module, follow this post, LCD I2C Nodemcu.

Connect LCD Display with Arduino without I2C Module & POT

Components Used:(Click to Buy)

Connection Setup LCD I2C Nodemcu

Connection setup is very easy compared to direct connection. We have to connect only 4 pins using the following diagram.

LCD I2C Nodemcu

Add Library LCD I2C Nodemcu

First of all, we have to download and import the Arduino-LiquidCrystal-I2C-library.
You can also search this library inside Arduino IDE Manage Library.

Code Explain of LCD I2C Nodemcu

In line 8, we are setting the the I2C address, Display character no & line no.

LiquidCrystal_I2C lcd(0x27, 20, 4)

Here the default address is 0x27. We are using 20×4 LCD display here. In line no 41 we have done a trick to clear the only last line. We have displayed 20 blank character i.e 20 times space bar in the output display.

Arduino Sketch of LCD I2C Nodemcu

/*
https://somtips.com
https://youtube.com/somtips
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 20 chars and 4 line display
LiquidCrystal_I2C lcd(0x27, 20, 4);

void setup() {

  // initialize the LCD, 
  lcd.begin();
  // Turn on the blacklight and print a message.
  lcd.backlight();
  lcd.clear();
   lcd.setCursor (0,0); //
   lcd.print("WELCOME"); 
     
   delay(5000);       
}

void loop() {

    
  lcd.clear();
  lcd.setCursor (4,0); //character zero, line 1
  lcd.print("Som Tips"); // print text  

  lcd.setCursor (0,1); //character 4, line 2
  lcd.print("Subscribe YouTube"); // print text   

  lcd.setCursor (0,2); //character 0, line 3
  lcd.print("fb/somtipsofficial"); // print text 

  while(1){
    lcd.setCursor (4,3);
    lcd.print("somtips.com");
    delay(4000);
    lcd.setCursor(0,3);
    lcd.print("                    ");

     lcd.setCursor (4,3);
     lcd.print("Visit now");
     delay(2000);
  }
      
                     
   

}

Output LCD I2C Nodemcu

LCD I2C Nodemcu