I am trying to use a MS5837-30BA Pressure sensor with a STM32L476RG Nucleo board. I am checking whether the sensor is ok by connecting it to an Arduino and coding via the following library: https://github.com/bluerobotics/BlueRobotics_MS5837_Library
The sensor works and provides accurate readings with the Arduino. However, when I try to use the Mbed MS5837 libraries, namely:
- robfish_pressuresensors_encoderQEI - Test for MS5803 and MS5837 pressure sensors (pres… | Mbed
- MS5837 - . | Mbed
- AUV_MS5837_30BA_WRCE_TSD - Updated MS5837 Library to add support for the MS5… | Mbed
I get wrong readings. Every library just spits out 0 for pressure and 20 for temperature. My pin connections on the Nucleo are same as Arduino: VCC: 3.3V, GND: GND, SDA: A4/PC_1, SCL: A5/PC_0.
Sample code:
#include "mbed.h"
#include "platform/mbed_thread.h"
#include "MS5837.h"
using namespace std;
Serial pc(USBTX, USBRX);
int main()
{
pc.baud(9600);
MS5837 small_sensor = MS5837(PC_1, PC_0, ms5837_addr_no_CS);
small_sensor.MS5837Init();
float pressure_small;
float temp_small;
while (true) {
small_sensor.Barometer_MS5837();
pressure_small = small_sensor.MS5837_Pressure();
temp_small = small_sensor.MS5837_Temperature();
pc.printf("Small Sensor Pressure: %f\n", pressure_small);
pc.printf("Small Sensor Temperature: %f\n\n", temp_small);
}
}
Any idea what’s happening?