Display text on I2C LCD display via ESP8266 NodeMCU

ESP8266 14-10-25
23 0

Tutorial plan

1- Objective of the tutorial

2- The necessary components

3- ESP8266 Assembly with I2C LCD Display

4- Program ESP8266 NodeMCU with MicroPython

 

 

Objective of the tutorial

The objective of this tutorial is to learn how to display text messages on an I2C LCD display using the ESP8266 NodeMCU board.

Through this tutorial, you will understand how to connect the I2C LCD module to the ESP8266, install the necessary MicroPython libraries, and write a program to display and control text output.

By the end of this tutorial, you will be able to:

- understand the I2C communication protocol used by the LCD module.

- correctly wire the I2C LCD display to the ESP8266 NodeMCU board.

- write a MicroPython script to initialize the LCD and display custom messages.

- modify the program to scroll or update the text dynamically on the LCD screen.

 

The necessary components

1- ESP8266 NodeMCU Board

The ESP8266 NodeMCU is a Wi-Fi–enabled microcontroller board based on the ESP-12E module.

In this tutorial, it serves as the main controller that communicates with the I2C LCD display to send text for visualization.

2- I2C LCD Display (20x4)

The I2C LCD display is a character LCD module that can display text, symbols, and messages.

The “I2C” version includes a small adapter module (usually based on the PCF8574 chip), which allows communication using only two wires (SDA and SCL) instead of multiple data pins.

This simplifies wiring and saves GPIO pins on the ESP8266.

3- Breadboard

plaque d'essai

A breadboard is a prototyping platform used to connect components without soldering.

It helps in building temporary circuits by inserting jumper wires and module pins into its holes, making it ideal for testing and experimenting.

4- Jumper Wires

Fils de connexion

Jumper wires are flexible connectors used to make electrical connections between components on a breadboard.

In this tutorial, they connect the SDA, SCL, VCC, and GND pins of the LCD to the respective pins on the ESP8266 NodeMCU.

 

ESP8266 Assembly with I2C LCD Display

1- Connect the GND pin of the display to the GND pin of the ESP8266 board

2- Connect the VCC pin of the display to the VIN pin of the ESP8266 board

3- Connect the SDA pin of the display to the D2 (GPIO4) pin of the ESP8266 board

4- Connect the SCL pin of the display to the D1 (GPIO5) pin of the ESP8266 board

 

Program ESP8266 NodeMCU with MicroPython

The program initializes the LCD, communicates via the I2C protocol, and displays a custom message.

Required libraries : i2c_lcd and lcd_api → to display information on the I2C LCD screen.

 

Code Explanation

- I2C(scl=Pin(5), sda=Pin(4)) initializes I2C communication on the ESP8266 pins D1 and D2.

- I2cLcd(i2c, I2C_ADDR, 2, 16) creates an LCD object with 2 rows and 16 columns.

- lcd.putstr() writes a string on the display.

- lcd.clear() clears the screen.

- The while loop demonstrates how to scroll a message across the LCD.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info