I have been coding Esp32 Devkit V1 & NodeMCU V3 and trying to get data from sensors connected to i²c bus of those two MCU separately. But both cases the sensors are not initializing. But I have tried these sensors on my Arduino uno R3 which worked fine. But When it comes to ESP32 and NodeMCU V3 i²c bus don't work. I have checked with the i²c code and it detects the sensors, but when I upload the original code, it doesn't work.
Here are few steps that I took to make things work
Added 3k ohm external pull-up resistor on SDA and SCL
Changed to default pins like 21, 22 in case of ESP32-Devkit and 4, 5 in case of NodeMCU V3 to other pins, doesn't work!
Checked the wifi connection which works fine and sends -2 lux value to thingspeak. But other two BMP280 & AHT10 sensor doesn't work.
Connected a led to check whether sensors are getting power or not. The led shows the sensors are getting power.
I moved your topic to a more appropriate forum category @mahadi1234.
The Nano ESP32 category you chose is only used for discussions directly related to the Arduino Nano ESP32 board.
In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.
I assume this means that when you test individual I2C devices they work OK but when you try the complete system it fails??
how are you powering the I2C devices ? what voltage? you may be overloading the ESP32 module power supply
I have had SSD1306 working with a ESP32-DevKit-1 and a BMP280 working to a NodeMCU V3
Yes, you're correct. Esp32 detects the sensor modules in I2C scan. For powering the sensor I used the 3v3 pin of ESP32, Voltage 3.3v . Also attached a led to check whether it getting power like the picture. Even though I coded for 2 sensor and OLED but only using one sensor to check till now. But no response till now.
You have to solder the pins of the BH1750 module. As far as I know, there is no one with a working project with pins that are not soldered.
The led on the breadboard needs a resistor. A led may not be connected directly to 3.3V or 5V.
Are you powering the BH1750 module with 3.3V or 5V. If you power it with 3.3V and it goes through the voltage regulator, then the BH1750 could be running at 2.3V.
I will try with external 5V then. I didn't solder yet cause it worked really ok with my Arduino uno r3 so far. But yes soldering is important no doubt, I will do.
Very important.
If you're lucky, those pins may make contact - but it's unreliable. Solder them and you have one potential point of failure less.
That BH1750 board has a component that looks like a linear regulator; it may also have separate pins for 3.3V and 5V power input. Make sure you use the correct connections.