初学者
10 分钟

使用2513130810401和PIC32MZ2048EFM100升级您的压力监测游戏

超越过滤器,超越气体:我们的传感器在每个应用中都表现出色!

Diff Press 3 Click with Curiosity PIC32 MZ EF

已发布 6月 27, 2024

点击板

Diff Press 3 Click

开发板

Curiosity PIC32 MZ EF

编译器

NECTO Studio

微控制器单元

PIC32MZ2048EFM100

在流体动力学领域,我们的传感器是默默无闻的英雄,以无与伦比的精度将压力差转换为可操作的数据。

A

A

硬件概览

它是如何工作的?

Diff Press 3 Click 基于 Würth Elektronik 的 WSEN-PDUS(2513130810401),这是一款差压传感器。该传感器具有高精度,可以测量 -100kPa 至 1000kPa 的不同传输压力范围,响应时间为 2.2ms。两个端口接受 ∅2.2 软管,其中一个为高压侧,另一个为真空侧。Diff Press 3 Click 不包括软管。对于温度,该传感器可以测量 0 至 70°C 范围内的温度,具有 15 位 ADC 分辨率。Diff Press 3 

Click 可以使用标准的 2 线 I2C 接口与主 MCU 通信,可以读取压力和温度测量值。除了 I2C 接口外,传感器的压力输出还可以通过 mikroBUS™ 插座的模拟 AN 引脚读取,仅用于读取压力测量值。由于 2513130810401 WSEN-PDUS 传感器在 5V 下工作,此 Click board™ 配备了德州仪器的 PCA9306,这是一个双向 I2C 总线和 SMBus 电压电平转换器,使此 Click board™ 可以在 3.3V 逻辑

电平的系统中使用。AN SEL 跳线允许您通过电压分压器使用 5V 或 2.5V 逻辑电平,默认设置为 2.5V。此 Click board™ 可以通过 VCC SEL 跳线选择 3.3V 或 5V 逻辑电压电平进行操作。这样,3.3V 和 5V 的 MCU 都可以正确使用通信线路。此外,此 Click board™ 配备了包含易于使用的函数和示例代码的库,可用于进一步开发。

Diff Press 3 Click hardware overview image

功能概述

开发板

Curiosity PIC32 MZ EF 开发板是一个完全集成的 32 位开发平台,特点是高性能的 PIC32MZ EF 系列(PIC32MZ2048EFM),该系列具有 2MB Flash、512KB RAM、集成的浮点单元(FPU)、加密加速器和出色的连接选项。它包括一个集成的程序员和调试器,无需额外硬件。用户可以通过 MIKROE 

mikroBUS™ Click™ 适配器板扩展功能,通过 Microchip PHY 女儿板添加以太网连接功能,使用 Microchip 扩展板添加 WiFi 连接能力,并通过 Microchip 音频女儿板添加音频输入和输出功能。这些板完全集成到 PIC32 强大的软件框架 MPLAB Harmony 中,该框架提供了一个灵活且模块化的接口

来应用开发、一套丰富的互操作软件堆栈(TCP-IP、USB)和易于使用的功能。Curiosity PIC32 MZ EF 开发板提供了扩展能力,使其成为连接性、物联网和通用应用中快速原型设计的绝佳选择。

Curiosity PIC32MZ EF double side image

微控制器概述 

MCU卡片 / MCU

default

建筑

PIC32

MCU 内存 (KB)

2048

硅供应商

Microchip

引脚数

100

RAM (字节)

524288

使用的MCU引脚

mikroBUS™映射器

Analog Output
RPB4
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
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Diff Press 3 Click Schematic schematic

一步一步来

项目组装

Curiosity PIC32MZ EF front image hardware assembly

从选择您的开发板和Click板™开始。以Curiosity PIC32 MZ EF作为您的开发板开始。

Curiosity PIC32MZ EF front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Curiosity PIC32 MZ EF MB 1 Access - 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

实时跟踪您的结果

应用程序输出

1. 应用程序输出 - 在调试模式下,“应用程序输出”窗口支持实时数据监控,直接提供执行结果的可视化。请按照提供的教程正确配置环境,以确保数据正确显示。

2. UART 终端 - 使用UART Terminal通过USB to UART converter监视数据传输,实现Click board™与开发系统之间的直接通信。请根据项目需求配置波特率和其他串行设置,以确保正常运行。有关分步设置说明,请参考提供的教程

3. Plot 输出 - Plot功能提供了一种强大的方式来可视化实时传感器数据,使趋势分析、调试和多个数据点的对比变得更加直观。要正确设置,请按照提供的教程,其中包含使用Plot功能显示Click board™读数的分步示例。在代码中使用Plot功能时,请使用以下函数:plot(insert_graph_name, variable_name);。这是一个通用格式,用户需要将“insert_graph_name”替换为实际图表名称,并将“variable_name”替换为要显示的参数。

软件支持

库描述

该库包含 Diff Press 3 Click 驱动程序的 API。

关键功能:

  • diffpress3_get_pressure - Diff Press 3 获取压力数据功能。

  • diffpress3_get_temperature - Diff Press 3 获取温度数据功能。

  • diffpress3_read_raw_adc - Diff Press 3 读取原始 ADC 值功能。

开源

代码示例

完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio 应用程序代码也可以在MIKROE的GitHub账户中找到。

/*!
 * @file main.c
 * @brief Diff Press 3 Click Example.
 *
 * # Description
 * This library contains API for the Diff Press 3 Click driver.
 * This demo application shows an example of 
 * differential pressure and temperature measurement.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initialization of I2C and ADC module and log UART.
 *
 * ## Application Task
 * This example demonstrates the use of the Diff Press 3 Click board™.
 * The demo application measures and display the Differential Pressure [kPa]
 * and Temperature [degree Celsius] data.
 * Results are being sent to the UART Terminal, where you can track their changes.
 *
 * @author Nenad Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "diffpress3.h"

static diffpress3_t diffpress3;   /**< Diff Press 3 Click driver object. */
static log_t logger;    /**< Logger object. */

void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    diffpress3_cfg_t diffpress3_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.
    diffpress3_cfg_setup( &diffpress3_cfg );
    DIFFPRESS3_MAP_MIKROBUS( diffpress3_cfg, MIKROBUS_1 );
    err_t init_flag = diffpress3_init( &diffpress3, &diffpress3_cfg );
    if ( ( ADC_ERROR == init_flag ) || ( I2C_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
    log_printf( &logger, "---------------------\r\n" );
    Delay_ms( 100 );
}

void application_task ( void ) 
{
    float pressure, temperature;
    if ( DIFFPRESS3_OK == diffpress3_get_pressure( &diffpress3, &pressure ) )
    {
        log_printf( &logger, " Diff Pressure: %.3f [kPa]\r\n", pressure );
        Delay_ms( 100 );
    }
    if ( DIFFPRESS3_OK == diffpress3_get_temperature( &diffpress3, &temperature ) )
    {
        log_printf( &logger, " Temperature: %.2f [C]\r\n", temperature );
        Delay_ms( 100 );
    }
    log_printf( &logger, "---------------------\r\n" );
    Delay_ms( 1000 );
}

void main ( void ) 
{
    application_init( );

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

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

额外支持

资源

喜欢这个项目吗?

'购买此套件' 按钮会直接带您进入购物车,您可以在购物车中轻松添加或移除产品。