Bar30 pressure reading decrease with time


I have connected the bar 30 pressure sensor to my arduino Due (VCC 5V, GND, SDA 3.3V, SCL 3.3V) I’m receiving data properly but without touching or moving the sensor the value changes from 854mbar to 841mbar in 3 minutes approximately; then the pressure starts to increase up to 850 again in the same lapse of time. When I connect another sensor the reading is 815 mbar and this value stays without change. I’m 1800 meters over the sea level.

How can I solve this problem of accuracy?

Thank you in advance for your support!

Fernando Fonseca

Hi Fernando,

According to the datasheet for the pressure sensor used in the Bar30 (MS5837-30BA), the absolute accuracy in this pressure range is +/- 50 mbar, so these measurements are well within the published accuracy. I’m not sure what is causing the one sensor to move around a bit.

Please note that this change in pressure only causes about 10cm of depth change.

The sensor has a resolution of 2mm, so it can detect very small changes in depth, but the absolute accuracy is not quite that good.

I hope that helps!


Thank you Rusty; testing with a new sensor I realized that the pressure increases with time, I have 10 cm more every 10 minutes!!! Why does it happens?

Where can I find some information about the arduino library? probably modifying it I can solve the problem.

Thanlk you for your help.




Okay, how long does this continue? You mean that it is 20cm off after 20 minutes, 30cm after 30 minutes, etc?

Please let know.

The code for Arduino library is here: GitHub - bluerobotics/BlueRobotics_MS5837_Library: Arduino library for the MS5837 pressure sensor.


yes! at 11:36 am CT it started in 00 cm by now 12:10 am it is in 24 cm without touch, move or dive the sensor.

Hi Fonz,

Okay. We’ll test a few sensors over here and see if we can replicate that issue.


Ok thank you! I’ll be doing parallel tests too in order to find a solution; I’ll let you know what I can find.

Hello Fernando,

Can you please confirm for me that with the Arduino example code you are seeing the pressure reading go up by 10 mbar every ten minutes, continuously? Is this correct? Does the incease level off after any time?

I am testing a couple of Bar30s over here, and although their absolute values may disagree by up to 50 mbar (50cm of freshwater), they are quite precise and I have not seen their values change by more than 10 mbar in air in any amount of time.

The Bar30 is designed for underwater use, and we haven’t tested its performance in air too much. Could you please try leaving the sensor submerged in a cup of water, and seeing if the continuous incease in pressure still occurs?


Of course I’ll try it underwater, here is the code that I’m using. Yes; the pressure increases every 10 minutes approximately 10 mbar. I don’t know if after more than 3 hours this changes. I’ll try downloading again the library.

I’m using Arduino DUE (3.3 V logic level) and feeding the sensor with a 3.3 voltage regulator. (all the grounds are interconnected)

I’ll let you know If I find something.

Thank you for your support Adam.

Are you feeding the sensor with the board?




int ledPin = 13;

MS5837 sensor;

float pres, presini, prof;
float depth;
float exttemp;
float alt;

void setup() {

delay (2000);



sensor.setFluidDensity(1029); // kg/m^3 (997 freshwater, 1029 for seawater)


presini = sensor.pressure();


void loop()

digitalWrite(ledPin, HIGH);
digitalWrite(ledPin, LOW);


pres = sensor.pressure(); //mbar
prof = pres - presini;
depth = sensor.depth(); //meters
exttemp = sensor.temperature(); //in celcious
alt = sensor.altitude(); //in meters above sea level


void tx_datos()

Serial2.print(depth); //profundidad en m
Serial2.print(alt); //temperatura del agua



Yes, I am powering the sensor with 5v from an Arduino Uno. Can you also try powering it with 5v if possible? The logic should stay at 3.3v.

10 mbar increase every 10 minutes for at least 3 hours- does this mean you are seeing the reading change by as much as 180 mbar, or 1.8 meters?

I tried another sensor in air, and this one did see a drop similar to what you were describing- after an hour and a half, the sensor altitude changed by 28 cm (28 mbar) but did not decrease any further. This is still within the 50 mbar accuracy of the sensor.

Can you also try using the sensor with the example code?


Ok I’ll try it with the example code and feeding the sensor with 5V, by the way I wanna find the solution of that drop of the value. (It’s the same behavior that I have in my sensor).

It seems that the change of the pressure stops until 2 hours after.

Let´s keep in touch and thank you so much.

Have a nice weekend!


Hi Adam:

I’ve been trying to solve the problem feeding the sensor with 5v and test it underwater (always at the same depth in controlled conditions) and I’ve found that as I request data faster the pressure changes faster too and farther of the real reading. For example: the first reading of the sensor is 846mbar, if I poll data with 1000 ms of delay the pressure only goes around 4 cm, If I poll data every 5 ms the value goes upt to 15 cm more sometimes not always.

I’ll add a picture of how I douing my experiment and the code that I’m using, basically is the example program.

Thank you for your support.


#include "MS5837.h"

MS5837 sensor;

void setup() {





sensor.setFluidDensity(997); // kg/m^3 (freshwater, 1029 for seawater)

void loop() {;

Serial.print("Pressure: ");
Serial.print(" mbar,");

Serial.print("Temperature: ");
Serial.println(" deg C");

// Serial.print("Depth: ");
// Serial.print(sensor.depth());
// Serial.println(" m");
// Serial.print("Altitude: ");
// Serial.print(sensor.altitude());
// Serial.println(" m above mean sea level");


I forgot to tell you that after some time (20 or 25mins) the sensor becomes stable.


Thanks for the code and a picture of your setup, it looks like you are doing everthing right. I continued my testing with a couple of Bar30s, and although their values do fluctuate by up to 30-40 mbar over time, this is still within the specification of the MS5837-30BA sensor. Previously, Ruty mistakenly told you the value may fluctuate by up to 10cm over time, but it is actually up to 50cm (+/-50mbar). Unless you are seeing the sensor value change by over 50 mbar at a constant pressure, it it still operating within normal parameters. Rusty took a look through the code and our MS5837 Arduino library, and he doesn’t see anything that may cause an issue like this or the reading to fluctuate more rapidly with a higher polling rate. You are welcome to double check our work and see if you can find an issue, but I do believe your Bar30 is operating within the sensor manufacturers specifications.


Ok thank you; the problem for me is not the accuracy, is the repeatibility of the values everytime I read the pressure, let me tell you that before I used to connect the Sparkfun Breakout MS5803-14BA with any issue, it has a pressure sensor of the same company that the Bar 30 has. The difference is that it is not waterproof.

I’ll continue checking a possible solution to the problem and if I find something I’ll tell you.

Probably I can help you to design a breakout with the mentioned sensor that could fit in a penetrator like the MS5837-30BA and make it waterproof.

Best Regards


PS Pressure sensor breakout link: