Introduction: I2C LCD on NodeMCU V2 With Arduino IDE

Picture of I2C LCD on NodeMCU V2 With Arduino IDE

In this quick instructable I'll show you how to lunch LCD with I2C Serial Adapter on NodeMCU v2 using ArduinoIDE and available libraries.

Step 1: Required Parts and Software

Hardware:

1. NodeMCU v2

2. 16x2 LCD Display with i2c Serial Interface Adapter Module

3. Some wires, USB for power supply and sketch uploading

Software:

1. ArduinoIDE - https://www.arduino.cc/en/main/software

2. LiquidCrystal_I2C library - https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library

Step 2: Hardware Setup

Picture of Hardware Setup

Preparations:

When you order LCD from Ali/ebay you can solder 16 pin headers to LCD display in order to avoid 'wiring mess' when connecting to serial adapter

Setup:

  1. Place LCD display and Serial Adapter on bread board next to each other
  2. Connect adapter's SCL pin with NodeMCU D1 pin
  3. Connect adapter's SDA pin with NodeMCU D2 pin
  4. Connect adapter's GND, VCC pins with NodeMCU GND, Vin accordingly - here I need to explain one thing. Basically you should connect LCD display to 5v source but NodeMCU only has 3.3v outputs so the LCD is pretty dark. If you provide LCD with external 5v source you'll need to use logic level converter because it will not work. Here I used some hack using USB provided power that is bypassed to Vin. It's 5V but it works :)

Step 3: The Sketch

Picture of The Sketch

Preparations:

  1. Install ArduinoIDE
  2. Add NodeMCU support - nicely described here.
  3. Add LiquidCrystal_I2C library - please use instructions provided by author. Installation from AdruinoIDE will add outdated version


The Sketch:

#include <LiquidCrystal_I2C.h>

#include <Wire.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {

Serial.begin(115200);

//Use predefined PINS consts

Wire.begin(D2, D1);

lcd.begin();

lcd.home();

lcd.print("Hello, NodeMCU");

}

void loop() { // do nothing here }

---------------------

Upload the sketch and you're done!

Comments

YoussefD12 (author)2017-10-22

If I didn't do a hack, the usual wiring schematic would be like:

SDA (LCD) →TTL converter from 5V to 3.3V → D2.

SCL (LCD) → TTL converter from 5V to 3.3V → D1.

Vcc (LCD) → 5V (of another source).

Gnd (LCD) → Gnd (of the same other source).

Do you agree?

YoussefD12 (author)2017-10-21

What if I wanted to power the NodeMCU (I have ver 3 by the way) from 3.3V and Gnd, will NodeMCU Vin still work if connected to LCD Vcc pin?

Thanks anyway.

YoussefD12 (author)YoussefD122017-10-21

Would it be possible to use VU pin instead of Vin?

Swansong (author)2017-01-31

Thanks for sharing :)