Intermediate
30 min

Elevate your altitude measurements with confidence using MS5607-02BA03 and STM32L496AG

Rise above, embrace the altitude

Altitude 2 Click with Discovery kit with STM32L496AG MCU

Published Jul 22, 2025

Click board™

Altitude 2 Click

Dev. board

Discovery kit with STM32L496AG MCU

Compiler

NECTO Studio

MCU

STM32L496AG

Our altitude measurement solution is your passport to exploring the world from a new perspective, offering impeccable accuracy and reliability for aviation, adventure sports, and beyond.

A

A

Hardware Overview

How does it work?

Altitude 2 Click is based on the MS5607, a barometric pressure sensor IC with the stainless steel cap from TE Connectivity. 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. 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. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.

Altitude 2 Click top side image
Altitude 2 Click bottom side image

Features overview

Development board

The 32L496GDISCOVERY Discovery kit serves as a comprehensive demonstration and development platform for the STM32L496AG microcontroller, featuring an Arm® Cortex®-M4 core. Designed for applications that demand a balance of high performance, advanced graphics, and ultra-low power consumption, this kit enables seamless prototyping for a wide range of embedded solutions. With its innovative energy-efficient

architecture, the STM32L496AG integrates extended RAM and the Chrom-ART Accelerator, enhancing graphics performance while maintaining low power consumption. This makes the kit particularly well-suited for applications involving audio processing, graphical user interfaces, and real-time data acquisition, where energy efficiency is a key requirement. For ease of development, the board includes an onboard ST-LINK/V2-1

debugger/programmer, providing a seamless out-of-the-box experience for loading, debugging, and testing applications without requiring additional hardware. The combination of low power features, enhanced memory capabilities, and built-in debugging tools makes the 32L496GDISCOVERY kit an ideal choice for prototyping advanced embedded systems with state-of-the-art energy efficiency.

Discovery kit with STM32L496AG MCU double side image

Microcontroller Overview

MCU Card / MCU

STM32L496AG Image

Architecture

ARM Cortex-M4

MCU Memory (KB)

1024

Silicon Vendor

STMicroelectronics

Pin count

169

RAM (Bytes)

327680

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
SPI Chip Select
PG11
CS
SPI Clock
PI1
SCK
SPI Data OUT
PD3
MISO
SPI Data IN
PI3
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB8
SCL
I2C Data
PB7
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

Altitude 2 Click Schematic schematic

Step by step

Project assembly

Discovery kit with STM32H750XB MCU front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Discovery kit with STM32L496AG MCU as your development board.

Discovery kit with STM32H750XB MCU front image hardware assembly
Thermo 21 Click front image hardware assembly
Prog-cut hardware assembly
Board mapper by product7 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Discovery kit with STM32H750XB MCU NECTO MCU Selection Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto image step 11 hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for Altitude 2 Click driver.

Key functions:

  • altitude2_read_prom - This function reads calibration data from PROM

  • altitude2_reset - This function resets the device and reads calibration coefficients after reset

  • altitude2_read_data - Data read function

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * \file 
 * \brief Altitude2 Click example
 * 
 * # Description
 * This demo demonstrates the use of Altitude 2 Click to measure temperature, altitude and pressure.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes I2C driver and performs the device reset,
 * after which the calibration coefficients will be read.
 * Determines the ratio value for temperature and pressure measurements.
 * Calibration coefficients are necessary to read after the device reset.
 * 
 * ## Application Task  
 * 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 USBUART and repeats operation each second.
 * 
 * @note
 * Altitude is dependent from correct outside readings. It's calculated from pressure and temperature readings.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "altitude2.h"

// ------------------------------------------------------------------ VARIABLES

static altitude2_t altitude2;
static log_t logger;
float temperature;
float pressure;
float altitude;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    altitude2_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );

    //  Click initialization.

    altitude2_cfg_setup( &cfg );
    ALTITUDE2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    altitude2_init( &altitude2, &cfg );
    Delay_ms ( 500 );
    altitude2_reset( &altitude2 );
    
    altitude2_set_ratio ( &altitude2, ALTITUDE2_RATIO_2048, ALTITUDE2_RATIO_2048 );
    log_printf( &logger, "Altitude 2 is initialized\r\n" );
    Delay_ms ( 200 );
}

void application_task ( void )
{
    altitude2_read_data( &altitude2, &temperature, &pressure, &altitude );

    log_printf( &logger, "Temperature: %.2f Celsius\r\n", temperature );
    log_printf( &logger, "Pressure: %.2f mbar\r\n", pressure );
    log_printf( &logger, "Altitude: %.2f m\r\n", altitude );
    log_printf( &logger, "---------------------------------------\r\n\r\n" );

    Delay_ms ( 1000 );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}


// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.