中级
30 分钟

使用MM5D91-00和PIC32MZ2048EFH100检测你周围的一切

你的雷达上有什么?

Radar Click with Flip&Click PIC32MZ

已发布 6月 24, 2024

点击板

Radar Click

开发板

Flip&Click PIC32MZ

编译器

NECTO Studio

微控制器单元

PIC32MZ2048EFH100

毫米波运动传感器,可在10米范围内检测到人类存在,无论是静止还是移动。

A

A

硬件概览

它是如何工作的?

Radar Click 基于 MM5D91-00,这是一款由乔群科技股份有限公司集成毫米波技术的存在检测传感器模块。它计算进出入口的人数,简化了在61.0到61.5GHz频段内毫米波传感器的实现,并包括基于ARM Cortex-M4F的处理器系统、1Tx 3Rx天线和板载调节器。此 Click board™ 旨在演示60GHz雷达传感器的入口计数功能及其复杂的雷达存在检测算法。具有低功耗和高分辨率的特点,该板是各种存在感应应用的理想解决方案,从办公室和家庭到商业建筑。其检测范围可达10米,用于宏观运动

(人体移动),5米用于微观运动(静止的人体,如正常呼吸和眨眼),坐着或站着且至少30秒没有明显活动迹象。MM5D91-00对环境因素如温度、风、阳光和灰尘/碎屑具有免疫力,且具有±45°和±40°的方位和仰角视场。MM5D91-00通过UART接口与MCU通信,默认波特率为115200bps进行数据传输。此外,它还使用多个 mikroBUS™ 引脚。低电平有效复位信号连接在 mikroBUS™ 插座的 RST 引脚上,可激活雷达模块的硬件复位。它还具有三个通用引脚,连接到 mikroBUS™ 插座的 

AN、PWM 和 INT 引脚,分别标记为 GP2、GP1 和 GP0,用于信号化设备状态的基本变化,以及其绿色、红色和蓝色 LED 指示灯。绿色 LED 表示活跃存在,红色 LED 表示不存在,蓝色 LED 用于引导程序模式指示。此 Click board™ 可通过 VCC SEL 跳线选择 3.3V 和 5V 逻辑电压水平。这允许3.3V和5V的MCU正确使用通信线路。然而,该 Click board™ 配备了包含易于使用的函数和示例代码的库,可作为进一步开发的参考。

Radar Click top side image
Radar Click bottom side image

功能概述

开发板

Flip&Click PIC32MZ 是一款紧凑型开发板,设计为一套完整的解决方案,它将 Click 板™的灵活性带给您喜爱的微控制器,使其成为实现您想法的完美入门套件。它配备了一款板载 32 位 PIC32MZ 微控制器,Microchip 的 PIC32MZ2048EFH100,四个 mikroBUS™ 插槽用于 Click 板™连接,两个 USB 连接器,LED 指示灯,按钮,调试器/程序员连接器,以及两个与 Arduino-UNO 引脚兼容的头部。得益于创

新的制造技术,它允许您快速构建具有独特功能和特性的小工具。Flip&Click PIC32MZ 开发套件的每个部分都包含了使同一板块运行最高效的必要组件。此外,还可以选择 Flip&Click PIC32MZ 的编程方式,使用 chipKIT 引导程序(Arduino 风格的开发环境)或我们的 USB HID 引导程序,使用 mikroC、mikroBasic 和 mikroPascal for PIC32。该套件包括一个通过 USB 类型-C(USB-C)连接器的干净且调

节过的电源供应模块。所有 mikroBUS™ 本身支持的 通信方法都在这块板上,包括已经建立良好的 mikroBUS™ 插槽、用户可配置的按钮和 LED 指示灯。Flip&Click PIC32MZ 开发套件允许您在几分钟内创建新的应用程序。它由 Mikroe 软件工具原生支持,得益于大量不同的 Click 板™(超过一千块板),其数量每天都在增长,它涵盖了原型制作的许多方面。

Flip&Click PIC32MZ double image

微控制器概述 

MCU卡片 / MCU

default

建筑

PIC32

MCU 内存 (KB)

2048

硅供应商

Microchip

引脚数

100

RAM (字节)

524288

使用的MCU引脚

mikroBUS™映射器

General Purpose 2
RB11
AN
Reset
RE2
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
General Purpose 1
RC14
PWM
General Purpose 0
RD9
INT
UART TX
RE3
TX
UART RX
RG9
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Radar Click Schematic schematic

一步一步来

项目组装

Flip&Click PIC32MZ front image hardware assembly

从选择您的开发板和Click板™开始。以Flip&Click PIC32MZ作为您的开发板开始。

Flip&Click PIC32MZ front image hardware assembly
GNSS2 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
Flip&Click PIC32MZ 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

软件支持

库描述

该库包含 Radar Click 驱动程序的 API。

关键功能:

  • radar_get_event - 此函数等待 IN/OUT 事件或 ACK 命令响应。

  • radar_get_temperature - 此函数读取芯片内部温度。

  • radar_set_detection_range - 此函数设置最小和最大存在检测值。

开源

代码示例

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

/*!
 * @file main.c
 * @brief Radar Click Example.
 *
 * # Description
 * This example demonstrates the use of Radar Click board by reading and parsing 
 * events as well as the module internal temperature.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and logger and performs the Click default configuration.
 *
 * ## Application Task
 * Waits for the detection event and then displays on the USB UART the distance of detected 
 * object, accuracy, elapsed time since last reset, and the module internal temperature.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "radar.h"

static radar_t radar;
static log_t logger;

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    radar_cfg_t radar_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.
    radar_cfg_setup( &radar_cfg );
    RADAR_MAP_MIKROBUS( radar_cfg, MIKROBUS_1 );
    if ( UART_ERROR == radar_init( &radar, &radar_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( RADAR_ERROR == radar_default_cfg ( &radar ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    uint8_t evt_id, evt_payload_size, evt_payload[ 16 ];
    if ( RADAR_OK == radar_get_event ( &radar, &evt_id, evt_payload, &evt_payload_size ) )
    {
        if ( RADAR_CMD_ID_DETECT_IN_EVT == evt_id )
        {
            log_printf( &logger, " EVENT: IN\r\n" );
            radar_float_bytes_t distance;
            memcpy ( distance.b_data, &evt_payload[ 8 ], 4 );
            radar_float_ieee_to_mchip ( &distance.f_data );
            log_printf( &logger, " Target distance: %.3f m\r\n", distance.f_data );
            memcpy ( distance.b_data, &evt_payload[ 12 ], 4 );
            radar_float_ieee_to_mchip ( &distance.f_data );
            log_printf( &logger, " Accuracy (+/-): %.3f m\r\n", distance.f_data );
        }
        else
        {
            log_printf( &logger, " EVENT: OUT\r\n" );
        }
        uint32_t evt_time = ( ( uint32_t ) evt_payload[ 3 ] << 24 ) | ( ( uint32_t ) evt_payload[ 2 ] << 16 ) | 
                            ( ( uint16_t ) evt_payload[ 1 ] << 8 ) | evt_payload[ 0 ];
        log_printf( &logger, " Elapsed time: %.2f s\r\n", evt_time / 1000.0 );
        float temperature;
        if ( RADAR_OK == radar_get_temperature ( &radar, &temperature ) )
        {
            log_printf( &logger, " Temperature: %.2f C\r\n\n", temperature );
        }
    }
}

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

额外支持

资源

喜欢这个项目吗?

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