TOP Contributors

  1. MIKROE (2751 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139059 times)
  2. FAT32 Library (71592 times)
  3. Network Ethernet Library (56989 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29777 times)
  8. mikroSDK (27874 times)
  9. PID Library (26858 times)
  10. microSD click (26129 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: 5000 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

1-Wire Switch Click

0

1-Wire Switch Click is a compact add-on board that allows you to switch a device remotely using a 1-wire signal. This board features the DS2413, a dual-channel programmable I/O 1-Wire switch from Analog Devices.

[Learn More]

eINK 1.54 inch display

0

eINK click is an adapter Click boardâ„¢, used to interface a compatible eINK display with the host MCU.

[Learn More]

RS485 2 Click

0

RS485 2 Click is an RS422/485 transceiver Click board™, which can be used as an interface between the TTL level UART and the RS422/485 communication bus.

[Learn More]