TOP Contributors

  1. MIKROE (2654 codes)
  2. Alcides Ramos (352 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136741 times)
  2. FAT32 Library (69952 times)
  3. Network Ethernet Library (55942 times)
  4. USB Device Library (46267 times)
  5. Network WiFi Library (41887 times)
  6. FT800 Library (41173 times)
  7. GSM click (28983 times)
  8. PID Library (26413 times)
  9. mikroSDK (26361 times)
  10. microSD click (25376 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Altitude 2 click

Rating:

5

Author: MIKROE

Last Updated: 2018-05-23

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Pressure

Downloaded: 4574 times

Not followed.

License: MIT license  

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.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Altitude 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Altitude 2 click" changes.

Do you want to report abuse regarding "Altitude 2 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Altitude 2 click

Altitude 2 click

Native view of the Altitude 2 click borad.

View full image
Altitude 2 click

Altitude 2 click

Front and back view of the Altitude 2 click board.

View full image

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 units, 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 be read. Determines the ratio value for temperature and pressure measurements. Calibration coefficients are necessary to read after the device reset.
  • Application Task - (code snippet) - Gets temperature data in Celsius value 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 );
}

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.

ALSO FROM THIS AUTHOR

SRAM 4 click

0

SRAM 4 Click is a compact add-on board that contains highly reliable nonvolatile memory. This board features the CY14B512Q, a 512Kbit SRAM with a nonvolatile element in each memory cell from Cypress Semiconductor, now part of Infineon.

[Learn More]

Gyro 9 click

0

Gyro 9 Click is a compact add-on board that contains a high-performance gyroscope. This board features the A3G4250D, a MEMS motion sensor from STMicroelectronics. It is a low-power 3-axes digital output gyroscope that provides unprecedented stability at zero rate level and sensitivity over temperature and time and is equipped with an embedded temperature sensor. The gyroscope has a 16-bit rate value data output with an 8-bit compensation temperature data output.

[Learn More]

Pressure 2 click

5

Pressure 2 click carries MS5803, a high resolution MEMS pressure sensor with an operating range from 0 to 14 bars. The module comprises a high linear pressure sensor and an ultra low power 24 bit ADC. Pressure 2 click communicates with the target board MCU either through mikroBUS SPI (CS, SCK, SDO, SDI) or I2C lines (SCL, SDA).

[Learn More]