Intermediate
30 min

Enhance your altitude measurements with ICP-10100 and PIC18F47K42TQFP

Soar to new heights

Altitude 3 Click with Curiosity Nano with PIC18F47K42

Published Feb 13, 2024

Click board™

Altitude 3 Click

Dev Board

Curiosity Nano with PIC18F47K42

Compiler

NECTO Studio

MCU

PIC18F47K42TQFP

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

PIC18F47K42 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate the PIC18F47K42 microcontroller (MCU). Central to its design is the inclusion of the powerful PIC18F47K42 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive mechanical user switch

providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI GPIO), offering extensive connectivity options.

Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 2.3V to 5.1V (limited by USB input voltage), with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.

PIC18F47K42 Curiosity Nano double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC

MCU Memory (KB)

128

Silicon Vendor

Microchip

Pin count

40

RAM (Bytes)

8192

You complete me!

Accessories

Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.

Curiosity Nano Base for Click boards accessories 1 image

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
PB2
SCL
I2C Data
PB1
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Schematic

Altitude 3 Click Schematic schematic

Step by step

Project assembly

Curiosity Nano Base for Click boards front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity Nano with PIC18F47K42 as your development board.

Curiosity Nano Base for Click boards front image hardware assembly
Barometer 13 Click front image hardware assembly
PIC18F47K42 Curiosity Nano front image hardware assembly
Prog-cut hardware assembly
Curiosity Nano with PIC18F47XXX 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
PIC18F57Q43 Curiosity 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 via Debug Mode

1. Once the code example is loaded, pressing the "DEBUG" button initiates the build process, programs it on the created setup, and enters Debug mode.

2. After the programming is completed, a header with buttons for various actions within the IDE becomes visible. Clicking the green "PLAY" button starts reading the results achieved with the Click board™. The achieved results are displayed in the Application Output tab.

DEBUG_Application_Output

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.