NodeMCU LCD Tutorial Using I2C Module

Hey guys, hope you are doing fine. Are you searching for the working of a 16×2 LCD display with NodeMCU? If yes then this article is for you in which we are going to display some text on the 16×2 LCD using a NodeMCU esp8266 board. We are using an I2C module here which helps us to reduce the number of GPIO pins. Check how you can set up your NodeMCU with the Arduino IDE application and start to program it. Basically, NodeMCU is a microcontroller board used to develop IoT projects with a built-in wifi module. A 16×2 LCD can display 16 alphanumeric characters in a single line and it has a total of two lines only. You can use it directly with the board but it is easy if you connect an I2C module with it. If you like this project, you can also check more amazing projects on NodeMCU.

How Does nodemcu lcd works?

This project can display the text given to it. You can use our article on the I2C scanner to check the address of the I2C module you are using. We are able to display the text on the LCD by using the print function and pass the content which is going to be displayed as the parameter value of the function. Set the location of the content by using setcursor function. You can change the content as per your need by modifying the given code. You can also check out our project on home automation using NodeMCU. Some pictures of the project that we made are given below. Connect the USB cable to provide power to the board and you will see the text on the LCD screen.

nodemcu lcd

nodemcu lcd

Components Required

  • NodeMCU esp8266 board
  • 16×2 LCD
  • I2C module
  • Breadboard
  • Jumper wires
  • USB cable for uploading the code

Circuit Diagram nodemcu lcd

nodemcu lcd

Mount the NodeMCU board on a breadboard so it is easy to make connections. You have to make the circuit according to the diagram given above. Attach the Pins of the I2C module with the 16×2 LCD. Connect the VIN or 3.3-volts pin of the NodeMCU with the VCC pin of the I2C module and the GND pin of the NodeMCU with the GND pin of the I2C module. Join the SDA pin of the I2C module with the digital-2 pin of the NodeMCU. Connect the SCL pin of the I2C module with the digital-1 pin of the NodeMCU.

NodeMCU LCD code

NOTE: Please upload the code given below to the NodeMCU. Before compiling the code you have to install <Wire.h> and <LiquidCrystal_I2C.h> libraries to the Arduino IDE. If you don’t know how to install a zip library to Arduino IDE then check it here.

 #include <Wire.h>           
 #include <LiquidCrystal_I2C.h>    
 LiquidCrystal_I2C lcd(0x3F,16,2);   
 // if lcd is not print then use this 0x27..  
 void setup()  
 void loop()   
   lcd.print("   Helo  ");  
   lcd.print("  Friend ");  

We hope that now you are familiar with the working of a 16×2 LCD with NodeMCU. Please try it now on your own. If you are facing any problems while making then do inform us in the comments section below. Check out more tutorials on Arduino and Raspberry Pi uploaded by us.