Hey, I'm trying to use the LCD 16x2 using an I2c module, I believe I've wired it correctly vcc to vin gnd to gnd SDA to D21 and SCL to D22. I'm using an ESP32. But whenever I run the code it shows no I2C device found.
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(115200);
Serial.println("\nI2C Scanner");
}
void loop() {
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ ) {
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address<16) {
Serial.print("0");
}
Serial.println(address,HEX);
nDevices++;
}
else if (error==4) {
Serial.print("Unknow error at address 0x");
if (address<16) {
Serial.print("0");
}
Serial.println(address,HEX);
}
}
if (nDevices == 0) {
Serial.println("No I2C devices found\n");
}
else {
Serial.println("done\n");
}
delay(5000);
}
1. I have run your scketch as it is in mt ESP32-I2cLCD setup and it has found by I2CLCD.
12:55:40.192 -> Scanning...
12:55:40.192 -> I2C device found at address 0x27
12:55:40.192 -> done
12:55:40.192 ->
2. You have made a worng connection. Shift Vcc-wire of I2CLCD from VIN-pin to 3.3V pin of ESP32.
3. VIN is an input pin to receive external power supply (7V - 9V) from Battery or Adapter for the operation of ESP32 Board at the absence of USB connection with PC. this 7V - 9V supply is converted into 3.3V by an onboard regulator.
4. I suspect if LCD will ever be illuminating enough with 3.3V supply of ESP32. If problem, 5V supply (from another source) is to connected with Vcc-pin of LCD and LCD's GND-pin should be common connection with 5V supply and ESP32's GND-pin.
In theory it should work.[EDIT] No, it doesn't. See the posts below
I'm a little worried about the soldering of the backpack to the display. Are you sure that everything makes contact ?
Jumper wires can be broken. Can you check the wires ?
Do you have a 5V Arduino board ?
Those LCD displays are for 5V Arduino boards. They should get at least 4.5V power to work.
An OLED display is for 3.3V boards.
Hey, I'm out of the I2C problem the code dos find the address 0x27 yet I've come upon with another problem that's the LCD isn't showing the text.
// #include < Wire .h> we are removing this because it is already added in liquid crystal library
#include <LiquidCrystal_I2C.h>
// Create the lcd object address 0x3F and 16 columns x 2 rows
LiquidCrystal_I2C lcd (0x27, 16,2); //
void setup () {
// Initialize the LCD connected
lcd. begin ();
// Turn on the backlight on LCD.
lcd. backlight ();
// print the Message on the LCD.
lcd. print ( "CIRCUITSCHOOLS." );
}
void loop () {
//Here cursor is placed on first position (col: 0) of the second line (row: 1)
lcd. setCursor (0, 1);
// We write the number of seconds elapsed
lcd. print ( millis () / 1000);
lcd. print ( "SECONDS" );
delay (100);
}
Check that the connection between ESP32 Dev Module and I2CLCD agrees with the following diagram (Fig-1, not tested)). I would like to suggest you using a level shifter as ESP32's pins are not 5V tolerant; whereas, SDA line might be pulled up at HIGH (5V) logic during the assertio of ACK signal.
In my 30-pin ESP32 Dev Module (Fig-1, post #9), the pin marked as VIN and NOT 5V. Op is using also the same borad (post #1). The link you have given in post #7 correspond to a 38-pin ESP32 Board which has a 5V (probably output pin!).