Description
The GY-63 MS5611 is a high performance pressure and temperature sensor module with I2C and SPI interface.
PACKAGE INCLUDES:
- GY-63 Pressure Temperature Sensor Module
- 7-pin male header straight
KEY FEATURES OF GY-63 PRESSURE TEMPERATURE SENSOR MODULE:
- Temperature: -40 to 85°C
- Pressure: 10 to 1200 mb
- Altitude resolution: 10cm
- Fast conversion as short as 1ms
- I2C and SPI Interface
- 5V operation
The MS5611 is a high precision sensor from MEAS Switzerland that can be used in many applications from portable altimeters, gaming controls and indoor navigation.
The sensor achieves its excellent performance by being factory calibrated with the calibration data stored on the device. In addition it takes and averages a large number of measurements to filter out noise. It can take 4096 24-bit analog measurements in just 8ms and provide the average of the data points to the digital data bus. It also has built-in temperature compensation which uses the same method to filter out noise.
The temperature measurement is primarily used to temperature compensate the pressure sensor, but it can also be used to estimate the ambient temperature as well.
Internally the MS5611 sensor operates at 3.3V, but the module contains a 3.3V regulator so the module should be supplied with 5V on the VCC pin. The module also includes level shifting MOSFET transistors on the logic pins to make the module fully 5V compatible.
Measuring Temperature
The MS5611 can measure temperature over the range of -40 to 80°C.
Full accuracy of ±0.8°C is obtained over the entire range with a resolution of 0.01°C.
Measuring Pressure
The MS5611 can measure pressure over the range of 10 to 1200 mbar with excellent accuracy.
Full accuracy of ±1.5 mbar is obtained over the pressure range of 450 to 1100 mbar. Outside that pressure range the guaranteed accuracy is ±2.5 mbar
Resolution can be as high as 0.012 mbar which gives an altitude resolution as small as 10 cm (4″).
Calculating Altitude / Elevation
The MS5611 does not measure altitude directly, but it can be calculated using the pressure reading. Some libraries for this device include altitude calculation routines.
Since the device does a very good job of measuring pressure, it can do a very good job of calculating relative altitude. If you have an altitude reading with the device sitting on a table and then raise it 6″, it will show a 6″ increase in altitude.
If on the other hand you are trying to measure absolute altitude, such as the altitude of your table relative to sea level, things get more complicated. Since altitude is relative to sea level the device needs to know the current air pressure corrected to sea level so that it has a reference by which to calculate the altitude given the air pressure that it is currently reading.
Using the I2C Interface
The I2C interface is the most used interface as it only requires two pins on the MCU.
The PS (Protocol Select) pin determines which bus to use. A logic HIGH selects the I2C bus. A 1K pull-up resistor on the module pulls this pin HIGH and so the I2C bus is selected by default unless this pin is grounded.
The module supports two different I2C addresses, either 0x77 or 0x76 which allows up to 2 sensors to be used on the same bus. If the CSB pin is grounded, the address is 0x77. If it is connected to VCC the address is 0x76 (inverse logic). The CSB pin has a 2.2K pull-down resistor on the module so 0x77 is the default address if the CSB pin is not connected. Connect the CSB to Vcc to select 0x76 instead or if two sensors are used on the same I2C bus.
The SCL and SDA pins connect to the SCL and SDA pins on the MCU.
If more than 2 sensors are needed, then the SPI bus can be used.
Using the SPI Interface
To enable the SPI interface, connect PS to ground.
The other connection are:
- Connect SCL pin to the SPI SCK on MCU
- Connect SDA pin to SPI SDI on MCU
- Connect SDO pin to SPI SDO on MCU
Note that logic level shifters are included on the module for these lines to make them 5V compatible.
Module Connections
The module brings out the following connections.
1 x 7 Header
- VCC = 5V nominal. Connect to 5V output of the MCU
- GND = Ground
- SCL = Clock (SCL / SCK) for I2C and SPI
- SDA = Data (SDA / SDI) for I2C and SPI
- CSB = Chip Select. Chip Select for SPI. Address select for I2C
- SDO = Data Out (SDO) for SPI
- PS = Protocol Select. Default pulled HIGH for I2C. Connect to GND for SPI
Module Assembly
The module ships with the male header strips loose. It includes both a straight and right-angle header for flexibility. The header can be soldered to the top or bottom of the module depending on the planned use or wires can be used to make the connections.
For breadboard use, we put the straight headers on the bottom, though some people prefer to use the right-angle header so that the module stands vertical. Soldering is easiest if the header is inserted into a solderless breadboard to hold it in position during the soldering process.
OUR EVALUATION RESULTS:
These are nice little assemblies and the boards are good quality construction.
The program below continually reads the sensor and reports the temperature in C and the pressure in millibars.
There are many libraries available for the MS5611 sensor. In the example here, we are using the library written by Rob Tillaart. https://github.com/RobTillaart/Arduino/tree/master/libraries/MS5611.
Note that the library will need to be manually downloaded from this link: https://github.com/RobTillaart/Arduino
He has all of his libraries in the same ZIP file, so multiple libraries will be downloaded along with this one.
We did need to make one small change to get it to work for us. In the MS5611.cpp file, we deleted the init(); as shown in red below using a a text editor. It gets called in a later function and having it also called here in the class constructor call caused our system to hang. Your experience may be different.
MS5611::MS5611(uint8_t deviceAddress)
{
_address = deviceAddress;
Wire.begin();
_temperature = -999;
_pressure = -999;
_result = -999;
init();
}
To run a quick test using I2C, just hook up the SCL and SDA lines between the module and MCU. Also connect 5V and ground. Download the example program and then open the Serial Monitor window to see the data output. Be sure to set the baud rate for 9600.
GY-63 MS5611 Example Program
/* MS5611 Test Program Based on library sample MS5611 by Rob Tillaart Uses MS5611 library by Rob Tillaart */ #include "MS5611.h" #include <Wire.h> MS5611 MS5611(0x77); //=============================================================================== // Initialization //=============================================================================== void setup() { Serial.begin(9600); Serial.println("Begin Test"); MS5611.init(); } //=============================================================================== // Main //=============================================================================== void loop() { int result = MS5611.read(); if (result != 0) // read routine returns 0 in result if it completes OK. { Serial.print("Error in read: "); Serial.println(result); // Otherwise result shows error } else { Serial.print("Temp: "); Serial.print(MS5611.getTemperature() * 0.01, 2); // print with 2 decimals Serial.print(" C\t Press: "); Serial.print(MS5611.getPressure() * 0.01, 2); // print with 2 decimals Serial.println(" mb"); } delay(5000); }
BEFORE THEY ARE SHIPPED, THESE MODULES ARE:
- Inspected
- Basic operation verified
- Repackaged in high quality resealable ESD bag
Notes:
- None
Technical Specifications
Operating Ratings | ||
Vcc | 5V | |
Pressure | Range | 10 – 1200mbar |
Accuracy | ±1.5mbar | |
Temperature | Range | -40 – 80°C |
Accuracy | ±0.8C | |
Dimensions | L x W (PCB) | 18 x 14mm (0.71 x 0.55″) |
Country of Origin | China | |
Datasheet | TE | MS5611-01BA03 |
FURTHER READING
Wikepdia: https://en.wikipedia.org/wiki/Atmospheric_pressure
Air Pressure Calculator: https://www.mide.com/pages/air-pressure-at-altitude-calculator
AMSYS MS5611 App Note – Precise Altitude Measurement with Pressure Sensors