No I2C evice found

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);          
}

This is the code I'm using .


This is the connection diagram I'm using.


The LCD is on, yet the serial monitor shows no I2C device found and when I try the common address 0x27 the LCD shows nothing.

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.

Vcc on the display should go to 3v3 on the ESP32.

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.

You mean Vcc-pin of I2CLCD may work if connected with VIN-pin of ESP32?

Please look at Section-3 of post #2.

1 Like

Hey can you please share your wiring connection via a picture?

@abdulmoizs502 Here is the information for the ESP32 dev board: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html
If you scroll down, then there is a schematic.
That 5V display does not go well with a ESP32 board. Can you do your project with another display ?

@GolamMostafa O, I see. The 5V pin is power input only and it is not connected to the 5V of the USB connector. Thanks for the correction.

1 Like

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);
}

This is the code that I'm using.

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.


Figure-1:

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!).

1 Like

image

Me too....

You will need to fix those joints so that they are reliable.

Looks like not enough solder and not enough heat.

Tom... :grinning: :+1: :coffee: :australia:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.