Intermediate
30 min

Enhance your altitude measurements with ICP-10100 and PIC32MZ2048EFM100

Soar to new heights

Altitude 3 Click with Curiosity PIC32 MZ EF

Published Oct 13, 2023

Click board™

Altitude 3 Click

Dev Board

Curiosity PIC32 MZ EF

Compiler

NECTO Studio

MCU

PIC32MZ2048EFM100

Trust in our altitude measurement solution to unlock the secrets of the skies and make informed decisions whether you're a researcher or an outdoor enthusiast

A

A

Hardware Overview

How does it work?

Altitude 3 Click is based on the ICP-10100, a high accuracy, low power, waterproof barometric pressure and temperature sensor from TDK corporation. The sensor is manufactured using the ultra-low noise MEMS (Micro Electro Mechanical System) capacitive technology, optimized for precise altitude measurements. It can detect pressure difference with the accuracy of ±1 Pa, which translates to an altitude resolution of less than 10cm. This makes this sensor very usable in drone applications development, allowing it to hover at a fixed altitude, or to be used as the stabilization control. Also, this sensor has a very low temperature offset of only ±0.5 Pa/°C, within the range from 25°C to 45°C. Each sensor IC is factory calibrated and the calibration parameters are stored within the OTP memory. To convert the readings into temperature and pressure values, these coefficients need to be used. The datasheet of the ICP-10100 offers formulas for these

calculations. However, Altitude 3 Click comes with a library that contains functions that encapsulate these calculations, which greatly accelerates application development. Being packaged in a waterproof casing, the ICP-10100 sensor allows it to be used under 1.5m of water for the duration of 30 minutes. However, since the Click board™ itself is not waterproof, the sensor still offers a good resistance against increased humidity and moisture. The ICP-10100 sensor offers the best performance when operated within the normal pressure and temperature conditions within the range from 0°C to 45°C, and from 95 kPa to 105 kPa. The ICP-10100 can be operated in four different modes, allowing its performace to be tailored according to specific requirements. These modes allow a compromise between high precision, low noise, output speed, and power consumption. These modes include Low Power mode (LP), Normal mode (N), Low Noise mode

(LN) and Ultra Low Noise mode (ULN). The datasheet of the ICP-10100 contains a table that displays the conversion time, current consumption, and pressure measurement noise for each of these modes, allowing the optimal mode to be chosen. This Click board™ uses the I2C protocol to communicate with the host MCU. It contains two pull-up resistors for each of the I2C lines. The ICP-10100 is operated with only 1.8V. To provide this voltage, an additional IC had to be used. The BH18PB1WHFVCT is a small LDO regulator, providing the required voltage for the ICP-10100. Both I2C lines of the pressure sensor IC are pulled up to a 3.3V power rail though, allowing it to be operated by most MCUs that typically use 3.3V logic voltage levels. Please note that the Click board™ supports only 3.3V MCUs and it is not intended to be controlled with MCUs that use 5V without a proper level shifting circuitry.

Altitude 3 Click top side image
Altitude 3 Click bottom side image

Features overview

Development board

Curiosity PIC32 MZ EF development board is a fully integrated 32-bit development platform featuring the high-performance PIC32MZ EF Series (PIC32MZ2048EFM) that has a 2MB Flash, 512KB RAM, integrated FPU, Crypto accelerator, and excellent connectivity options. It includes an integrated programmer and debugger, requiring no additional hardware. Users can expand

functionality through MIKROE mikroBUS™ Click™ adapter boards, add Ethernet connectivity with the Microchip PHY daughter board, add WiFi connectivity capability using the Microchip expansions boards, and add audio input and output capability with Microchip audio daughter boards. These boards are fully integrated into PIC32’s powerful software framework, MPLAB Harmony,

which provides a flexible and modular interface to application development a rich set of inter-operable software stacks (TCP-IP, USB), and easy-to-use features. The Curiosity PIC32 MZ EF development board offers expansion capabilities making it an excellent choice for a rapid prototyping board in Connectivity, IOT, and general-purpose applications.

Curiosity PIC32MZ EF double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

2048

Silicon Vendor

Microchip

Pin count

100

RAM (Bytes)

524288

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RPA14
SCL
I2C Data
RPA15
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

Altitude 3 Click Schematic schematic

Step by step

Project assembly

Curiosity PIC32MZ EF front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity PIC32 MZ EF as your development board.

Curiosity PIC32MZ EF front image hardware assembly
Thermo 28 Click front image hardware assembly
Prog-cut hardware assembly
Curiosity PIC32 MZ EF MB 1 - upright/background 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
Curiosity PIC32 MZ EF MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.

Application Output Step 1

After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.

Application Output Step 3

Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.

Application Output Step 4

Software Support

Library Description

This library contains API for Altitude 3 Click driver.

Key functions:

  • altitude3_soft_reset - Function sends a command to perform a SW Reset of the device

  • altitude3_read_adc_results - Function reads results of AD conversion, which consists of the 16bit temperature and 24bit pressure data in determined order

  • altitude3_get_data - Function performs a calibration data reading, only once, and then reads a temperature and pressure data and calculates these values to standard units

Open Source

Code example

This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.

/*!
 * \file 
 * \brief Altitude3 Click example
 * 
 * # Description
 * This application enables high-resolution barometric pressure measurement.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes I2C interface and performs a SW Reset of the device.
 * 
 * ## Application Task  
 * Selects the desired measurement mode and data reading order, and after that
 * calculates the temperature, pressure and altitude data to standard units and shows results to uart terminal.
 * 
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "altitude3.h"

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

static altitude3_t altitude3;
static log_t logger;

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

void application_init ( void )
{
    log_cfg_t log_cfg;
    altitude3_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.

    altitude3_cfg_setup( &cfg );
    ALTITUDE3_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    altitude3_init( &altitude3, &cfg );

    altitude3_default_cfg ( &altitude3 );

    log_printf( &logger, "** Altitude 3 click is initialized **\r\n\r\n" );
}

void application_task ( void )
{
    uint8_t response;

    response = altitude3_measurement_mode( &altitude3, ALTITUDE3_NORMAL_T_FIRST );

    Delay_ms( 100 );

    response = altitude3_get_data( &altitude3, response );
    
    if ( response != ALTITUDE3_ERROR )
    {
        log_printf( &logger, "Temperature is : %d C\r\n", ( int16_t ) altitude3.sens_data.temperature );
       
        log_printf( &logger, "Pressure is : %u  mbar[hPa]\r\n", ( uint16_t ) altitude3.sens_data.pressure );
    
        log_printf( &logger, "Altitude is : %d m\r\n\r\n", ( int16_t ) altitude3.sens_data.altitude );

        Delay_ms( 400 );
    }
}

void main ( void )
{
    application_init( );

    for ( ; ; )
    {
        application_task( );
    }
}

// ------------------------------------------------------------------------ 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.