Home Chipkit Chipkit Uno and MS5611 barometric pressure sensor example

Chipkit Uno and MS5611 barometric pressure sensor example

by shedboy71

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. The MS5611-01BA can be interfaced to virtually any microcontroller. The communication protocol is simple, without the need of programming internal registers in the device.

Small dimensions of only 5.0 mm x 3.0 mm and a height of only 1.0 mm allow for integration in mobile devices. This new sensor module generation is based on leading MEMS technology and latest benefits from MEAS Switzerland proven experience and know-how in high volume manufacturing of altimeter modules, which have been widely used for over a decade. The sensing principle employed leads to very low hysteresis and high stability of both pressure and temperature signal.

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

Code

This example comes from the https://github.com/jarzebski/Arduino-MS5611 library

[codesyntax lang=”cpp”]

#include <Wire.h>
#include <MS5611.h>

MS5611 ms5611;

double referencePressure;

void setup() 
{
  Serial.begin(9600);

  // Initialize MS5611 sensor
  Serial.println("Initialize MS5611 Sensor");

  while(!ms5611.begin())
  {
    Serial.println("Could not find a valid MS5611 sensor, check wiring!");
    delay(500);
  }

  // Get reference pressure for relative altitude
  referencePressure = ms5611.readPressure();

  // Check settings
  checkSettings();
}

void checkSettings()
{
  Serial.print("Oversampling: ");
  Serial.println(ms5611.getOversampling());
}

void loop()
{
  // Read raw values
  uint32_t rawTemp = ms5611.readRawTemperature();
  uint32_t rawPressure = ms5611.readRawPressure();

  // Read true temperature & Pressure
  double realTemperature = ms5611.readTemperature();
  long realPressure = ms5611.readPressure();

  // Calculate altitude
  float absoluteAltitude = ms5611.getAltitude(realPressure);
  float relativeAltitude = ms5611.getAltitude(realPressure, referencePressure);

  Serial.println("--");

  Serial.print(" rawTemp = ");
  Serial.print(rawTemp);
  Serial.print(", realTemp = ");
  Serial.print(realTemperature);
  Serial.println(" *C");

  Serial.print(" rawPressure = ");
  Serial.print(rawPressure);
  Serial.print(", realPressure = ");
  Serial.print(realPressure);
  Serial.println(" Pa");

  Serial.print(" absoluteAltitude = ");
  Serial.print(absoluteAltitude);
  Serial.print(" m, relativeAltitude = ");
  Serial.print(relativeAltitude);    
  Serial.println(" m");

  delay(1000);
}

[/codesyntax]

 

Output

Open the serial monitor and you will see something like this

rawTemp = 8422100, realTemp = 23.74 *C
rawPressure = 8600108, realPressure = 99667 Pa
absoluteAltitude = 138.96 m, relativeAltitude = -0.17 m

rawTemp = 8422252, realTemp = 23.75 *C
rawPressure = 8600084, realPressure = 99667 Pa
absoluteAltitude = 138.96 m, relativeAltitude = -0.17 m

rawTemp = 8471308, realTemp = 25.38 *C
rawPressure = 8583196, realPressure = 99682 Pa
absoluteAltitude = 137.69 m, relativeAltitude = -1.44 m

rawTemp = 8545740, realTemp = 27.80 *C
rawPressure = 8558564, realPressure = 99688 Pa
absoluteAltitude = 137.19 m, relativeAltitude = -1.95 m

rawTemp = 8580420, realTemp = 28.93 *C
rawPressure = 8546820, realPressure = 99691 Pa
absoluteAltitude = 136.94 m, relativeAltitude = -2.20 m

 

Link

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

Share

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More