ESP32 not detecting BH1750 sensor (I2C scan shows no device)

I am using ESP32 with BH1750 light sensor.

I connected:
VCC → 3.3V
GND → GND
SDA → GPIO 21
SCL → GPIO 22
ADD->GND

Problem:
The sensor is not detected.
I2C scanner shows "No devices found".
even the ina219 sensor also does not connect.Some problem with the i2c devices only
I have already tried:

  • Changed I2C pins
  • Checked wiring
  • Tried different code
  • Reduced I2C speed
    below is the i2c scanner code i am using
    #include <Wire.h>
void setup() {
  Serial.begin(115200);
  Wire.begin();
  Serial.println("\nI2C Scanner");
}

void loop() {
  byte error, address;
  int nDevices = 0;

  Serial.println("Scanning...");

  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("Unknown 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); // Wait 5 seconds for next scan
}

the bh1750 sensor module already has inbuilt pull up resistors

Search: "esp32 i2c scanner".
One of many hits:
https://deepbluembedded.com/esp32-i2c-tutorial-change-pins-i2c-scanner-arduino/

it is difficult to see the SDA/SCL connections from your photos
check your wiring!
can you post a link to the specific BH1750 light sensor.

I see that you soldered the pinheader on the wrong side of the board, resulting in possibly too short pins on the other side to get deep enough into the breadboard.
Assuming you did solder the pins.
Leo..

Hi, @sutariyakrish
Welcome to the forum.

Do you have a DMM? Digital MultiMeter?

Tom.... :smiley: :+1: :coffee: :australia:

i have not soldered anything

https://robu.in/product/gy-30-bh1750fvi-digital-light-intensity-illumination-sensor
this is the link from where i bought the sensor

Doesn't Work

Then that's your problem.
Just poking the pins in the holes won't work.

looking again at the photos in post 1 have you connected SCL and SDA the wrong way around to the ESP32? e.g. SCL to GPIO21 (green wire) and SDA to GPIO22 (white wire)?
difficult to see in photos?