Home        Store        Learn        Blog

Read data of Depth/Pressure Sensor

I have a Bar30 High-Resolution 300m Depth/Pressure Sensor, and connect it to the i2c port of the pixhawk. How can I read the data of the pressure without using arduino?



If you use QGC you can see the output of the second pressure transducer if you the MavLink Inspector.



Thank you for your answer!
I find the press_abs and press_diff in the SCALED_PRESSURE list. Is that right? The press_abs is about 1002 and the press_diff is about -0.28. Could you please tell me what is the unit of the press_abs?


The SCALED_PRESSURE parameter should be the Pixhawk internal barometer reading,

If you have the MS5837 pressure sensor attached to the Pixhawk I2C bus input, it will appear as the SCALED_PRESSUR2 parameter which is not grouped with the SCALED_PRESSURE parameter and is farther down the MavLink Inspector list.



OK, I find it! Thank you!
By the way, do you know how to get the data of pressure? I mean, not just read it in the QGC, but output the data via time to a txt file.


If you have the micro SD card installed in the Pixhawk, you should be able to look at the SCALED_PRESSURE2 parameter in the dataflash log after every ROV run.



Yes, I will look at that. Thank you!

I have Bar30 High-Resolution 300m, and I use the BeagleBone Black, I have a problem to read the sensor, someone can help me?

What is your problem?


I need to read info, but I connect the sensor and this is not detected, I connect in the pins p9_24 and p9_26 from I2C, but first I need to check the direction with the putty terminal and the sesor is not detected, How I can read sensor data?

How are you determining that the sensor is not detected? i2c-detect on the BBB will not detect the sensor for some reason. Try i2cdump.

You read the sensor data with i2c communications. The protocol and registers are described in the ms5837 datasheet, there is example code on the bluerobotics github



It took some effort, but I have been able to read the external MS 5837 pressure sensor with the BBBMINI and display it using QGC.

What version of the MINI are you using? I am presently using V1.4.



i am using the same version, you could give me the code as you made please, I try many times but I don´t conceive it


Here is how we built the code for the BBBMINI:

Basically the steps to get the software youre running and that is workin are these:

#clone the repository from bluerobotics git

git clone https://github.com/bluerobotics/ardupilot

change into directory

cd ardupilot

checkout mirkos dual baro branch

git checkout bbbminibar30-master

fetch last changes from master branch and merge them

git pull origin master

then change into ArduSub directory

cd ArduSub

finally make the code

make bbbmini-(insert your thruster configuration here)




I try again to program de sensor but in this step

checkout mirkos dual baro branch

git checkout bbbminibar30-master

send me an error

error: pathspec ‘bbbminibar30-master’ did not match any file(s) known to git.

I don´t know why


hello I´m still working with BeagleBone Black and the sensor MS 5837 in “Eclipse Mars” software that is C++, but I don´t have any results, some body can help me


It looks like there are two possible branches in GitHub. Ever use GitHub? It’s handy. You can browse projects and branches without needing to clone a project to view code/commits/etc.


git checkout pr/bbbminibar30


git checkout BBBMini-Baro

You can see the various branches of the project on GitHub. Read the commits to determine which one is best for you. My suspicion is the BBBMini-Baro.

Another comment, please be specific with your issues. List what you are doing, what you’ve tried, branches of software, hardware in use, etc. It makes for better collaboration and you’ll get more detailed and more valuable/helpful responses.



@David do you just want some c++ code to drive the sensor? or do you want to run ArduSub?

If you just want some c++ code, you can adapt the bluerobotics bar30 library (it is meant for arduino, not bbbmini, but you can use their math), find a different library online, or write a driver using the datasheet. I agree with Jim, you would get a lot better help if you share in more detail what you are trying to do, and what you have tried (post code).


Hi everyone!
I have the BlueROV2 and want to manipulate data of depth sensor using Raspberry Pi in Real Time when the ROV is working.
I had read about MAVLink protocol here:

But I don’t find how to read the data, the text to make something with this in a program in Python Or C++.
So, I found this web page:

I installed and saw that to the header manipulate I need to select the message from here:

But, I don know which of they include that, I need to read the depth sensor. Then I found this:


And I found this:


where the values are:


while the funtions of the code are:

mavlink_msg_attitude_pack(1, 200, &msg, microsSinceEpoch(), 1.2, 1.7, 3.14, 0.01, 0.02, 0.03);
mavlink_msg_sys_status_pack(1, 200, &msg, 0, 0, 0, 500, 11000, -1, -1, 0, 0, 0, 0, 0, 0);

I need to be capable of read data in a program file first, after I will need to start to controll it to make that the BlueROV2 follow paths no needing an operator.


The depth is sent over the GLOBAL_POSITION_INT message, and the raw pressure readings are sent in the SCALED_PRESSURE2 message. MAVProxy is a good place to start working with the telemetry stream. There are many examples of receiving/handling/sending MAVLink messages in this application.