Home        Store        Docs        Blog

Bar30 pressure sensor wrong but repeatable readings

(Jeremy) #1


we are using one of your Bar30 MS5837-30BA wired to a Raspberry pi I2C pins. The sensor is powered at 5V, is alone on the I2C bus,and its adress is correctly listed by a

i2cdetect -y 1 .

Using the example python (or Java) driver found at:

our sensor returns those values:

  • pressure: 60552 mbar
  • temperature: -83.18°C
which are obviously wrong.

The values oscilate a bit, in the range of what I would expect from a working sensor. Touching the sensor with a finger will result in a ~+2°C increase in temperature (ie: ~-79°C), which indicates a coherent reaction.

The driver implementation by ControlEverything seems to follow the datasheet quite well. The fact that the values are not random indicates (to my eyes) that the communication is working correctly. The sensor shows no sign of exterior damage.

Am I missing something, or should I consider that the sensor is faulty?



(Jacob) #2

I agree that the python driver you linked looks ok. However, this does not mean that it does not have a bug, which might be hard to spot. I think you should verify your results with another driver before concluding that the sensor hardware is at fault for the incorrect readings. There is an Arduino driver on the Blue Robotics github page.



(Rusty) #3


I took a look at the Python driver and it looks okay. The calculations all check out fine. There are a few differences that are good to note:

  1. They are using the lowest oversampling rate (256 samples instead of 8192), so the resolution will be much lower.

  2. They have a very long delay after requesting data (500 milliseconds). The maximum data reading time is only 20 milliseconds so this is unnecessarily long.

  3. They are not checking the checksum (CRC) so theoretically the calibration data could be coming in incorrectly. We aren’t checking it in our Arduino library either, but if the data was wrong that could indicate a communication issue.

We’ve very few cases of these sensors reporting incorrect data (possibly no cases). We also test each one after building them and verify that the pressure reading is accurate, so this sensor definitely reported correctly with the Arduino library when it was first tested.

I would recommend checking with the Arduino library as well, just to verify. If the sensor turns out to be damaged then we’ll be happy to replace it.


Bar30 Pressure Sensor - Drifting Absolute Value
(Jeremy) #4

Hi Rusty,

we received our Arduino board, and I tested the sensor with the library you provide, all 3.3V<->5V level shifted.

At first, the sensor reported the same type of incoherent pressure. After a while (~10min), it reported a pressure of 940mbar. After some while, it slowly raised to 1100mbar. The reported temperature was 4°C above the actual room temperature.

I then pluged the sensor on the raspberry pi, with the python driver, and it reported the same value as on the arduino (1100mbar). I let the acquisition run for about two hours, and when I came back the values were wrong again. Testing on the arduino now gives wrong value again.

We’ll test on a new sensor and will let you know.

(Rusty) #5


That’s really interesting. If that’s what’s happening that would explain how it may have passed our quality control measures.

Let me know what else you find. If it continues to behave strangely then we’ll be happy to replace it.


(Jeremy) #6

Hi Rusty,

We received a new sensor friday, I can confirm the Python driver on a Raspberry Pi works well !

I don’t know what might have happened to the other sensor :-/



(Rusty) #7

Hi Jeremy,

Okay! I don’t know what happened either but at least it’s working! We’ll get that faulty one replaced for you. Thanks for working through this so diligently.