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 (137036 times)
  2. FAT32 Library (70167 times)
  3. Network Ethernet Library (56037 times)
  4. USB Device Library (46360 times)
  5. Network WiFi Library (41978 times)
  6. FT800 Library (41306 times)
  7. GSM click (29079 times)
  8. mikroSDK (26519 times)
  9. PID Library (26453 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: 4593 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

MCP73871 click

5

MCP73871 Click is a fully integrated solution for system power delivery and Li-Po/Li-Ion battery charge management. The click features many Li-Po/Li-Ion battery charging optimizations, used to maximize the battery life.

[Learn More]

MUX 5 click

0

MUX 5 Click is a compact add-on board that contains a precise multiplexing solution. This board features the MAX14661, a serially controlled, dual-channel analog multiplexer from Analog Devices, allowing any of the 16 pins to be connected to either common pin simultaneously in any combination. The MAX14661 features Beyond-the-Rails™ capability that allows ±5.5V signals to be passed with any supply configuration alongside a configurable host interface that supports SPI and I2C serial communications. Both modes provide individual control of each independent switch so that any combination of switches can be applied.

[Learn More]

DHT22 click

7

This example demonstrates how to use DHT22 click. DHT22 sensor measures temperature and relative humidity.

[Learn More]