Home        Store        Learn        Blog

Can anyone tell me whether I'm using correct commands for calculating the temp and pressure for the sensor "MS5837-30BA"?

Basically I’m using “MS5837-30BA” (Depth/Pressure Sensor for 300m (1000 ft) Depth with 2mm Resolution) this sensor. While debugging I observed the following values,
Temp = 106.76(varies)
Pre = 1021

I’m gerrting incorrect temp data. I just want to know whether I’m using correct commands or not?

Also is there C Library available for this sensor if yes then please let me know.

#define reset_cmd 0x1E

#define BLRBTCS_PR_SENSE 0x00 //DEVICE ROUTINE SELECTION ID FOR PRESSURE SENSOR.
#define BLRBTCS_TEMP_SENSE 0x01 //DEVICE ROUTINE SELECTION ID FOR TEMPERATURE SENSOR.
#define RESET 0x02

#define PR_SENSE_I2C_ID 0xEC
#define TEMP_SENSE_I2C_ID 0xEC

#define BR_PRSENSE_RESET 0x1E //RESET PRESSURE SENSOR.
#define BR_PRSENSE_PROM_FD 0XA0
#define BR_PRSENSE_PROM_C1 0xA2
#define BR_PRSENSE_PROM_C2 0xA4
#define BR_PRSENSE_PROM_C3 0xA6
#define BR_PRSENSE_PROM_C4 0xA8
#define BR_PRSENSE_PROM_C5 0xAA
#define BR_PRSENSE_PROM_C6 0xAC
#define BR_PRSENSE_STACONV_P 0x48 //START ADC CONVERSION FOR PRESSURE CHANNEL.
#define BR_PRSENSE_STACONV_T 0x58 //START ADC CONVERSION FOR TEMPERATURE CHANNEL.
#define BR_PRSENSE_ADCREAD 0x00 //READ ADC.

#define BR_TMPSENSE_RESET 0x1E //RESET TEMPERATURE SENSOR.
#define BR_TMPSENSE_PROM_K4 0XA2
#define BR_TMPSENSE_PROM_K3 0XA4
#define BR_TMPSENSE_PROM_K2 0XA6
#define BR_TMPSENSE_PROM_K1 0XA8
#define BR_TMPSENSE_PROM_K0 0XAA
#define BR_TMPSENSE_STACONV 0x48 //START ADC CONVERSION.
#define BR_TMPSENSE_ADCREAD 0x00 //READ ADC.

Regards
Omkar

Any libraries would be found on their Github. Blue Robotics · GitHub

Sorry but, I haven’t found any library available for the C.

Then there is no library directly from BlueRobotics. What are you using to read the data?

Here is some c++ code from our Arduino library where the temperature and pressure are calculated. The calculations were pulled directly from the datasheet. If you need help with your own code, you need to post the entire code.