Multiple bh1750

In my Arduino Uno R3, i connected 2 BH1750, 2 DHT22, 1 TSL2561, and 1 MG995 servo(with external power).

All works fine except the BH1750. Both of them are VCC - 5V. The BH1750 #1 ADD to 5V, while BH1750 #2 ADD to GND.

I expected them to have independent readings. Yet, both on my serial monitor, they have the same readings.

I tried flashing light on #1, but the data logs in the serial monitor doesnt change. I tried flashing light on #2 now BOTH of their data logs changed. Meaning, they are not independent on each other. I swapped their respective ADD pins, now BH1750 #1 ADD to GND, now only #1 reflects the readings from my flashlight, while #2 relies on the other's reading.

Please help. How can i make them independent from each other. The ADD on 5V doesnt work. This is for my thesis. Send helppp :<

Hi, the chip is 3v so hopefully your BH1750 has a regulator. Try connecting your addr pin to the 3v pin on BH1750 board if it has one

(post deleted by author)

From the schematic posted by Adafruit the board is 5V compatible, the regulator and level translators are on the module. What does the I2C scanner tell you? Can you post your annotated schematic, be sure to show all power, grounds, power sources and note any lead over 25cm/10ā€.

Hey guys, its working now. The problem was because my code relied on the bh1750 library's single object reads. I used a raw wire commands for both sensors instead.

Congratulations.

Now finish the job by clicking soloution on the post that gave you the greatest help. The help given so that you could spot your error.

But that's a complex solution, especially for beginners. It should be possible to use the library to read both sensors correctly.

Post your code from when you were using the library and the forum can show you how to use the library to read both sensors.

You would have to start 2 instances with the begin function.

From the library:

BH1750_TO_GROUND = 0x23,
BH1750_TO_VCC = 0x5C

From examples:

bool avail01 = BH1750.begin(BH1750_TO_GROUND);
bool avail02 = BH1750.begin(BH1750_TO_VCC);