Strange problem with BMP180

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mackowiakp
Normal user
Posts: 127
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Strange problem with BMP180

#1 Post by mackowiakp » 07 Aug 2019, 07:43

I use ESP_Easy_mega-20190803_test_core_252_ESP8266_4M.bin on nodeMCU. It has connected several sensors:
- analog input
- 2 GPIO`s as binary outputs
- DTH22 (Temp + Hum)
- PMS5003 dust sensor
- BMP180 (Temp + Pressure)

I need two temperature sensors because they are located in other places.

Below diagram of BMP180 readouts (from Grafana but similar outputs is from Domoticz directly, but the charts from Domoticz are not so clear):
Temp+Baro.png
Temp+Baro.png (77.36 KiB) Viewed 1563 times
As You can see, temperature readouts from BMP180 are recorded at regular intervals according to the time interval defined in the sensor setup. In contrast, pressure readings from the same sensor are sometimes lost. At first I thought it was a sensor failure, so I replaced it with a new one. But the situation has been going on since I launched it all. Regardless of the software version. Do you know how to bypass this problem?

jimmys01
Normal user
Posts: 12
Joined: 07 Jan 2019, 22:37

Re: Strange problem with BMP180

#2 Post by jimmys01 » 07 Aug 2019, 09:41

Are you using openhab? if yes show us your persistance file.

mackowiakp
Normal user
Posts: 127
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Strange problem with BMP180

#3 Post by mackowiakp » 07 Aug 2019, 09:54

No. I dont use OpenHub. I use SendToHTTP for loading measurements of BMP180 to Domoticz because sometimes it send incorrect values like temp equal 250C or pressure 2000 hPa. So before using SendToHTTP the formula check and eliminate nonsensical values. Another think is that in most cases only reboot resolve situation so I need to reboot device each 50 min from rule. It is not problem for me but generally I think that the issue is.

mackowiakp
Normal user
Posts: 127
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Strange problem with BMP180

#4 Post by mackowiakp » 07 Aug 2019, 10:36

UPDATE

I connected the BMP180 (the one I thought was damaged) to RPi. I will use some of the first driver found on the Internet. Written in Python. I send measurement results to Domoticz via CURL. Then of course Domoticz sends them to InfluxDB and then to Grafana. The results are continuous and there is no loss of pressure measurement.

User avatar
ThomasB
Normal user
Posts: 400
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Strange problem with BMP180

#5 Post by ThomasB » 07 Aug 2019, 20:32

So before using SendToHTTP the formula check and eliminate nonsensical values. Another think is that in most cases only reboot resolve situation so I need to reboot device each 50 min from rule. It is not problem for me but generally I think that the issue is.
Perhaps the large gap of missing baro data (21:10 - 21:50) is a period of nonsensical values that were skipped by your data check rule. To confirm this I suggest you send a default value (when data is bad) that will allow you to recognize a skipped measurement. This won't solve the problem, but will provide an explanation to the missing data.

Regarding the random incorrect values that are fixed with a reboot, you didn't provide detailed information about your installation. But a common issue for i2c communication problems is excess wire length and/or incorrectly chosen pull-up resistor values. Both of these things affect signal integrity and what works in one installation may not be reliable in another.

For testing, use extremely short wire leads to the BMP180 (I suggest <5cm). If that doesn't solve the measurement problem then reduce the pull-up values on the clock and data signals. Default values are usually 4.7K, but sometimes 2.2K ohm is necessary. Once you have a reliable system you can revert to your preferred wire lengths and test again.

- Thomas

User avatar
grovkillen
Core team member
Posts: 3199
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Strange problem with BMP180

#6 Post by grovkillen » 07 Aug 2019, 21:00

Fully agree, thanks Thomas!
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

mackowiakp
Normal user
Posts: 127
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Strange problem with BMP180

#7 Post by mackowiakp » 08 Aug 2019, 09:58

But i cant fully agree. The nodeMCU and BMP180 is located inside so we call "winter garden". and cable length is less then 5 cm (both modules in the same case, well ventilated). Dust sensor and DTH22 is located outside so cable length is 20 cm (standard male/male connectors available on market). But these two sensors work fine even though the cables are longer. I also thought that the reason could be the use of mechanical connectors, which often cause a lack of proper contact. That's why I soldered all connections. I also added pull-up resistors. After googling I think that I know the reason. Look to the schematic diagram of BMP180 sensor module.
Bmp180-q.png
Bmp180-q.png (96.33 KiB) Viewed 1456 times
There is on-board voltage regulator 5 to 3,3v. I supply BMP180 from 3,3V. Minimum voltage difference between V-in and V-out of voltage regulator should be 1,4V. So I think that voltage on BMP180 chip is much lover then 3V. So the BMP180 chip works at the minimum power supply limit.
Today I will take a ladder and change the connection from 3.3V to 5V. A little gymnastics won't hurt. With a hot soldering iron in hand :D

User avatar
ThomasB
Normal user
Posts: 400
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Strange problem with BMP180

#8 Post by ThomasB » 08 Aug 2019, 17:07

The data sheet shows that the 662K VReg dropout is only 250mV. So if that's what yours has, then the resulting output should be close to 3V. But I agree that powering a 3.3V Vreg with 3.3V is something that can cause undesirable results.

FWIW, 10K ohm pull-ups are maximum allowed values and can be problematic in some installations; I've experienced issues with I2C communications that had pull-up values that high. Officially the BMP180 data sheet shows 2.2K to 10K ohm range. The typical value is 4.7K ohm (per data sheet), which I recommend you try if the problem persists. Marginal choices can work in one installation and be a bad player in another.

- Thomas

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

Re: Strange problem with BMP180

#9 Post by TD-er » 08 Aug 2019, 21:41

What I do see in the code of the BMP180 plugin is that it is not reading all registers in 1 I2C command.
For the BME/BMP280 I saw strange readings (almost all had temperature too high) until I fixed them to read the registers in 1 run.
The problem is that if you read them a register at a time, you may end up using partial data of a next or a previous measurement run.

Also the pressure reading is also reading the temperature again (there's no need for that), so there is no guarantee these values are from the same measurement run.

I know the BME280 is performing an iterative process to measure all values and even if you play around with delays inbetween reading of separate registers you may end up with completely different readings. (That's how I came up with reading it in one run and that's confirmed by an engineer from Bosch)

So I think this is worth an issue on Github.
Maybe if I compare the datasheets, I can merge BMP085/BMP180 with the BME280 plugin.

mackowiakp
Normal user
Posts: 127
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Strange problem with BMP180

#10 Post by mackowiakp » 09 Aug 2019, 07:21

I agree with TD-er that there is kind of driver issue. I change supply voltage of BMP180 module to 5V and added 4,7k pull-up resistors parallel to existing ones on sensor board. So the resultant resistance is 3,2k. But situation of wrong or lost readouts does not change. I have to add that nonsensical readouts accrues ones or twice per week (one or two such readouts per several hundreds). But keep in mind that I reboot nodeMCU each 50 min from rule. It is very easy to "catch" such readout, looking to the Grafana chart. For example pressure normally is something about 1000 hPa. And suddenly the single reading is 2500 hPa. Easy to find one looking to the chart. Comparing to other temp/pressure measuring units, readouts are correct or totally nonsensical.

User avatar
ThomasB
Normal user
Posts: 400
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Strange problem with BMP180

#11 Post by ThomasB » 09 Aug 2019, 18:23

Too bad the hardware update did not solve it. A "solder" patch would have been fast and convenient, but in this case it appears a firmware patch is needed.

- Thomas

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

Re: Strange problem with BMP180

#12 Post by TD-er » 09 Aug 2019, 22:29

ThomasB wrote:
09 Aug 2019, 18:23
Too bad the hardware update did not solve it. A "solder" patch would have been fast and convenient, but in this case it appears a firmware patch is needed.

- Thomas
That depends who's asking :)
If you need to patch one node, then you're right.
If you need to patch 100's...

And about the reboot vs error rate.
I think you could even make this behavior worse by rebooting.
I think the sensor may be performing several readings, which means that if you add some randomness in the reboot sequence, you may end up with a "winning streak" or a " failure streak".
If you just enter in the wrong moment with this, you will end up always reading the intermediate sample values.

Can you make an issue for this one, with a link to this topic?
My visits to Github are more frequent than the forum.

User avatar
ThomasB
Normal user
Posts: 400
Joined: 17 Jun 2018, 20:41
Location: USA

Re: Strange problem with BMP180

#13 Post by ThomasB » 10 Aug 2019, 21:41

If you need to patch one node, then you're right. If you need to patch 100's...
So true. Especially if the software patch is ready to install and available for free. But I have to pity the poor soul that contributes his scarce spare time to craft the software patch. Wink wink.
I think the sensor may be performing several readings, which means that if you add some randomness in the reboot sequence, you may end up with a "winning streak" or a " failure streak".
Interesting theory. If this is happening, then perhaps a workaround (until the permanent fix) is to make the reboot rule a bit smarter. I propose having the rule count the number of "bad" readings. When the count exceeds a threshold value then perform the reboot. This way a reboot does not occur while the plugin is having a "winning streak." But when the luck runs out, a reboot will occur.
What I do see in the code of the BMP180 plugin is that it is not reading all registers in 1 I2C command. For the BME/BMP280 I saw strange readings (almost all had temperature too high) until I fixed them to read the registers in 1 run.
I looked at the BMP180 plugin (named P006_BMP085) and saw that the PLUGIN_READ function reads the calibration value registers at initialization, but skips doing that with each new temperature/pressure read. Skipping the Cal register reads at each new temp/press read is a common implementation. That is to say, reading the fixed data in the sensor's Cal registers more than once is unnecessary as long as the cal data is static for future use in the function.

So I think that something deeply evil is at play here. For example, perhaps the Cal data is getting corrupted. But there's a long list of things to suspect. Without debugging it's anyone's guess. The poor soul that debugs this gets to find out why. :)

- Thomas

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

Re: Strange problem with BMP180

#14 Post by TD-er » 10 Aug 2019, 23:31

Well I don't have this sensor, so it's not my debugging :) (not sure if that should be a happy smile though)

But I will grab a new beer and take a good look at the datasheet.

Shardan
Normal user
Posts: 1112
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Strange problem with BMP180

#15 Post by Shardan » 11 Aug 2019, 00:10

need a sample?
Regards
Shardan

mackowiakp
Normal user
Posts: 127
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Strange problem with BMP180

#16 Post by mackowiakp » 11 Aug 2019, 05:08

And about the reboot vs error rate.
I think you could even make this behavior worse by rebooting.
I think the sensor may be performing several readings, which means that if you add some randomness in the reboot sequence, you may end up with a "winning streak" or a " failure streak".
If you just enter in the wrong moment with this, you will end up always reading the intermediate sample values.
Yes you are right. Only that the "suspension" of pressure readings from the sensor can in most cases be "repaired" only by rebooting the device.

mackowiakp
Normal user
Posts: 127
Joined: 07 Jun 2018, 06:47
Location: Gdynia/Poland

Re: Strange problem with BMP180

#17 Post by mackowiakp » 11 Aug 2019, 06:25

According to suggestion of Td-er I open an issue on Github. So the rest of the discussion goes there.

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

Re: Strange problem with BMP180

#18 Post by TD-er » 11 Aug 2019, 20:45

Shardan wrote:
11 Aug 2019, 00:10
need a sample?
I think that's best to get the plugin really stable.
Otherwise it will be lots of iterations with me building a test build and trying to figure out from a distance what may be wrong with it.

Shardan
Normal user
Posts: 1112
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Strange problem with BMP180

#19 Post by Shardan » 11 Aug 2019, 22:31

I'll do my very best :)
Regards
Shardan

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests