TOP Contributors

  1. MIKROE (2662 codes)
  2. Alcides Ramos (357 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 (137044 times)
  2. FAT32 Library (70168 times)
  3. Network Ethernet Library (56043 times)
  4. USB Device Library (46365 times)
  5. Network WiFi Library (41982 times)
  6. FT800 Library (41313 times)
  7. GSM click (29080 times)
  8. mikroSDK (26520 times)
  9. PID Library (26454 times)
  10. microSD click (25449 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: 4595 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

EEPROM 4 click

5

EEPROM 4 click is 2,097,152 bits on a click board, organized into 262,144 bytes. In other words, this click board is an EEPROM memory medium with the capacity of 256 KB.

[Learn More]

7seg click

0

7seg Click is an accessory board in mikroBus form factor. It features two 74HC595 8-bit serial-in, parallel-out shift register modules as well as two seven-segment displays. 7seg Click communicates with target board via SPI interface. The board is designed to use 3.3V and 5V power supply.

[Learn More]

GNSS 5 click

0

Determine your current position with GNSS 5 click. It carries the NEO-M8N GNSS receiver module from u-blox.

[Learn More]