claws / BH1750

An Arduino library for the digital light sensor breakout boards containing the BH1750FVI IC
MIT License
248 stars 107 forks source link

BH1750 readLightLevel() eventually returns 27k value in low light environment #85

Open BenjamimKrug opened 1 year ago

BenjamimKrug commented 1 year ago

I'm working with a custom PCB with an ESP32 Wroom and a BH1750 and using this library to make the readings, most of the times it works perfectly, however eventually the readLightLevel function returns 27 thousand lux, even though it's in a very low level light environment, normally 15 lux. This happens when the I2C clock is at 100k, but doesn't happen in 400k, which seems kinda strange to me, usually the problems happen at higher frequencies, so I think it might be a good idea to see what could be the root of the problem. Ideally I would like to use 100k since the I2C cable is reasonably long, 25cm. Thank you in advance, and congrats on the great library.

coelner commented 1 year ago

You could use temporarily an other library to check whether it is a problem of this library.

Otherwise you can use any cheap logic analyzer (e.g. https://sigrok.org/wiki/Supported_hardware#Logic_analyzers) to sniff the i2c lines. As you use a custom pcb, did you use the bare BH1750 with it? Or do you use the common BH1750 module and have this one conncted?