Close Menu
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
Facebook X (Twitter) Instagram
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us
Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
How To Electronics
  • Articles
    • Learn Electronics
    • Product Review
    • Tech Articles
  • Electronics Circuits
    • 555 Timer Projects
    • Op-Amp Circuits
    • Power Electronics
  • Microcontrollers
    • Arduino Projects
    • STM32 Projects
    • AMB82-Mini IoT AI Camera
    • BLE Projects
  • IoT Projects
    • ESP8266 Projects
    • ESP32 Projects
    • ESP32 MicroPython
    • ESP32-CAM Projects
    • LoRa/LoRaWAN Projects
  • Raspberry Pi
    • Raspberry Pi Projects
    • Raspberry Pi Pico Projects
    • Raspberry Pi Pico W Projects
  • Electronics Calculator
How To Electronics
Home » Interface MS5611 Barometer & Altimeter Sensor with Arduino
Arduino Projects

Interface MS5611 Barometer & Altimeter Sensor with Arduino

Mamtaz AlamBy Mamtaz AlamUpdated:May 28, 20232 Comments6 Mins Read
Share Facebook Twitter LinkedIn Telegram Reddit WhatsApp
MS5611 Arduino Barometric Pressure Barometer Altimeter Sensor
Share
Facebook Twitter LinkedIn Pinterest Email Reddit Telegram WhatsApp

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.

MS5611

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.

MS5611 Pinout

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.

MS5611 Arduino

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#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();
  delay(2000);
}
 
 
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(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.

MS5611 Arduino Barometric Pressure Altitude Temperature

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.

MS5611 Arduino OLED Display




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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#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 sensor, check wiring!");
    delay(500);
  }
 
  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }
 
  display.clearDisplay();
  display.display();
  delay(500);
 
  // Get reference pressure for relative altitude
  referencePressure = ms5611.readPressure();
 
  // Check settings
  checkSettings();
  delay(2000);
}
 
 
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");
 
  display.clearDisplay();
  display.setTextColor(SSD1306_WHITE);
  
  display.setCursor(0, 0);
  display.setTextSize(1);
  display.print("Temperature: ");
  display.print(realTemperature);
  display.print("*C");
 
  display.setCursor(0, 20);
  display.setTextSize(1);
  display.print("Pressure: ");
  display.print(realPressure);
  display.print("Pa");
 
  display.setCursor(0, 40);
  display.setTextSize(1);
  display.print("Altitude: ");
  display.print(relativeAltitude);
  display.print("m");
  
  display.display();
 
  delay(2000);
}

After uploading the code, you can see your OLED Display displaying the value of pressure, temperature and altitude.

OLED Pressure Temperature Altitude

Since this is a portable device, you may take it anywhere and power it using a power bank.




MS5611 vs BME280 Comparision

The BME280 Sensor is similar to MS5611 as both of them can measure pressure, temperature and altitude.

So, a comparison between BME280 & MS5611 is necessary to find out which one is the best sensor and by how much there is a variation in reading.

First connect the BME280 Sensor and MS5611 to the Arduino Board via I2C Pins.

BME280 vs MS5611

A code combining the MS5611 library and BME280 library has been created to read the value of temperature, pressure, and altitude. Therefore copy the following code and upload it to the Arduino Nano Board.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <Wire.h>
#include <MS5611.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
 
#define SEALEVELPRESSURE_HPA (1013.25)
 
MS5611 ms5611;
Adafruit_BME280 bme;
 
double referencePressure;
 
void setup()
{
  Serial.begin(9600);
 
  // Initialize MS5611 sensor
  Serial.println("Initialize MS5611 & BME280 Sensor");
 
  if (!bme.begin(0x76))
  {
    Serial.println("Could not find a valid BME280 sensor, check wiring!");
    while (1);
  }
 
  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();
  delay(2000);
}
 
 
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.print("MS6511 Temperature = ");
  Serial.print(realTemperature);
  Serial.println("*C");
  Serial.print("BME280 Temperature = ");
  Serial.print(bme.readTemperature());
  Serial.println("*C");
  Serial.println("");
 
 
  Serial.print("MS6511 Pressure = ");
  Serial.print(realPressure);
  Serial.println("Pa");
  Serial.print("BME280 Pressure = ");
  Serial.print(bme.readPressure());
  Serial.println("Pa");
  Serial.println("");
 
 
  Serial.print("MS5611 Altitude = ");
  Serial.print(absoluteAltitude);
  Serial.println("m");
  Serial.print("BME280 Altitude = ");
  Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
  Serial.println("m");
  Serial.println("");
 
  delay(2000);
}

After uploading the code, open the Serial Monitor. The Serial Monitor will show the value of the temperature, pressure, and altitude of both sensors.

It is observed from the reading that the value of temperature for both sensors is almost the same. But there is a variation is pressure by 120-130 pascal and height variation is like 10 meter.


Video Tutorial & Guide

MS5611 Barometer/Altimeter Tutorial with Arduino || BME280 vs MS5611 Comparison
Watch this video on YouTube.

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Reddit Telegram WhatsApp
Previous ArticleIoT RGB LED Strip Control with Raspberry Pi Pico W & Adafruit IO
Next Article Interface BME280 with Raspberry Pi Pico using MicroPython

Related Posts

DC Energy Meter using Arduino

Build a DC Energy Meter using Arduino – 32V/5A

Updated:August 26, 20252K
Interfacing ADXL375 Accelerometer with Arduino

Interfacing ADXL375 Accelerometer with Arduino (±200g)

Updated:June 28, 2025
PZEM-004T Arduino Energy Meter

DIY AC Energy Meter using PZEM-004T & Arduino

Updated:March 6, 20258K
Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Interfacing BMI160 Accelerometer & Gyroscope with Arduino

Updated:February 2, 20259K
Password Based Door Lock Security System Using Arduino & Keypad

Password Based Door Lock Security System Using Arduino & Keypad

Updated:February 2, 20252436K
Earthquake Detector Alarm with with Accelerometer & Arduino

Earthquake Detector Alarm with Accelerometer & Arduino

Updated:February 2, 2025661K
View 2 Comments

2 Comments

  1. Noirrot on April 2, 2026 4:18 AM

    hello

    Reply
  2. Noirrot on April 2, 2026 4:29 AM

    Hi
    I bought many GY 63( with Ms5611 chip) last week from Chineses vendors
    all of tem indicate the half pressure instead of the full pressure (see https://github.com/RobTillaart/MS5611)
    for example I read 50691 mP at home ( Z topo is 280 feet and QNH is 1018 at the closest airfield)
    can add an update for your sketches?
    many thanks

    Reply

CommentsCancel reply

Latest Posts
ESP32 Fingerprint Attendance System with Live Web Dashboard

ESP32 Fingerprint Attendance System with Live Web Dashboard

June 16, 2026
IoT Based PM & Air Quality Monitoring System using ESP32

IoT Based PM & Air Quality Monitoring System using ESP32

June 14, 2026
DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

DIY ESP32 MLX90640 IR Thermal Camera with Live Web Display

May 10, 2026
IoT Activity Tracker with ESP32 & Accelerometer Gyroscope

IoT Activity Tracker with ESP32 & Accelerometer/Gyroscope

May 2, 2026
A Guide to Sourcing Obsolete ICs for Vintage Projects

Beyond AliExpress: A Guide to Sourcing Obsolete ICs for Vintage Projects

April 21, 2026

ESP32 IoT Vehicle Motion Analyzer with MPU6050 & LIS3MDL

April 27, 2026
Building a Smart Sensor Node with a BLE Microcontroller

Building a Smart Sensor Node with a BLE Microcontroller

February 26, 2026
High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

High-Accuracy Pitch, Roll, Yaw with ESP32 & BNO08x IMU

April 27, 2026
Top Posts & Pages
  • ESP32 Fingerprint Attendance System with Live Web Dashboard
    ESP32 Fingerprint Attendance System with Live Web Dashboard
  • IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
    IoT AC Energy Meter with PZEM-004T & ESP32 WebServer
  • 12V DC to 220V AC Inverter Circuit & PCB
    12V DC to 220V AC Inverter Circuit & PCB
  • ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
    ECG Graph Monitoring with AD8232 ECG Sensor & Arduino
  • How to use ADS1115 16-Bit ADC Module with Arduino
    How to use ADS1115 16-Bit ADC Module with Arduino
  • Buck Converter: Basics, Working, Design & Application
    Buck Converter: Basics, Working, Design & Application
  • IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
    IoT Based ECG Monitoring with AD8232 ECG Sensor & ESP32
  • Interfacing PN532 NFC RFID Module with Arduino
    Interfacing PN532 NFC RFID Module with Arduino
Categories
  • Arduino Projects (197)
  • Articles (60)
    • Learn Electronics (19)
    • Product Review (15)
    • Tech Articles (28)
  • Electronics Circuits (46)
    • 555 Timer Projects (21)
    • Op-Amp Circuits (7)
    • Power Electronics (13)
  • IoT Projects (205)
    • ESP32 MicroPython (7)
    • ESP32 Projects (82)
    • ESP32-CAM Projects (15)
    • ESP8266 Projects (76)
    • LoRa/LoRaWAN Projects (22)
  • Microcontrollers (38)
    • AMB82-Mini IoT AI Camera (4)
    • BLE Projects (18)
    • STM32 Projects (19)
  • Raspberry Pi (93)
    • Raspberry Pi Pico Projects (57)
    • Raspberry Pi Pico W Projects (12)
    • Raspberry Pi Projects (24)
Follow Us
  • Facebook
  • Twitter
  • Pinterest
  • Instagram
  • YouTube
About Us

“‘How to Electronics’ is a vibrant community for electronics enthusiasts and professionals. We deliver latest insights in areas such as Embedded Systems, Power Electronics, AI, IoT, and Robotics. Our goal is to stimulate innovation and provide practical solutions for students, organizations, and industries. Join us to transform learning into a joyful journey of discovery and innovation.

Copyright © How To Electronics. All rights reserved.
  • About Us
  • Disclaimer
  • Privacy Policy
  • Contact Us
  • Advertise With Us

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Enabled!
Ad Blocker Enabled!
Looks like you're using an ad blocker. Please allow ads on our site. We rely on advertising to help fund our site.