Introduction: 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

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

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!