Arduino B.Tech/Diploma Beginner

Interface MS5611 Barometer & Altimeter Sensor with Arduino

Interface MS5611 Barometer/Altimeter Sensor with Arduino Code & library to measure temperature, pressure, altitude & compare with BME280

  • Suitable forB.Tech/Diploma Arduino students
  • Build time1-2 weeks
  • LevelBeginner
  • Available atAjvika Labs, Kakinada

About this project

Overview
In this tutorial, we will learn how to interface the MS5611 Barometer/Altimeter Sensor with Arduino Board using C/C++ Code. The MS5611 is a new generation of high-resolution altimeter sensors from MEAS Switzerland with SPI and I2C bus interface. This barometric pressure sensor is optimized for altimeters and variometers with an altitude resolution of 10 cm.
The sensor can be used in Mobile altimeters & mobile barometric measuring systems, navigation devices, Weather stations, Sports watches,
Air traffic control & Drones.
This guide explains the basic overview of MS5611 along with pinout and communication protocol details. Later we will use the MS5611 sensor with Arduino IDE & 0.96″ OLED Display and display the sensor reading on OLED. We will also make a detailed comparison between BME280 & MS5611 Sensor.
MS5611 Barometer/Altimeter Sensor
The MS5611-01BA is a high-resolution altimeter/barometer sensor from MEAS Switzerland. The sensor works with both SPI and I2C bus interface. The sensor also has an on-chip temperature sensor used to compensate for the changes in the environment and to calibrate the measurements.
The MS5611 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.
The pressure range it can measure is between 10mbar – 1200mbar with absolute accuracy of ±1.5 mbar. The sensor is optimized for altimeters and variometers with an altitude resolution of 10cm. The temperature range that it can measure is between -40˚C to +85˚C with an accuracy of ±0.8˚C.
The module comes with a MIC5205 3.3V precise voltage regulator and voltage level translator. Therefore we can use it with 3.3V or 5V microcontroller.
To learn more about this sensor, you can refer to
MS6511 Datasheet
MS5611 Features & Specifications
Pressure range: 10 to 1200 mbar
Temperature range: -40 °C to 85 °C
ADC Resolution: 24-bit
Altitude resolution: 10 cm
Resolution pressure: 0.012 mbar
Resolution temperature: 0.01 °C
Supply voltage: 1.8 to 3.6 V
Very low current consumption: Standby max. 0.14 μA
I²C and SPI interface
ESD protected
QFN housing: 5.0 x 3.0 x 0.95 mm³
RoHS and REACH compliant
MS5611 Interfaces & & Communication Protocol
The MS5611 communicates via either I2C or SPI bus. A pin called PS is available on the sensor board. If the PS pin is pulled to LOW, then the SPI interface is enabled. Pulling PS to HIGH selects the I2C interface. By default I2C interface is available.
The MS5611 has multiple I2C Address of 0x77 and 0x76. The default I2C Address is 0x77. If we connect the CSB pin to VCC, the I2C Address becomes 0x76.
To enable &use the SPI interface, we need to connect PS (Protocol Select) pin to the ground.
MS5611 Module Pinout
The MS5611 Module has a total of 7 pins which includes Power pins, SPI Pins, I2C Pins & selection pins.
Pin
Function
VCC
Power pin for 3.3V or 5V input.
GND
Common Ground & Logic.
SCL
SPI Clock Input pin/ I2C Clock Pin
SDA
Serial Data In (MOSI) pin/ I2C Data Pin
CSB
Chip Select pin
SD0
Serial Data Out (MISO) pin
PS
Protocol Select pin
Interfacing MS5611 Barometer/Altimeter Sensor with Arduino
Now let us see how we can interface the MS5611 Barometric Pressure Sensor with Arduino Board with C/C++ Code. The connection between Arduino Nano Board and MS5611 in I2C Mode is fairly simple.
Connect the VCC & GND of MS5611 to Arduino 3.3V/5V & GND Pin respectively. Connect the sensor I2C Pins SDA & SCL to Arduino A4 & A5 Pin respectively.
In this guide, we will only interface the MS5611 with Arduino in I2C Mode as an issue of heat is detected while interfacing in SPI Mode.
Source Code & Program
The Code for MS5611 can be written on Arduino IDE. But before proceeding, we need to add MS5611 Library to Arduino IDE.
Download:
MS5611 Library
Download the library and add it to the Arduino IDE using the library manager.
Now copy the following code and upload it to the Arduino Nano Board.

#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
(

)
;
}
// Get reference pressure for relative altitude
referencePressure
=
ms5611
readPressure
(
)
;
// Check settings
checkSettings
(
)
;
delay
(
2000
)
;
}
void
checkSettings
(
)
{
Serial
(
"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
(
" rawTemp = "
)
;
Serial
(
rawTemp
)
;
Serial
(
", realTemp = "
)
;
Serial
(
realTemperature
)
;
Serial
println
(
" *C"
)
;
Serial
(
" rawPressure = "
)
;
Serial
(
rawPressure
)
;
Serial
(
", realPressure = "
)
;
Serial
(
realPressure
)
;
Serial
println
(
" Pa"
)
;
Serial
(
" absoluteAltitude = "
)
;
Serial
(
absoluteAltitude
)
;
Serial
(
" m, relativeAltitude = "
)
;
Serial
(
relativeAltitude
)
;
Serial
println
(
" m"
)
;
delay
(
2000
)
;
}
After uploading the code, open the Serial Monitor. The MS5611 Barometer/Altimeter measuring parameters like temperature, pressure, and altitude can be observed in Arduino IDE.
You may move the sensor outside the room or inside the room to measure the pressure differences. You may also heat the sensor to observe the change in temperature.
Interfacing MS5611 with Arduino & OLED Display
Instead of displaying the temperature, pressure, and altitude on the Serial Monitor, we can use a 0.96″ SSD1306 I2C OLED Display.
Connect the VCC & GND of OLED Display to Arduino 3.3V/5V & GND Pin respectively. Connect the OLED I2C Pins SDA & SCL to Arduino A4 & A5 Pin respectively.
Source Code & Program
The Code requires additional SSD1306 library along with MS5611 Arduino Library. Download the library and add it to the Arduino IDE using the library manager.
Download:
SSD1306 Library
Now copy the following code and upload it to the Arduino Nano Board.

#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <MS5611.h> //https://github.com/jarzebski/Arduino-MS5611
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 //Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C //See datasheet for Address
Adafruit_SSD1306
display
(
SCREEN_WIDTH
SCREEN_HEIGHT
&
Wire
OLED_RESET
)
;
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

Technologies used

ArduinoBLEBME280SSD1306OLEDI2CSPIADCArduino IDEC++

Hardware components

  • Arduino
  • BME280
  • SSD1306
  • OLED

Software & tools

  • Arduino IDE

What you get

  • Working project / hardware kit, tested before delivery
  • Complete source code with explanation
  • Project demo and guidance for your viva
  • Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed. Payment is in two parts: • 50% advance to start the project • Remaining 50% before delivery Note: • Documentation and PPT are not included by default • If you need documentation/PPT, it can be arranged for extra time and cost We'll confirm the exact timeline and cost with you after reviewing your requirements.