Interface MS5611 Barometric Pressure Sensor with Arduino Tutorial

Introduction

Barometric pressure sensors are widely used in various applications like weather monitoring, navigation systems, and altitude measurement. MS5611 is a high-resolution barometric pressure sensor module designed for use in altimeters and variometers with an I2C interface. It has a 24-bit ADC that can be used to measure pressure and temperature with high accuracy.

Hardware Required

You will require the following Hardware Components for interfacing the MS5611 Barometric Pressure Sensor with Arduino.

Components#Buy Links
Arduino UNO1Buy Now
MS5611 Barometric Pressure Sensor1Buy Now
SSD1306 OLED1Buy Now
Jumper WiresFewBuy Now
Breadboard1Buy Now

What is MS5611 Sensor?

MS5611 is a high-resolution barometric pressure sensor module designed for use in altimeters and variometers with an I2C interface. It has a 24-bit ADC that can be used to measure pressure and temperature with high accuracy.

The MS5611 Barometric Pressure Sensor is made up of a sensing element that measures pressure and temperature, and a control circuitry that converts the sensor readings into digital values. The sensing element consists of a piezoresistive pressure sensor and a temperature sensor, which are integrated into a single chip. The control circuitry contains an analog-to-digital converter (ADC), a digital signal processor (DSP), and a calibration memory.

The ADC converts the analog signals from the sensing element to digital values, which are then processed by the DSP to calculate the pressure and temperature values. The calibration memory contains the coefficients that are used by the DSP to compensate for the sensor’s nonlinearity, temperature sensitivity, and other error sources.

In the Arduino code provided earlier, the MS5611 library handles the communication with the sensor and provides functions to read the pressure and temperature values. The code reads the sensor values, prints them to the serial monitor, and displays them on an OLED display.

Specifications

  • Pressure range: 10 to 1200 mbar
  • Operating voltage: 1.8 to 3.6 V
  • Temperature range: -40 to 85 °C
  • Resolution: 0.01 mbar
  • I2C interface
  • High accuracy

Features

  1. High resolution
  2. Low power consumption
  3. Small size
  4. High accuracy
  5. Easy to use

Pinout

MS5611-Barometric-Pressure-pinout

Pin Configuration

PinDescription
VCCPower Supplies 3.3V to 5.5V. Connect it with a 5V pin of Arduino.
GNDGround Pin for providing the common ground between the devices.
SCLSerial clock pin that generates the clock signal. It is used in both I2C and SPI interfaces.
SDASerial data pin that is used to send and receive data. It is used in both I2C and SPI interfaces.
CSBThis is the chip select pin. It is used in both I2C and SPI interfaces.
SDOThis is the serial data out the pin that is used in the SPI interface.
PSThis is the protocol select pin.

Circuit Diagram

The following circuit shows you the connection of the MS5611 Barometric Pressure Sensor with Arduino Please make the connection carefully

Interface-MS5611-Barometric-Pressure-Sensor-with-Arduino-Tutorial-circuit-

Circuit Connections

ArduinoOLED DisplayMS5611 Sensor Module
5VVCCVCC
GNDGNDGND
A5SCLSCL
A4SDASDA

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow

Installing Libraries

Now when you are Ready to upload the code, to the Arduino Board you will need first to add the Following Libraries in Arduino, If you Learn How to add the library in the Arduino step-by-step guide click on how to install the library Button given Blow

Code

//For more Projects: www.arduinocircuit.com
#include "MS5611.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

MS5611 MS5611(0x77);
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire, -1);

void setup() {
  Serial.begin(115200);
  while(!Serial);

  if (!MS5611.begin()) {
    Serial.println("MS5611 not found, check wiring!");
    while (1);
  }

  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  
   // init done
  display.display();
  delay(100);
  display.clearDisplay();
  display.display();
  display.setTextColor(WHITE);
}

void loop() {
  MS5611.read();
  Serial.print("Temperature: ");
  float temp = MS5611.getTemperature();
  Serial.print(temp, 2);
  Serial.print("\tPressure: ");
  float pressure = MS5611.getPressure();
  Serial.print(pressure, 2);
  Serial.println();

  display.setCursor(0,0);
  display.clearDisplay();

  display.setTextSize(1);
  display.setCursor(0,0);
  display.print("Temperature: ");
  display.setTextSize(2);
  display.setCursor(0,10);
  display.print(temp);
  display.print(" ");
  display.setTextSize(1);
  display.cp437(true);
  display.write(167);
  display.setTextSize(2);
  display.print("C");
  
  // display humidity
  display.setTextSize(1);
  display.setCursor(0, 35);
  display.print("Pressure: ");
  display.setTextSize(2);
  display.setCursor(0, 45);
  display.print(pressure);
  display.print(" mb");
  
  display.display();
  delay(1000);
}

Working of Code

  1. The first few lines of code are the library imports. The code uses the MS5611 library for reading data from the sensor and the Adafruit_GFX and Adafruit_SSD1306 libraries for displaying data on the OLED display.
  2. Next, the code creates an instance of the MS5611 object with an I2C address of 0x77.
  3. Then, it initializes the OLED display with the specified parameters and clears the display.
  4. In the loop function, the MS5611.read() function is called to read temperature and pressure data from the sensor.
  5. The temperature and pressure data are then printed to the serial monitor using Serial.print().
  6. Next, the OLED display is updated with the temperature and pressure data. The temperature is displayed in larger font size, followed by the degree Celsius symbol. The pressure is displayed in smaller font size and followed by the “mb” unit symbol.
  7. Finally, the updated display is shown using the display.display() function and the loop waits for one second using the delay(1000) function before starting again from the beginning.

So, in summary, this code reads temperature and pressure data from the MS5611 sensor and displays it on an OLED display using the Adafruit libraries.

Applications

  1. Weather Monitoring
  2. Altitude measurement
  3. Navigation systems
  4. Drones and UAVs
  5. Airspeed measurement

Conclusion

The MS5611 Barometric Pressure Sensor module is an ideal choice for measuring barometric pressure and temperature with high accuracy. With its small size, low power consumption, and easy-to-use interface, it can be used in various applications like weather monitoring, altitude measurement, navigation systems, and airspeed measurement. Its high resolution and accuracy make it an excellent choice for precision measurements.

See Also

  1. Digital Clock with Arduino using DS3231 RTC and 7-segment LED
  2. MQ-2 Smoke Sensor with Arduino for Beginners
  3. FollowMe – Simple Game using Arduino

Leave a Comment


error: