Altitude 2 click is a high-resolution barometric pressure sensor Click board™. It provides very accurate measurements of temperature and atmospheric pressure, which can be used to calculate the altitude with a very high resolution of 20cm per step. Besides that, the device also includes features such as the ultra-low noise delta-sigma 24bit ADC, low power consumption, fast conversion times, pre-programmed unique compensation values, and more. Low count of external components requirement, along with the simple interface which requires no extensive configuration programming, makes this sensor very attractive for building altitude or air pressure measuring applications.
To measure the air pressure with a reasonable accuracy, the ambient temperature should also be taken into the consideration. The sensor component of the Altitude 2 click provides an accurate ambient temperature measurement, which can be used to extract the compensated air pressure value from the readings. It can be set to work with both SPI and I2C communication protocol, by switching a few onboard jumpers. With its low power consumption, it is a great solution for using it in various mobile altimeter applications, such as the bike computers, variometers, data loggers, mobile altimeter and barometer stations, weather stations, and similar.
How does it work?
The barometric pressure sensor used on the Altitude 2 Click consists of a piezo-resistive sensor and the analog front end with the I2C/SPI interface. The sensor is manufactured using the advanced MEMS (Micro Electro Mechanical System) technology. It is optimized for a precise altitude measurement, based on the atmospheric pressure and temperature changes, in relation with altitude.
Each sensor IC is factory calibrated at two temperatures and pressures. The calibration coefficients are stored to its 128 bit PROM area. To calculate the correct values, these coefficients need to be used in the calculation, in order to derive real values from the raw, uncompensated readings, referred to as D1 and D2 in the datasheet of the device. These two raw values represent temperature and pressure measurements, converted by the internal 24bit delta-sigma ADC.
The compensation is needed because of several reasons. The barometric pressure measurement is influenced by a temperature and the offset value, measured at 0 Pa (zero offset coef.); the temperature measurement itself has a coefficient that differs from piece to piece; the altitude does not linearly depend on the barometric pressure, and so on. For this reason, the final altitude value needs to be calculated taking into account its compensating coefficients, referred to as C1-C6 in the datasheet.
The control of the Click board™ is very simple. After the power on, the device should be reset by sending the RESET command, making sure that the proper PROM data is loaded into the internal register. After this, the content of the PROM should be read by the host MCU, also by sending a command via the communication bus. Finally, a command to start the conversion of the uncompensated measurement can be sent to the Altitude 2 click, which will respond with the conversion value, after the internal conversion period is finished. This will provide all the necessary information for the host MCU to extract the compensated values. More information about the commands and their responses can be found in the MS5607 datasheet.
However, MikroElektronika provides a library that contains functions compatible with the MikroElektronika compilers, which can be used for simplified programming of the Altitude 2 click, such as the calculation function for the altitude measurement, based on the pressure and the temperature readings, raw values for the pressure and temperature, as well as the compensated (actual) pressure and temperature readings. The library also contains an example application, which demonstrates their use. This example application can be used as a reference for custom designs.
The Click board™ offers a choice between using the I2C and SPI communication protocol. When I2C communication protocol is selected, all jumpers labeled as the COMM SEL, should be set to the I2C position (left). When SPI is selected, all these jumpers should be moved to the SPI position (right). When I2C protocol is selected, another onboard SMD jumper is used to set the LSB bit of the slave I2C address. Please note that when selecting I2C or SPI protocol, all of the COMM SEL SMD jumpers should be set at the same position (all to SPI, or all to I2C). Mixed position settings can result in the unresponsiveness of the Click board™.
There are no additional pins routed from the sensor IC, other than the lines used for the communication: SPI lines, labeled as SDI, SDO, SCK, and CS, and I2C lines, labeled as SDA and SCL. These lines are routed to the appropriate mikroBUS™ pins, used for I2C and SPI communication. The I2C lines, along with the CS line are pulled to a HIGH logic level by the onboard resistors. Please note that the Click board™ supports only 3.3V MCUs and it is not intended to be connected or controlled via the 5V MCU without a proper level shifting circuitry.
Specifications
Type
Altitude,Pressure
Applications
Can be used for various mobile altimeter applications, such as the bike computers, variometers, data loggers, mobile altimeter and barometer stations, weather stations, etc.
On-board modules
MS5607, a barometric pressure sensor IC with the stainless steel cap, produced by TE Connectivity
Key Features
Low power consumption which allows mobility, high resolution with 20cm step, high stability of the measurement readings, factory calibrated compensation coefficients, I2C and SPI support.
Interface
I2C,SPI
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V
Pinout diagram
This table shows how the pinout on Altitude 2 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Altitude 2 click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Pressure range | 10 | – | 1200 | mbar |
Pressure measurement resolution | 0.13 | – | 0.024 | mbar |
Response time | 0.5 | – | 8.22 | ms |
Temperature range | -40 | – | +85 | ˚C |
Temperature accuracy | -0.8 | – | +0.8 | ˚C |
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED indicator |
JP1 – JP5 | COMM SEL | Left | Selection of the communication type: left position I2C, right position SPI |
JP6 | I2C ADDR | Right | I2C slave address LSB bit selection: left position 0, right position 1 |
Software support
We provide a library for Altitude 2 click on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo application can run on all the main MikroElektronika development boards.
Library Description
The library initializes and defines I2C and SPI driver and performs the communication with device registers by both drivers. The library offers a choice to measure the temperature in Celsius degrees, and the pressure in mbar units. The user can determine the oversampling ratio value for both measurements independently. For more details check the documentation.
Key functions:
uint8_t altitude2_readPROM( uint8_t selectData, uint32_t *dataOut )
– The function reads calibration data from PROM.uint8_t altitude2_setRatio( uint8_t tempRatio, uint8_t pressRatio )
– The function determines the oversampling ratio value for temperature and pressure measurements.void altitude2_readData( float *tempData, float *pressData, float *altitudeData )
– The function performs temperature and pressure measurements with desired oversampling ratio and performs the calculations that convert temperature data in Celsius value and pressure data in mbar value. Depending on the temperature and pressure calculated values, the function calculates the altitude value in meters.
Examples Description
- System Initialization – Initializes peripherals and pins.
- Application Initialization – Initializes I2C/SPI driver and performs the device reset, after which the calibration coefficients can be read. Determines the ratio value for temperature and pressure measurements. It is necessary to read the calibration coefficients after the device reset.
- Application Task – (code snippet) - Gets temperature data in Celsius degrees and pressure data in mbar value. Gets the calculated altitude value in meters, which depends on the temperature and pressure measurements. Logs results on USB UART and repeats operation every 300 ms.
void applicationTask() { altitude2_readData( &temperature, &pressure, &altitude ); mikrobus_logWrite( "Temperature is: ", _LOG_TEXT ); FloatToStr( temperature, text ); mikrobus_logWrite( text, _LOG_TEXT ); mikrobus_logWrite( " Celsius", _LOG_LINE ); mikrobus_logWrite( "Pressure is: ", _LOG_TEXT ); FloatToStr( pressure, text ); mikrobus_logWrite( text, _LOG_TEXT ); mikrobus_logWrite( " mbar", _LOG_LINE ); mikrobus_logWrite( "Altitude is: ", _LOG_TEXT ); FloatToStr( altitude, text ); mikrobus_logWrite( text, _LOG_TEXT ); mikrobus_logWrite( " m", _LOG_LINE ); mikrobus_logWrite( "", _LOG_LINE ); Delay_ms( 300 ); }
The full application code, and ready to use projects can be found on our Libstock page.
mikroE Libraries used in the example:
- Conversions
- I2C
- SPI
- UART
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This click board is supported by mikroSDK – MikroElektronika Software Development Kit. To ensure a proper operation of mikroSDK compliant Click board™ demo applications, the mikroSDK package should be downloaded from the LibStock and installed for the compiler you are using.
For more information about the mikroSDK, visit the official page.