Intermediate
30 min

Streamline pressure measurement in various settings with KP229E2701 and PIC32MZ2048EFM100

Pressure's best friend: Your reliable wingman in the digital realm

Pressure 13 Click with Curiosity PIC32 MZ EF

Published Oct 13, 2023

Click board™

Pressure 13 Click

Dev. board

Curiosity PIC32 MZ EF

Compiler

NECTO Studio

MCU

PIC32MZ2048EFM100

Experience the future of pressure measurement with our digital sensor, which empowers you with real-time, high-precision data to streamline your operations and enhance decision-making

A

A

Hardware Overview

How does it work?

Pressure 13 Click is based on the KP229E2701, a miniaturized analog absolute pressure sensor based on a capacitive principle from Infineon. The pressure is detected by an array of capacitive surface micromachined sensor cells (a monolithic integrated signal conditioning circuit implemented in BiCMOS technology). The sensor cell output is amplified, temperature compensated, and linearized to obtain an output voltage proportional to the applied pressure. The manifold air pressure (MAP) is a principal parameter to compute the air-fuel ratio provided to the engine for lower emission due to better combustion and increased efficiency. For cost-sensitive engine systems, a MAP sensor shows the potential to complement or even substitute mass airflow (MAF) sensors. The accuracy of the KP229E2701 sensor is influenced by the supply

voltage (ratiometric error) and pressure, temperature, and aging effects. All parameters needed for the complete calibration algorithm - such as offset, gain, temperature coefficients of offset and gain, and linearization parameters - are determined after the assembly. These parameters are stored in an integrated E²PROM protected with forwarding error correction (a one-bit error is detected and corrected, more than one-bit errors are detected, and the output signal is switched to ground potential). In automotive applications where high production volumes are custom, there is substantial interest in precision, low-cost, and fully integrated sensors. That’s why the manifold pressure data can be used to compute diagnostics of leakages and malfunctions of the exhaust gas recirculation valve. Pressure 13 Click communicates with MCU using only one GPIO

pin routed on the AN pin of the mikroBUS™ socket. The KP229E2701 sensor possesses several digital pins used only during calibration and testing. That’s why it’s recommended and done to leave these pins floating. The output circuit acts as a low-pass decoupling filter between the sensor output and the A/D input of the MCU because it’s recommended to protect the pressure sensor against overload and electromagnetic interferences. This Click board™ can be operated only with a 5V 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.

Pressure 13 Click top side image
Pressure 13 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

Analog Output
RPB4
AN
NC
NC
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
NC
NC
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

Pressure 13 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

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 Pressure 13 Click driver.

Key functions:

  • pressure13_read_an_pin_value - Pressure 13 read AN pin value function

  • pressure13_read_an_pin_voltage - Pressure 13 read AN pin voltage level function

  • pressure13_get_pressure - Pressure 13 read AN pin voltage level 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 main.c
 * @brief Pressure 13 Click Example.
 *
 * # Description
 * This is an example which demonstrates the use of Pressure 13 Click board.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initialization driver enables - GPIO, initializes ADC, also write log.
 *
 * ## Application Task
 * Measure and display pressure ( mBar ). Results are being sent to the 
 * Usart Terminal where you can track their changes.
 * All data logs on usb uart approximately every sec.
 *
 *
 * @author Stefan Ilic
 *
 */

#include "board.h"
#include "log.h"
#include "pressure13.h"

static pressure13_t pressure13;   /**< Pressure 13 Click driver object. */
static log_t logger;    /**< Logger object. */

static uint16_t adc_val;
static float pressure_val;
static float voltage_val;


void application_init ( void ) {
    log_cfg_t log_cfg;  /**< Logger config object. */
    pressure13_cfg_t pressure13_cfg;  /**< Click config object. */

    /** 
     * 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.
    pressure13_cfg_setup( &pressure13_cfg );
    PRESSURE13_MAP_MIKROBUS( pressure13_cfg, MIKROBUS_1 );
    if ( ADC_ERROR == pressure13_init( &pressure13, &pressure13_cfg ) )
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }
    log_info( &logger, " Application Task " );
    log_printf( &logger, "-------------------------\r\n", voltage_val );
}

void application_task ( void ) {
    if ( pressure13_get_pressure( &pressure13, &pressure_val ) != ADC_ERROR ) {
        log_printf( &logger, " Pressure: %.3f [mBar]\r\n", pressure_val );
    }
    log_printf( &logger, "-------------------------\r\n" );
    Delay_ms( 1000 );
}

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.