In this article, you will be able to learn about how to Interface PCF8574 I2C LCD with ESP8266 NODEMCU motherboard. Here you will also learn about the PCF8574 I2C LCD working method and coding system.
Before going ahead you must know about PCF8574 I2C LCD Module and LCD Display. Here a question arises that what is PCF8574 LCD. So the answer is that the PCF8574 I2C LCD is a unique designed module with lengths of 16×2 and 20×4 LCD Display with shows different readings.
Let’s know a little bit about ESP8266 nodemcu. It is the best motherboard ever developed for the Internet or online applications. The main thing in this pin is the GPIO Pins ????. For SPI Flash IC and UART use all the GPIO related pins are removed and then 9 GPIO pins ???? can be used for free.
But in this DIY project ESP8266, NodeMCU uses 6 GPIO pins ????. Even if the communication mode is in 4-bit parallel mode. The distribution of the 6 GPIO pins is explained as four pins are used for Data, one for RS and one for E.
NOTE ????: If you had planned to use other important sensors and devices for this project then the number of GPIO pins must be reduced as using that many pins for the LCD display is not possible.
After using other sensors the I2C LCD Module can be fully used, as its unique designed LCD Display and communication process take place through the I2C interface. As a result instead of 6 GPIO Pins 2 pins are used which are named as SDA and SCL of I²C.
A Brief Look at PCF8574 I2C LCD Module
As the article clearly shows the headline of today’s DIY project, you should know that the PCF8574 I2C LCD Module is designed on the basis of PCF8574 GPIO Expander IC. Actually, the expander is used for the expansion of a microcontroller and it also controls its communication with it through the I2C interface.
Another characteristic of the I2C LCD Module is to show the result of the experiment on the LCD or to drive the characters on LCD. It also has a connection or designed potentiometer for contrast management and a jumper for controlling Backlights.
ESP8266 NodeMCU I2C LCD
Let’s get started with the actual DIY project working method. If you guys have read our other articles then you must know that ESP8266 NodeMCU pins D1 and D2 are known as GPIO 5 and GPIO 4. These pins are mostly used for I²C communication purposes.
D1 or GPIO 5 = SCL Pin D2 or GPIO 4 = 0SDA Pin
Both these pins are used to connect with the PCF8574 I2C LCD Module.
For connecting purposes, LCD should be simply plugged into these pins and supply power for display purposes.
The given diagram shows the connections between the I2C LCD Module and ESP8266 NodeMCU.
I2C LCD Module
D2 – GPIO 4
D1 – GPIO 5
NOTE: The LCD display needs a power supply between 4.7 V to 5.3V, PCF8574 IC required power supply is 2.5 V to 6V, from NodeMCU 5V power, is supplied instead of 3.3V.
LCD Module 16×2
Character LCD Display
The given image shows ESP8266 NodeMCU I2C LCD Interface.
Preparing Arduino IDE
For the completion of this DIY project you need to know some of these Preparing steps to avoid errors and to give perfection ???? and if you have never used the I2C LCD Module before then follow the steps.
STEP 1: Open Arduino IDE
STEP 2: Click on Tools -> then go to manage libraries.
STEP 3: Now in the searching bar type ” LiquidCrystal_I2C ” library by Frank de Brabander.
Getting the Slave Address of I2C LCD Module
Before going ahead let une tell you that slave address is most important code for displaying on LCD. If you are an expert then you must know that main basic of I2C communication is that if a master had to communicate with a slave only if slave address is known.
In this DIY project the ESP8266 NodeMCU is the master and the PCF8574 I2C LCD Module is the slave.
So, use the given code to get the slave address of LCD Module. After completing all the necessary setup, add the code to Interface PCF8574 I2C LCD with ESP8266 NodeMCU and open the Serial Monitor.
Here is the code text,
byte error, address;
Serial.println("Scanning for I2C Devices…");
I2CDevices = 0;
for (address = 1; address < 127; address++ )
error = Wire.endTransmission();
if (error == 0)
Serial.print("I2C device found at address 0x");
if (address < 16)
else if (error == 4)
Serial.print("Unknown error at address 0x");
if (address < 16)
if (I2CDevices == 0)
Serial.println("No I2C devices found\n");
The system works by detecting or searching for any slave and when it’s slave is acknowledged, the ESP8266 will scan its address and will print it on serial Monitor.As from the imaged you can clearly see that the slave address is 0×3F in my case. This code is used as main code.
Displaying Simple Text
While further moving ahead with the step wise process, now let’s see how simple text is displayed on 16×2 LCD. No extra connection are needed.
In this project small circuit is also created by joining 10 KΩ Potentiometer to ADC pin of NodeMCU and shows the result of ADC on LCD using the I2C LCD Module.
As the ESP8266 has specified quality as it’s ADC has a revolution of 10-bit so it’s output range will relay between 0 to 1023.
NOTE : you should know that ESP8266 had only ADC Channel , as on NodeMCU Board, A0 is the number of ADC Pin. The 10 KΩ Potentiometer of the wiper pin is attattached with A0 of NodeMCU and at the same time other two pins of the potentiometer are attached to 3.3V and GND.
WARNING: POT can only Tolerate voltage upto 3.3V, so be careful with connecting POT with ESP8266 ADC.
The given below images shows the connections of Potentiometer to ESP8266 NodeMCU and also displaying the ADC result on the I2C LCD.
#define analogPin A0 /* ESP8266 Analog Pin ADC0 = A0 */
int adcValue = 0; /* Variable to store Output of ADC */
LiquidCrystal_I2C lcd(0x3F, 16, 2);
lcd.print("ADC Value = ");
adcValue = analogRead(analogPin); /* Read the Analog Input value */
lcd.print("ADC Value = ");
After reading this article with full attention and by following the step you might have a complete project in your hands now. You did a great job by going through all this complex process, now thing might be easy for you and you had also learnt uses and importance of Interface PCF8574 I2C LCD with ESP8266 NodeMCU and works.
For any kind of difficulty comment down below or contact us through email ???? ????.
Aizaz was the first person to get a byline on his blog on technology from his home in Bannu in 2017. Then, he went on to a career in breaking things professionally at my electric sparks which is where he eventually took over the kit as a hardware editor. Today, as the senior editor of hardware for my electric sparks, he spends time reporting about the most recent developments in the hardware industry and technology. If he's not reporting on hardware or electronics, you'll see him trying to be as remote from the world of technology as possible through camping in the wild.