---
title: How to Connect an LCD Display to ESP8266 NodeMCU
description: Tutorial demonstrating how to connect an LCD display to an ESP8266 NodeMCU dev kit and display text.
---

[All Things IoT | Losant Blog ](https://www.losant.com/blog)

# [How to Connect an LCD Display to ESP8266 NodeMCU](https://www.losant.com/blog/how-to-connect-lcd-esp8266-nodemcu)

 Written by [Brandon Cannaday](https://www.losant.com/blog/author/brandon-cannaday) | Wed, Jun 22, 2016

LCD Displays are a fast and inexpensive way to display simple information. This tutorial will demonstrate how to connect a 16x2 LCD display using I2C to an ESP8266 NodeMCU dev kit.

The LCD display I'm going to use is fairly common and can be picked up for a couple of bucks [from Amazon](https://www.amazon.com/gp/product/B0182N00LU). It uses I2C to communicate with the NodeMCU. I2C is nice because it only required two wires for communication.

## Wiring

Connecting the LCD display to the NodeMCU dev kit is pretty straightforward. Below is the wiring diagram and each connection is listed below.

- Connect the GND pin on the LCD display to one of the GND pins on the NodeMCU.
- Connect the VCC pin on the LCD display to the VIN pin on the NodeMCU. The VIN pin on the NodeMCU is tied directly to the 5V pin on the incoming USB port. If you plan on powering the NodeMCU with something other than USB, you'll have to find another way to provide 5V to the display.
- Connect the SDA pin on the LCD display to the D2 pin on the NodeMCU.
- Connect the SDL pin on the LCD display to the D1 pin on the NodeMCU.

## The Code

Thanks to the [LiquidCrystal_I2C library](https://github.com/marcoschwartz/LiquidCrystal_I2C), communicating with these displays is simple. First use the Arduino's library manager to the install the LiquidCrystal_I2C library if you haven't already.

Below is the entire sketch required to write "Hello World" to the display. I'll explain the details after.

``

The first thing we do is construct a LiquidCrystal_I2C object and pass it the I2C address, width in characters, and height in characters. The address is likely always 0x3F for NodeMCUs. If you apply these instructions to other types of boards, the address may be different. Arduino provides an example sketch that [scans for I2C addresses](http://playground.arduino.cc/Main/I2cScanner) if you're having difficulty finding it.

The LCD display works by first moving the cursor to where you want to start and then printing some characters. In my example, I wanted HELLO and WORLD to be centered on each line. For "HELLO", the cursor needed to be 5 characters from the right and zero characters down, so I moved it (5, 0). For "WORLD", I needed it to be 5 characters to the right and one character down, so I moved it (5, 1).

<https://www.losant.com/university?utm_campaign=LosantU&utm_source=HOW%20TO%20CONNECT%20AN%20LCD%20DISPLAY%20TO%20ESP8266%20NODEMCU>Now that you have the basics, you can start using your LCD screen to display any information you want. For example, you could [display the weather forecast](https://www.hackster.io/TheReddest/photon-powered-lcd-forecast-and-time-display-32bab4). If you have any questions or comments, feel free to leave them below or in our [forums](https://forums.losant.com).

Want to learn more? Check out these other ESP8266 tutorials:

- [Getting Started With the ESP8266 and DHT22 Sensor](https://www.losant.com/blog/getting-started-with-the-esp8266-and-dht22-sensor)
- [Getting Started with PlatformIO and ESP8266 NodeMCU](https://www.losant.com/blog/getting-started-with-platformio-esp8266-nodemcu)
- [Making the ESP8266 Low-Powered With Deep Sleep](https://www.losant.com/blog/making-the-esp8266-low-powered-with-deep-sleep)
- [Top 6 ESP8266 Modules for IoT Projects](https://www.losant.com/blog/top-6-esp8266-modules)

[View full post](https://www.losant.com/blog/how-to-connect-lcd-esp8266-nodemcu)

```json
{
  "@context" : "http://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Brandon Cannaday"
  },
  "dateModified" : "2022-04-11T17:25:55.430Z",
  "datePublished" : "2016-06-22T21:29:25Z",
  "headline" : "How to Connect an LCD Display to ESP8266 NodeMCU",
  "image" : {
    "@type" : "ImageObject",
    "height" : 600,
    "url" : "https://cdn2.hubspot.net/hubfs/742943/nodemcu-with-lcd-display-1.jpg",
    "width" : 1200
  },
  "mainEntityOfPage" : "https://www.losant.com/blog/how-to-connect-lcd-esp8266-nodemcu",
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "height" : 60,
      "url" : "/hs/hsstatic/content_shared_assets/static-1.4092/img/default-amp-logo.png",
      "width" : 60
    },
    "name" : "All Things IoT"
  }
}
```