Another illustration that demonstrate how to wire the i2c 16×2 LCD on ESP8266 12 Known as NodeMCU, as you can see the diagram below the SCL as Arduino Analog Pin A4 is connected to D1 on NodeMCU at the same time the D2 as the SDA represent as Analog Pin A5 on Arduino Board, As you may notice that the sketch code that we used it is not LUA script it is actually standard Arduino C compiled/Interpret by Arduino IDE. If you don’t have an ESP8266 runs on Arduino IDE please follow this link.
Required Devices
- NodeMCU 12,12E
- LCD16x2 on i2C Module
- Jumper Wires / DuPont Wires
Wiring Diagram
Note: Some 16×2 LCD display module required 5v vcc.
Sketch Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
/* 14CORE NodeMCU i2C 16x2 LCD SCREEN Test COde......................... */ #include <Wire.h> // This library is already built in to the Arduino IDE #include <LiquidCrystal_I2C.h> //This library you can add via Include Library > Manage Library > LiquidCrystal_I2C lcd(0x3F, 20, 4); void setup() { lcd.init(); // initializing the LCD lcd.backlight(); // Enable or Turn On the backlight lcd.setCursor(0, 1); lcd.print("14CORE | 16x2 LCD TEST"); // Start Print text to Line 1 lcd.setCursor(0, 2); lcd.print("-----------------------"); // Start Print Test to Line 2 } void loop() { // Nothing Absolutely Nothing! } |
Wiring NodeMCU ESP8266 12E with i2C 16×2 LCD Screen
Hello 14core, i’m doing everything you said and the screen turn on, but it doesn’t show anything. There is a step that i missed?
Greetings!
Hi, you must use a 5V power supply instead 3.3V as shown on the wiring diagram. Them set a contrast by small potentiometer on botom of I2C expander.
LiquidCrystal_I2C lcd(0x3F, 20, 2);
—————————————————————————————
LiquidCrystal_I2C lcd(0x3F, 20, 4); < — check your i2c address
I2C Address: 0x3F
lcd.begin (16,2); // Change this to 16,4 if your using 16×4 LCD Display
I have one line full of blocks and one empty line. thx
Check your I2C Module if it is soldered properly, check also your voltage supply if does not support with 3.3v used 5v ground should be connected to common ground must try to use transistor to isolate the flow. don’t forget your i2C address of your module which is attach to your LCD. most module works on (0x3F);
did you set the proper contrast?
Use and Arduino I2C scanner to find the address of your LCD board.
Hi, trying to compile I get thise error:
fatal error: avr/io.h: No such file or directory
Can u help me?
Tks
Fatal Error: AVR/IO.h come from your IDE check your ESP8266 Arduino IDE integration, make it sure you select the proper board on your board manager along with the required libraries.
Can I just copy and past this code in my sketch?
Sharing my working code for the above
https://gist.github.com/vikrant2mahajan/031205cf690967fc69ba3197c4e6e587
Thanks for sharing :)
Your diagram is wrong. D2 = A4 (SDA) and D1 = A5 (SCL)
Right > SCL > D5 | SDA > D7 | GND > GND | VCC > 3.3V
It woesn’t work with 3.3v, you need have 5 volts for display. I spent 3 days until I found that, so could you mention that in your guide, thanks
my d2 pin is already pinned to another thing. can i use other digital pins instead? like d0 or d3
Hi 14 Core,
I’m using an ESP8266 12E NodeMCU with an LCD2004 20×4
I’m using your code, the screen turns on but I don’t see any Text on it. I have set the contrast to the maximum.
Could you please help.
Thank you