Home CodeMBed STM32 Nucleo and MS5611 barometric pressure sensor example

STM32 Nucleo and MS5611 barometric pressure sensor example

by shedboy71

In this example we connect an MS5611 to an STM32 Nucleo – in this case it was a Nucleo-F446RE

This barometric pressure sensor is optimized for altimeters and variometers with an altitude resolution of 10 cm. The sensor module includes a high linearity pressure sensor and an ultra-low power 24 bit ΔΣ ADC with internal factory calibrated coefficients. It provides a precise digital 24 Bit pressure and temperature value and different operation modes that allow the user to optimize for conversion speed and current consumption. A high resolution temperature output allows the implementation of an altimeter/thermometer function without any additional sensor.

 

Features

 

  • High resolution module, 10 cm
  • Fast conversion down to 1 ms
  • Low power, 1 µA (standby < 0.15 µA)
  • QFN package 5.0 x 3.0 x 1.0 mm3
  • Supply voltage 1.8 to 3.6 V
  • Integrated digital pressure sensor (24 bit ΔΣ ADC)
  • Operating range: 10 to 1200 mbar, -40 to +85 °C
  • I2C and SPI interface up to 20 MHz
  • No external components (Internal oscillator)
  • Excellent long term stability

 

 

Connection

ST32 Nucleo Module connection
3v3 Vcc
Gnd Gnd
SCL SCL
SDA SDA

Here is a layout

stm32nucleo and ms5611

stm32nucleo and ms5611

Code

Import this into the MBEd compiler – https://os.mbed.com/teams/Aerodyne/code/MS5611Example/

I slightly modified to loop the output, thats about it

[codesyntax lang=”cpp”]

/* MS5611 Pressure sensor example
Aerodyne Labs
2014
*/
#include “mbed.h”

//Only uncomment the one needed.
//#include “MS5611SPI.h”
#include “MS5611I2C.h”

int main() {
//Only uncomment the I2C or SPI version.
//MS5611SPI ms5611(p11, p12, p13, p10);
//MS5611I2C ms5611(p9, p10, false);
//PB_9 and PB_8 for Nucleo boards
MS5611I2C ms5611(PB_9, PB_8, false);
//Print the Coefficients from the
ms5611.printCoefficients();
while(1) {
printf(“Pressure = %.0f Pa \r\n”, ms5611.getPressure());
printf(“Temperature = %.2f degC \r\n”, ms5611.getTemperature());
printf(“Altitude = %.2f m \r\n”, ms5611.getAltitude());
printf(“——————-\r\n”);
wait(2.0f);
}
}


[/codesyntax]

 

Output

Use a program like teraterm and you should see something like this

 

ms5611 output

ms5611 output

 

Link

GY-63 MS5611-01BA03 Precision MS5611 Atmospheric Pressure Sensor Module Height Sensor Module

Share

You may also like