Integrating Bar30 depth/pressure sensor into ArduCopter

Hello everyone,

My project team is working on integrating a Bar30 Depth/Pressure Sensor onboard a custom-designed/built cycloidal propeller unmanned underwater vehicle. The sensor is connected to one of the I2C ports on our CUAV V5+ flight controller. While the UUV’s firmware is built from a modified version of ArduCopter V4.3.6, we ensured that the ArduSub code for handling the Bar30 (AP_BARO_MS5611.cpp) is located in the AP_Baro library of the ArduCopter code.

After testing the UUV in a 4.5 ft. pool and collecting some pressure data, the result was the following (data log reviewed from within Mission Planner):

To say the least, something is awry! I am currently unsure whether the pressure value being displayed is a reading of the absolute pressure (in which case, this would be quite incorrect) or a difference in pressure compared to atmospheric. Furthermore, I am assuming that the pressure units are in Pascals (as stated within the AP_BARO_MS5611.cpp file). I am also unsure why the pressure readings oscillate in this manner rather than being a more continuous line.

Overall, I am wondering if this is an issue relating to the calibration of the sensor or something more involved with the ArduCopter firmware that we will have to modify in order to get the Bar30 operational. Thanks in advance for any feedback/assistance!

Hi @JonathanLep717, welcome to the forum :slight_smile:

Sounds funky - I’d love to know more about the vehicle if you’re able to share more :slight_smile:

Where is this stated? I couldn’t find such a statement.

How fast are the fluctuations, and is the sensor bobbing in and out of the water?

I took a brief look and there was nothing jumping out as an obvious cause. Have you tried getting an altitude measurement instead of looking at the pressure measurements? It might also help to try running ArduSub just to make sure the sensor is ok.

Hi @EliotBR ! Thanks for your reply!

I was unfortunately asked not to share a video or image of the vehicle, but for some additional context, the vehicle is primarily propelled using 4 cyclorotors as well as a couple of rear-mounted thrusters. For operation on land, it uses a pair of parallel tank treads. Its focus is on being a lightweight, agile underwater platform, so its total weight comes in at approximately 100 pounds.

When looking through the AP_BARO_MS5611.cpp file above the function definition for AP_BARO_MS56XX::_calculate_5837(), there is a comment that states “// Calculate Temperature and compensated Pressure in real units (Celsius degrees100, **mbar100**)”

If I interpreted the comment correctly, mbar*100 should correspond to pressure values of Pascals.

I was able to resolve this problem, thankfully, but to answer your question, the rate of fluctuation was (very approximately) a couple times per second. The fluctuations are a lot more clear when zoomed in to the image sent above, however, as I am a new user, I can only send one image. And the sensor was not bobbing in and out of the water, as the vehicle was swimming at a relatively stable depth of approximately 3 ft.

The problem was resolved when I changed the condition of the BARO_PROBE_EXT parameter. Initially, I had multiple types of i2c barometers selected (MS5611, MS5607, MS5637, MS5837), resulting in a bitmask of 540. The fluctuations in measured pressure went away when I selected only MS5611 (bitmask of 4).

Which brings me to my next question…

When collecting some pressure data at known depths in order to generate a calibration curve of sorts, this was the resulting plot:

Intuitively, I believe that the change in pressure in Pascals should be significantly higher for each foot of depth, on the order of thousands rather than hundreds. This probably means that I am greatly misunderstanding the units of the recorded pressure data but I am currently unsure how else to interpret them.