IMU Depth Sensor Library bug


#1

The MS8503-XXBA (or should that now be MS5837?) Library has an error that causes incorrect pressure values where the temperature is above 20 degrees.

Line 168 of MS5803XXLib.cpp should be:

T2 = 2 * ((int64_t)dT * dT) / POW_2_37;

biut is currently:

T2 = 7 * ((int64_t)dT * dT) / POW_2_37;


#2

That is an old version of the code. The current version is slightly different. Can you take a look at it and explain why you think that calculation might be wrong?

Lines 143 and down:
https://github.com/OpenROV/openrov-software-arduino/blob/30.0.4/OpenROV/CMS5803_XXBALib.cpp


#3

Calculation aside, we seem to be using the wrong library for the MS5837 on the IMU2 altogether; whoops! I’m writing a new library now, so hopefully that might clear up some issues :open_mouth: Stay tuned!

Edit:

About 90% of the way done with the new library. While working on it, I discovered that your original post is in fact correct for the MS5837, but the library as written is actually correct with the 7 term (for the MS5803 of course), so this should all get cleared up with the new library. I’m really glad you made this post so we could finally get to the bottom of this. Some form of miscommunication way back when must have caused a disconnect between hardware and software on the part number :stuck_out_tongue:


#4

Finished up an initial version of the MS5837 library. It is part of the upcoming 30.0.4 update, and has not yet been thoroughly tested, though it does seem to work correctly (and is a bit faster than the 5803 library). So far, I haven’t gotten any overflow errors, so it is looking good. We’ll do more extensive testing with it today, throw it in the pressure chamber, etc.

If you’re impatient and want to get the code now, you can either clone the entire 30.0.4 branch:

or you can grab the changes specifically for the MS5837:

  • AConfig.h
  • ModuleDefinitions.h
  • CMS5837_30BA.h
  • CMS5837_30BA.cpp
  • LibMS5837_30BA.h
  • LibMS5837_30BA.cpp
  • NArduinoManager.cpp

Be sure to adjust your fresh/saltwater settings, and any other settings in AConfig.h as necessary.


IMUV2.0 problems
#5

Testing went well for the new library. Took it from 0 to 100m pressure in both the low temp and high temp ranges, no issues. 30.0.4 should be ok to start experimenting with now, but is still in the testing phases and should not be considered stable. The good news is, the readings anyone would have gotten in the past for the 5837 using the 5803 library should mostly be nearly accurate, aside from the occasional overflow issues. We didn’t notice too much of a discrepancy when comparing the two in the pressure tank. If you see any extremely incorrect values (like -200m), please be sure to let us know and also try and record the water temperature if you can. You can get the pressure and temperature data from these fields in the cockpit:

Serial.print( F( "pres:" ) );
Serial.print( m_environmentData.PRES );
Serial.print( ';' );
Serial.print( F( "temp:" ) );
Serial.print( m_environmentData.TEMP );
Serial.println( ';' );