Interface I2C LCD Using NodeMCU

57,086

48

11

Introduction: Interface I2C LCD Using NodeMCU

About: " Work until you no longer have to introduce yourself " Show some love on Instagram @makers_bee & Motivate me on YouTube @MakersBee

Wassup Makers!!

In this Instructables we will learn how to interface an LCD (Liquid Crystal Display) to the NodeMCU board.

These 16x2 LCDs are very popular and broadly used in electronics projects as they are good for displaying information like sensor data from your project, and also they are very cheap.

Step 1: Things Needed

We need few components to get started with the Instructable,

Hardware Components

  • NodeMCU
  • 16x2 LCD
  • I2C Board
  • Breadboard
  • Jumper Wires
  • Micro USB Cable

Software Components

  • Arduino IDE

Step 2: Circuit Connection

Connecting LCD to I2C and then interfacing it to NodeMCU is very simple.

The LCD’s registers from D0 to D7 and Vcc, GND, RS, R/W pins will be connected to I2C.

GND pin of I2C is connected Ground pin (GND) of the NodeMCU.

VCC pin of I2C is connected Vin pin of the NodeMCU. (Because we need to supply 5v to LCD)

SDA pin of I2C is connected D4 of the NodeMCU.

SCL pin of I2C is connected D3 pin of the NodeMCU.

Before you get started with coding you need Arduino IDE.To download Arduino IDE and for NodeMCU setup, you can check my previous instructacle.

"Interfacing Servo Motor With NodeMCU"

Step 3: Coding Time Begins

#include <Wire.h>

#include <LiquidCrystal_I2C.h>

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

First thing we need to do is to insert the Liquid Crystal Library. We can do that like this:

Sketch > Include Library > Manage Libraries > LiquidCrystal_I2C LCD

Download the "LCD.ino" file and open it up in the Arduino IDE.

Then Create a new sketch and paste the code below in the Arduino IDE and hit Upload You can tinker with the code to make it more useful or just use it as it is.

Attachments

Step 4: Output

Now, you can develop this instructable to all your sensor based projects and implement in many other applications.

That's all makers!

I hope you found this instructable most useful. You can contact me by leaving a comment. If you like this instructable probably you might like my next ones.

Makerspace Contest 2017

Participated in the
Makerspace Contest 2017

1 Person Made This Project!

Recommendations

  • On a Stick Speed Challenge

    On a Stick Speed Challenge
  • Summer Fun: Student Design Challenge

    Summer Fun: Student Design Challenge
  • Colors of the Rainbow Contest

    Colors of the Rainbow Contest

11 Comments

0
KvajayK
KvajayK

1 year ago

made connection same, code loaded , but not working. no display.

0
KvajayK
KvajayK

Reply 1 year ago

anybody please help..

WhatsApp Image 2020-03-10 at 5.40.46 PM.jpegWhatsApp Image 2020-03-10 at 5.40.47 PM.jpegWhatsApp Image 2020-03-10 at 5.40.46 PM (1).jpeg
0
KvajayK
KvajayK

Reply 1 year ago

anybody can help , i dont know , where i made mistake.. done connect and code as per the above procedure , but not working.

0
rehmanrao123rao7
rehmanrao123rao7

1 year ago

there is an error
exit status 1
within this context

0
HafijulH
HafijulH

1 year ago

Can you please specify the Library name with programmer or library link . Using NodeMCU version 1 Not Working

0
jaseemec
jaseemec

Question 2 years ago

how to interface non i2c 16x2 lcd to nodemcu without shift register ICs.

0
WaelS19
WaelS19

2 years ago

I have the same question as JesusM173. Where do you get the library? I downloaded one from another site and i keep getting the error below.

invalid conversion from 'int' to 't_backlighPol' [-fpermissive]

0
JesusM173
JesusM173

Question 2 years ago on Step 3

he copiado el programa en un nodemcu v3 de lolin en el IDE y cuando lo clequeo me aparece el siguiente error: Tampoco me funciona lo de dar corriente a traves del pin Vin a la lcd, le proporciono corriente a traves de un pin 3,3V

Arduino:1.8.5 (Windows 10), Tarjeta:"NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"
Opciones de compilación cambiadas, reconstruyendo todo
C:\Users\MORGAN\Downloads\LCD\LCD.ino: In function 'void setup()':
LCD:14: error: 'class LiquidCrystal_I2C' has no member named 'init'
lcd.init(); // initializing the LCD
^
exit status 1
'class LiquidCrystal_I2C' has no member named 'init'
Este reporte podría tener más información con
"Mostrar salida detallada durante la compilación"
opción habilitada en Archivo -> Preferencias.

1
JesusM173
JesusM173

2 years ago

Cual es la url para descargar la librería liquidcrystal_i2c?

0
ArthurM99
ArthurM99

Question 3 years ago

Hi,

How do you make your circuit diagrams?

0
CodeChamp
CodeChamp

Answer 3 years ago

I use Adobe Photoshop. : )