Having more than one HW-611 E/P 280 (BMP280) seem to interfere

Hi all,
It is my first experience with Arduino. I want to have 4 distinct pressure sensors (HW-611 E/P 280, with BMP280 onboard) and show the four measures on a LCD, using I2C. I used a multiplexer TCA9548A with the pressure sensors and the LCD.

When I connect any of my sensor alone, I get correct measure of 101,3 kPa. So the sensors seem to be correct. I tried all the sensors on every pins of the multiplexer (SD2/SL2 to SD7/SL7, SD1/SL1 is for the LCD), wich makes me believe that my soldering is correct.

If a add a second sensor, the sensor that was correct is now at 95,9 kPa (incorrect), and the newly added sensor is correct at 101,3 kPa.

I now add a third sensor, and the output are now 103,8 kPa, 109,3 kPa and the newly added sensor is at 101,3 kPa. I switched the sensor 2 with 3, and I have 95,9 kPa, 93,4 kPa and 101,3 kPa.

The last added (highest index pins of the multiplexer) is always the correct one.

It seems they are interferences between them.

I checked again and again the wiring and I don't thinks it's the problem. Anybody would have an idea of what is going on? If needed, I can add a picture or my code.

Thanks, it's very much appreciated! Days wasted on this... :wink:

Do realize that each sensor has its own unique calibration values. My guess is you are only using a single set of the calibration values (most probably from the first sensor).

You have to modify the library so each sensor uses it's own calibration values from their own registers

Thanks hzrnbgy. But the sensors give different measures according to what else is connected... I bought the sensors in a little pouch in an electronics store, and they were not sold with personalised calibration data, although it makes sense they should (but the price would not be the same). Did I misunderstood what you meant?

Each sensor is hard-coded with a bunch of calibration constants during production.

Make sure in your code that you are not using the same calibration constant because each sensor is unique.

You have to retrieve the calibration data for each sensor and use that for that sensor only

Thanks hzrnbgy. I needed a couple days to understand what you wrote. It is way over my knowledge. Basically, all I wanted is to connect 4 identical sensors, and I could find no example of similar programs.

I finally got it working. I'm not sure why it works, I do not understand everything (far from it). Your last message made me do more tests, and you made me realise that it was always the last sensor I initialised that worked fine. I'm explaining what I've done, if that can help someone one day.

To initialize, I put these lines in my setup(). I found these lines on the web, and I could not get them explained :

TCA9548A(2); // select the #2 bus of the multiplexer
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. /
Adafruit_BMP280::SAMPLING_X2, /
Temp. oversampling /
Adafruit_BMP280::SAMPLING_X16, /
Pressure oversampling /
Adafruit_BMP280::FILTER_X16, /
Filtering. /
Adafruit_BMP280::STANDBY_MS_500); /
Standby time. /
TCA9548A(3); // select the #3 bus of the multiplexer
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /
Operating Mode. /
Adafruit_BMP280::SAMPLING_X2, /
Temp. oversampling /
Adafruit_BMP280::SAMPLING_X16, /
Pressure oversampling /
Adafruit_BMP280::FILTER_X16, /
Filtering. /
Adafruit_BMP280::STANDBY_MS_500); /
Standby time. */

Choosing the bus is OK, but the setSampling part is Chinese to me. I repeated for every sensor by selecting a different bus number. It didn't work, since I'm here. I realised that my problem was that I needed a different object "bmp" for each sensor. Then I wrote instead :

TCA9548A(2); // select the #2 bus of the multiplexer
bmp1.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. /
Adafruit_BMP280::SAMPLING_X2, /
Temp. oversampling /
Adafruit_BMP280::SAMPLING_X16, /
Pressure oversampling /
Adafruit_BMP280::FILTER_X16, /
Filtering. /
Adafruit_BMP280::STANDBY_MS_500); /
Standby time. /
TCA9548A(2); // select the #2 bus of the multiplexer
bmp2.setSampling(Adafruit_BMP280::MODE_NORMAL, /
Operating Mode. /
Adafruit_BMP280::SAMPLING_X2, /
Temp. oversampling /
Adafruit_BMP280::SAMPLING_X16, /
Pressure oversampling /
Adafruit_BMP280::FILTER_X16, /
Filtering. /
Adafruit_BMP280::STANDBY_MS_500); /
Standby time. */

And it worked! Of course, I had to declare first, at the beginning :

Adafruit_BMP280 bmp1; // I2C
Adafruit_BMP280 bmp2;
Adafruit_BMP280 bmp3;
Adafruit_BMP280 bmp4;

So by using the same object "bmp" for each sensor, I think I also used the same calibration for all of them, as you explained, superseding each previous calibration by the next one. That was effectively my problem. Having bmp1 to bmp4 made it work.

I still don't understand why
bmp.setSampling(Adafruit_BMP280::MODE_NORMAL, /* Operating Mode. /
Adafruit_BMP280::SAMPLING_X2, /
Temp. oversampling /
Adafruit_BMP280::SAMPLING_X16, /
Pressure oversampling /
Adafruit_BMP280::FILTER_X16, /
Filtering. /
Adafruit_BMP280::STANDBY_MS_500); /
Standby time. */
is required for calibrating each of them, since it is the same 5 lines for all sensors. Since calibration is mandatory, why isn'it done automatically?

Thanks a lot anyway, you made me search a lot, and it made me learn. I could not understand everything, but I did my best. Cheers!

If you look at the datasheet of the BMP280, the math calculations involved in the calibration is pretty extensive. My guess is, if BOSCH made it automatic, it would required including a CPU with the sensor, increasing the cost.