Light Sensor BH1750 shows up with I2C Address 53

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
pickup7
New user
Posts: 6
Joined: 05 May 2022, 12:53

Light Sensor BH1750 shows up with I2C Address 53

#1 Post by pickup7 » 05 May 2022, 13:10

G'day,

bought two BH1750 from Seed via Amazon this week (1st week may 2022).
In the ESP2688 the Tools->I2C Scan detects the I2C address value 0x53 instead of expected 0x23 (Decimal 35) for the BH1750.
Build is "ESP_Easy_mega_20220328_test_A_ESP8266_4M1M Mar 28 2022.bin".

Anybody else experienced this issue lately?
Any workaround except the dirty change of changing source file locally
from
#define BH1750_DEFAULT_I2CADDR 0x23
to
#define BH1750_DEFAULT_I2CADDR 0x53
and recompile?


Thank you for a feed back
Kind regards
Uli

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Light Sensor BH1750 shows up with I2C Address 53

#2 Post by Ath » 05 May 2022, 13:29

That would be really strange, the chip either uses address 0x23 or 0x5C.
You have probably already checked the connection quality? Could it be that you have reverted the SDA and SCL pins? Or have a quite long cable ( > 1 meter)? And there are proper pull-up resistors installed on the I2C bus? (many boards have them pre-installed, usually 10k). That could be possible reasons to have issues like this.
Sometimes this can be fixed by using a lower (Slow) I2C clock speed (default setting 100 kHz instead of 400 kHz), it should at least improve for when the cable is too long. Preferred wire length for I2C is max. 30 cm.

This is the only sensor connected to the ESP? (I have to ask, as any assumption is wrong by default... ;)) The only supported sensor with I2C address 0x53 is the ADXL345 Accelerometer.
/Ton (PayPal.me)

pickup7
New user
Posts: 6
Joined: 05 May 2022, 12:53

Re: Light Sensor BH1750 shows up with I2C Address 53

#3 Post by pickup7 » 07 May 2022, 10:57

Thanx for your kind reply. The problem was in front of the screen again. Stupid me. :-)

I had connected one of the SI1145 instead and this device happens to own I2C address 0x53. As also seen in the Tools->I2C Scan.
ESPEasy did not show any available devices though.

Choosing UV_SI1145 in the Devices set up then anyway, it does not offer positive values but all stick to "0". See pic below.
The test implementation for the SI1145 is available from the Test_B version of bin files and reads "ESP_Easy_mega_20220328_test_B_ESP8266_4M1M".

The device is last in the selection list and is named UV_SI1145. The description comes here: https://espeasy.readthedocs.io/en/lates ... /P107.html
The Header Adafruit_SI1145.h used in the implementation defines address 0x60 in line 145 instead of 0x53: #define SI1145_ADDR 0x60


Since wires are connected correctly, no overlength and so on, and because the device address at least is detected properly I'd like to ask:
Is this 0x60 from this C++ header the I2C address or is it something else?
If it were a different I2C address this would probably explain why no devices are listed in the menu after the successful scan (0x53) and also why no values are reported in the Devices set up.

I have tried with two different ESP2866 and also two SI1145 - same effect...
Image

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Light Sensor BH1750 shows up with I2C Address 53

#4 Post by TD-er » 07 May 2022, 11:25

Yep it looks like that's an easy change in the source code to allow for a different address.

The better approach would be to include an I2C address selector in the plugin code for P107.
But apparently not many boards out there with that chip do use another address, so nobody ran into this issue before.

Added an issue for it: https://github.com/letscontrolit/ESPEasy/issues/4045

pickup7
New user
Posts: 6
Joined: 05 May 2022, 12:53

Re: Light Sensor BH1750 shows up with I2C Address 53

#5 Post by pickup7 » 07 May 2022, 13:17

Hi TD-er,

still restless did some more research.

First, here is my purchase which confirmed the SI1145.
https://www.ushabti.de/PurchaseUV.JPG

The SI1145 comes with the 0x60 address. Documents from Silicon proove this. https://www.silabs.com/documents/publi ... Rev1.0.pdf

As reported it reads 0x53:
https://www.ushabti.de/I2CScan.JPG


Now guess which other light/UV device defines address 0x53 ?
It's the LTR390.

This means those best brains@BerryBase failed to pick the right device for shipping.
Easy error since the device has no name printed on it but was declared as SI1145 in the above purchase comfirmation.
I'll have to send it back and require the correct ones.

Thank you for your support. I think the issue can be closed https://github.com/letscontrolit/ESPEasy/issues/4045 before it acquires ressources.

Kind regards

pickup#7

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Light Sensor BH1750 shows up with I2C Address 53

#6 Post by Ath » 07 May 2022, 13:49

pickup7 wrote: 07 May 2022, 13:17 Now guess which other light/UV device defines address 0x53 ?
It's the LTR390.
And guess what? There's an open pull request adding support for that sensor, PR #3984 :D

NB: The SI1145 does have the technical capability to change the I2C address, but I have been unable to discover if it is actually persisted in the chip. It seems to be stored in RAM, so most likely it isn't stored on power-down, so it would require a very specific startup procedure to switch it to the configured address, but also allow any other SI1145 devices to be inhibited while one is programmed that way. It will be much easier to use an I2C multiplexer (already supported by ESPEasy) when multiple of these sensors are to be connected to the same ESP.
/Ton (PayPal.me)

pickup7
New user
Posts: 6
Joined: 05 May 2022, 12:53

Re: Light Sensor BH1750 shows up with I2C Address 53

#7 Post by pickup7 » 07 May 2022, 14:29

Yes, had also detected this property regarding software change of address.
The HowTo is located in the Silabs forum: https://community.silabs.com/s/question ... uage=en_US
Write BUSADDR(0x02) with the new address parameter into the COMMAND memory.
Since this is volatile information it is necessary to repeat the change after each reboot/power-down/reset action.

Probably only of value when two devices with equal I2C address shalt be connected.
With some smart sequence of plugging the devices and configuring steps required - indeed.

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Light Sensor BH1750 shows up with I2C Address 53

#8 Post by Ath » 07 May 2022, 14:52

pickup7 wrote: 07 May 2022, 14:29 Probably only of value when two devices with equal I2C address shalt be connected.
With some smart sequence of plugging the devices and configuring steps required - indeed.
I see so much possible cause for error, that I would not even want to try and implement that, as easier ways of connecting multiple sensors are already available ;).
Using an I2C multiplexer there is now a hard 'limit' of 8 of these sensors per ESPEasy unit, and I'm not sure if that will ever be reached, other than on a test-bench, so no reason to put any effort into this. :lol:
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot] and 32 guests