I2C Unknown error at adress 0x....

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

I2C Unknown error at adress 0x....

#1 Post by Oetsch » 20 May 2021, 12:09

Hi
I´m using a BH1750 lumen sensor at a D1 mini and for several days it works very well.
But when I recognize that no new values are measures I can check by i2C scanner and get a list of Unknown errors at adress 0x1 till 0x7F instead of the I2C device.

I´m using ~3m s-ftp cable (2 wires per signal) for the BH1750 at 5V and a logic shifter to 3,3V before connecting the D1 Mini GPIO.

I´m using the standard configuration according the documentation: https://www.letscontrolit.com/wiki/index.php/BH1750

and an update cycle of 30seconds.

ESPEasy mega version is from 23.02.2021.

Can I check or do you have a hint how to check what is the problem of unstable situation?

Thank you very much!

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

Re: I2C Unknown error at adress 0x....

#2 Post by Ath » 20 May 2021, 13:03

Besides checking the wiring quality, which you have probably already done, and improve 5V power quality/stability by adding a 10 to 47 uF elco at the sensor between 5V and GND, I think you have your bases covered by using sftp wiring. Not sure if using 2 wires for each connection (as I understand your writing) might pick up extra noise or not, but that shouldn't happen, as I expect the sftp shield to be connected to GND, (on only 1 side if there is a separate GND wire), as well.

Possible solution could be to reboot the ESP around midnight (expecting it to be too dark to measure anything), and assuming it has a time-source, so it will start afresh each time.
/Ton (PayPal.me)

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: I2C Unknown error at adress 0x....

#3 Post by Oetsch » 20 May 2021, 15:19

Thx,

I´ll try if an elco for power stabilisation will improve the situation.

Maybe a try of only using 1 wire for each signal will also improve. My intention using 1 drilled pair is to have a bigger diameter for each signal and so less losses.

Restart during night will help for the new day but the critical time when I need the signal is during sunset to close the roller shutters at best possible time.

Restarting the ESPEasy now does not help and the device isn´t recognized at the moment anymore....maybe the power supply is getting bad.

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

Re: I2C Unknown error at adress 0x....

#4 Post by TD-er » 20 May 2021, 16:37

3 meter wire is quite a bit more than what's advised for I2C.
So maybe you should lower the I2C clock frequency?

Strange thing is that another user I spoke last week also reported issues where I2C suddenly seemed to be crashed and I2C scan reporting the same error on all addresses.

Do you have "Periodical scan WiFi" checked (new feature in Feb build) which may have unexpected side effects?

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: I2C Unknown error at adress 0x....

#5 Post by Oetsch » 20 May 2021, 16:46

TD-er wrote: 20 May 2021, 16:37 3 meter wire is quite a bit more than what's advised for I2C.
Oh, ok thx thought is sth between 5 and 10meters.
TD-er wrote: 20 May 2021, 16:37 So maybe you should lower the I2C clock frequency?
tried to check "force old/slow I2C speed" without any change.
Any recommandation what to try?

Strange thing is that another user I spoke last week also reported issues where I2C suddenly seemed to be crashed and I2C scan reporting the same error on all addresses.
TD-er wrote: 20 May 2021, 16:37 Do you have "Periodical scan WiFi" checked (new feature in Feb build) which may have unexpected side effects?
Yes this is also checked. Today I also wondered why the ESP Unit isn´t connected to the strongest AP. It is using AP with -71dBm and there also AP available with -35dBm. But I did not try to solve this because the I2C issue is my bigger problem. So for now better uncheck "peridical scan" to give it a try?
Last edited by Oetsch on 20 May 2021, 16:53, edited 1 time in total.

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

Re: I2C Unknown error at adress 0x....

#6 Post by TD-er » 20 May 2021, 16:52

Yep uncheck it and maybe also give it a power cycle.

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: I2C Unknown error at adress 0x....

#7 Post by Oetsch » 20 May 2021, 17:02

Sadly no success.

Tried with unchecked periodically scan.

then reduced clock speed of I2C bus

and then downgraded to mega pre release from 14.01.2021.

result for I2C is the same. Only success is that Access Point with -35dBm is connected now :)

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

Re: I2C Unknown error at adress 0x....

#8 Post by TD-er » 20 May 2021, 17:17

I wonder if the BH1750 can run at 5V.
Just the first link I openend is suggesting 3.6V should be the max. https://components101.com/sensors/bh175 ... ght-sensor

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: I2C Unknown error at adress 0x....

#9 Post by Oetsch » 20 May 2021, 22:13

TD-er wrote: 20 May 2021, 17:17 I wonder if the BH1750 can run at 5V.
Just the first link I openend is suggesting 3.6V should be the max. https://components101.com/sensors/bh175 ... ght-sensor
mmh, thx that´s interesting. I tested the sensor with 3,3V power supply and it does not work. So simply according product pictures i tested with 5VDC and it worked. Maybe there is a difference to my used BH1750FVI version with this plastic rain cover:

Image

Edit:

Several reboots, also now at 0Lux does not change the "Unknown error...." issue

Now I got it working again, by changing GPIO 4 and 5 in the hardware setup (wrong configuration); reboot; change GPIO 4 and 5 again to right setup and the sensor is working.

Not sure how long this will be stable....

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

Re: I2C Unknown error at adress 0x....

#10 Post by TD-er » 21 May 2021, 09:10

OK, looks like it does have its own voltage regulator on board.
Not sure then what the levels of the I2C bus are from that board.
It probably uses some pull-up resistor internal, so you may want to measure the voltage on the I2C pins when not connected to the ESP but only connected to the 5V.
Maybe you don't need the level converter, or perhaps it may even cause issues if you have the "high voltage" side set to 5V.

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: I2C Unknown error at adress 0x....

#11 Post by Oetsch » 21 May 2021, 10:20

Thx, I´ll have to lookup how I2C Bus can be measured (voltage level) or better if it´s possible with simple measuring tools /without osciloscopes.

I used the BH1750FVI for testing at my Wroom 02 ESP8266 Board and I can remember that without level shifter I also had this errors with the I2C Bus. Therefore I used logic shifter in the final installation (D1 Mini).

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

Re: I2C Unknown error at adress 0x....

#12 Post by TD-er » 21 May 2021, 10:34

An I2C device only pulls the I2C data line down if it is addressed.
So in 'rest' it should not change and thus can be measured by any multimeter.
If the sensor has pull-up resistors present, the SDA and SCL lines should be pulled up to whatever level the other end of the pull-up resistors are connected. If the sensor has its own voltage regulator on board, I guess it makes sense if the pull up resistors pull the I2C lines to 3V3.
Then you don't need level converters on the board.

If no pull-up resistors are present on that board, you may need to add them on the ESP side pulling them up to 3V3 and see if it still works fine over such a long wire.

When using twisted pair cabling, you may want to have SDA + GND and SCL + GND on the same pairs.
And while you're at it, 5V + GND also via a single pair.
On unstable I2C communications, you can always lower the clock speed to see if that may improve stability.

I will also have a look at the Arduino code to see if I can explain what you saw when flipping I2C pins twice things started to work again.
Maybe I can also perform a reset on the I2C bus if it only finds errors during a scan.

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: I2C Unknown error at adress 0x....

#13 Post by Oetsch » 21 May 2021, 14:36

Thx, so in my understanding very similar two one-wire Bus.

I checked by multimeter and also checked again the product information which can be understood like it is....
Image

I2C is at 5V level and can be operated at e.g. Adruino Uno which has 5V tolerant IO. For ESP8266 so have to use level shifter to 3,3V.

The sensor is in operation now for 15 hours and I do not like to change too many things at the same time to have a chance identify the reason.
Now implemented an alarm to my smartphone if the sensor isn´t working and after this I will try next steps: change cabeling (twisted pairs) and if this does not work I will also reduce clockspeed and test.

Might take some time ...

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

Re: I2C Unknown error at adress 0x....

#14 Post by TD-er » 21 May 2021, 15:09

Yep, good approach to change only one parameter at a time.

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: I2C Unknown error at adress 0x....

#15 Post by Oetsch » 24 May 2021, 15:47

Thx for your help @ath and @TD-er!

The sensor was again unrecognized very soon after our last exchange. So then I forced the sensor to use the slow speed which is configured at 100kHz. This configuration worked until now (~2days). So there seems to be a correlation between clock speed and the errors I had in my setup.

Just to give it a try I reduced the clook speed further to 10kHz and hopefully this will work very very long.

Nevertheless, a automatic reinitialisation of the I2C interface in case only errors are detected would be a very nice feature (maybe selectable by checkbox) which would let me sleep more comfortably :)

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

Re: I2C Unknown error at adress 0x....

#16 Post by TD-er » 24 May 2021, 19:37

Dynamic I2C clock speed is not without consequences.
Not all sensors work well on lower speeds and also for sensors that need to send lots of data may end up taking much more time to complete and/or missing deadlines. (e.g. I2C to UART bridge may not be fast enough to read the buffer and thus loose data.)

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: I2C Unknown error at adress 0x....

#17 Post by Oetsch » 25 May 2021, 10:24

Seems to not have found a good enough solution. After ~20hours at 10kHz the sensor/i2C Bus only shows errors again and have to double switch GPIO of I2C Bus for initialisation.

will try your suggested pinout as follows as next step:
Image

Oetsch
Normal user
Posts: 195
Joined: 13 Jul 2020, 12:10

Re: I2C Unknown error at adress 0x....

#18 Post by Oetsch » 11 Jul 2021, 17:59

Hi

so after several tests which seems to be influnced by the behaviour of the sensor (power consumption based on light intensity ??? ) it is working.

First tried to solve issues by using drilled cable cable pairs SDA+GND and SCL+GND.

Seems to work but then it was unstable again. For me the unstability has a relation with regard to the lux intensity detected by the sensor.
For sunny days and values above 30000Lux I got one or more I2C crashes per day.
On cloudy days it seems to work for several days stable.

In addition I added 47uF elko close to the sensor and today is very sunny but the sensor keeps in operation.
So hopefully this is the solution.

Thanks everybody!

Post Reply

Who is online

Users browsing this forum: No registered users and 42 guests