I tried to connect 1602a with NodeMCU (ESP8266) .
Connected Vcc pin on I2C (16x2) to Vin Pin on NodeMCU
Connected Gnd pin on I2C (16x2) to G Pin on NodeMCU.
Powered NodeMCU through USB cable connected to my laptop. No power/backlight appears on the 1602A LCD Screen.
However, when I connect Vcc pin on I2C (16x2) to 3V pin on NodeMCU and Gnd pin on I2C(16x2) to G pin on NodeMCU the 1602 and I2C power ups, but no display or black boxes appear on the LCD screen.
I don't know what I am doing wrong. Please help.
Hi, aminshaikh25_pk
You may connect as follows:
---> RED wire on display to 3V on NodeMCU
---> BLACK wire on display to GND on NodeMCU
---> ORANGE wire on display to D2 on NodeMCU (this pin should be marked SDA on your display)
---> YELLOW wire on display to D1 on NodeMCU (this pin should be marked SCL on your display)
If correct the display screen will light up. Now you must upload a sketch.
Try this one:
// I2C_hello_world_20x4_LCD_basic
// public domain
// for a 20×4 16-pin Hitachi HD44780 compliant LCD display
// works also with 16×2 LCD display – change lcd.begin and the cursor positions
// SDA of display to D1 of NodeMCU
// SCL of display to D2 of NodeMCU
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
void setup() {
lcd.begin(20,4); //initialize the lcd
lcd.clear();
}
void loop() {
lcd.setCursor(2,1);
lcd.print ("Hello! ");
lcd.setCursor(10,2); // start on the eleventh position of the third line of the display
lcd.print("World!");
delay (1000);
for (int j=0; j<4; j++){
lcd.setCursor(00,j);
lcd.clear(); // clears the line where the cursor is positioned
}
delay(500);
}
Good luck!
You may connect as follows:
---> RED wire on display to 3V on NodeMCU
---> BLACK wire on display to GND on NodeMCU
---> ORANGE wire on display to D2 on NodeMCU (this pin should be marked SDA on your display)
---> YELLOW wire on display to D1 on NodeMCU (this pin should be marked SCL on your display)
The library code will work. But you will not see anything because the contrast pin can not be adjusted to a suitable voltage.
You can check the library code by switching the backlight on and off.
The backpack is designed for 5V power. And the I2C pullups pull up to 5V (which is bad for your 3.3V NodeMcu)
Remove the backpack pullups and connect external 4k7 pullups to 3.3V.
Add two external 10k pulldowns on the breadboard. e.g. 10k between SDA and 0V. 10k SCL, 0V
Connect backpack VCC to 5V i.e. VIN pin. Adjust contrast pot.
David.
Edit. It is probably easier to add two external 10k pulldowns instead of un-soldering the backpack 4k7 pullups. This will ensure that the I2C signals remain safely within the 0V .. 3.3V range.
Thank you all. I got this working by connecting SDA and SCL to D1 and D2. But power comes from Vu to Vcc on I2c not from Vin as told by many tutorials on internet. Setup the potentiometer at the back of I2C and voala. It is working like a charm.
Thanks anyway.
aminshaikh25_pk:
... power comes from Vu to Vcc on I2c not from Vin as told by many tutorials on internet.
What voltage is present on the Vu pin?
If it is more than 3v i.e. 5v, you risk that the esp8266 may be damaged since it is 3v part and if you send 5v to the i2c backpack, the pullups on the backpack will be pulling up to 5v which means that i2c signals are above the esp8266 maximum input voltage.
When I use 5v i2c devices with the esp8266, I use a voltage converter, so there are no issues with the 3v esp8266 master and a 5v slave.
They are cheap, and work reliably.
--- bill