检测周围区域内潜在危险的雷电活动的存在和接近情况。
A
A
硬件概览
它是如何工作的?
Thunder Click 基于 ams AG 的 AS3935,这是一个可编程的全集成雷电传感器,配有灵敏的线圈天线和 Coilcraft 的 MA5532,能够探测潜在危险的雷电活动的接近。嵌入式的雷电算法检查传入信号模式,以排除可能的人造干扰源,提供噪声水平信息,并在高噪声条件下通知主 MCU。如果信号被分类为人造干扰源,该事件将被拒绝,传感器自动返回监听模式。然而,如果事件被分类为雷电击中,则统计距离估算模块评估到风暴前沿的距离。MA5532 外部天线直接连 接到 AS3935 的模拟前端(AFE),该前端放大和解
调接收到的信号。看门狗持续监控 AFE 的输出,并在接收到信号时警告集成的雷电算法模块。AS3935 的嵌入式硬线距离估算算法在每次检测到雷电时通过 IRQ 引脚(连接到 mikroBUS™ 插座的 INT 引脚)发出中断。显示在距离估算寄存器中的估算距离并不代表到单个雷电的距离,而是到风暴前沿的估算距离。除了探测潜在危险的雷电活动外,这款 Click board™ 还提供有关噪声水平上风暴中心估算距离的信息。AS3935 可以在高达 40km 的范围内探测雷电,其天 线敏感度调整为 500kHz 带宽,以便捕捉雷电事件,
对风暴前沿的精确度为 1km。AS3935 雷电传感器使用 SPI 串行接口与 MCU 通信,最大 SPI 频率为 2MHz。注意,SPI 的时钟操作频率不应与天线的共振频率(500kHz)相同,以最小化板载噪声。这款 Click board™ 可以通过 PWR SEL 跳线选择使用 3.3V 或 5V 的逻辑电压水平,使得 3.3V 和 5V 能力的 MCU 都能正确使用通信线路。此外,这款 Click board™ 配备了一个包含易于使用的功能和示例代码的库,可用作进一步开发的参考。
功能概述
开发板
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 开发板提供了扩展能力,使其成为连接性、物联网和通用应用中快速原型设计的绝佳选择。
微控制器概述
MCU卡片 / MCU

建筑
PIC32
MCU 内存 (KB)
2048
硅供应商
Microchip
引脚数
100
RAM (字节)
524288
使用的MCU引脚
mikroBUS™映射器
“仔细看看!”
Click board™ 原理图

一步一步来
项目组装
软件支持
库描述
此库包含 Thunder Click 驱动程序的 API。
关键功能:
thunder_check_interr- 此功能检查并返回中断值。thunder_get_storm_info- 此功能获取单个闪电的能量和风暴前沿的距离估计。thunder_read_reg- 此功能从寄存器中读取所需数量的字节。
开源
代码示例
完整的应用程序代码和一个现成的项目可以通过NECTO Studio包管理器直接安装到NECTO Studio。 应用程序代码也可以在MIKROE的GitHub账户中找到。
/*!
 * @file 
 * @brief Thunder Click example
 * 
 * # Description
 * This application detects the presence and proximity of potentially 
 * lightning activity and provides estimated distance to the center of the storm. 
 * It can also provide information on the noise level.
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initializes SPI driver and performs the reset command and RCO calibrate command.
 * Also configures the device for working properly.
 * 
 * ## Application Task  
 * Checks if the interrupt event has occured (Listening mode) and after that reads
 * the storm information and logs the results on the USB UART.
 * 
 * @author MikroE Team
 *
 */
#include "board.h"
#include "log.h"
#include "thunder.h"
static thunder_t thunder;
static log_t logger;
uint8_t storm_mode;
uint32_t storm_energy;
uint8_t storm_distance;
void application_init ( void )
{
    log_cfg_t log_cfg;
    thunder_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.
    thunder_cfg_setup( &cfg );
    THUNDER_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    thunder_init( &thunder, &cfg );
    thunder_default_cfg( &thunder );
    log_info( &logger, " Application Task " );
}
void application_task ( void )
{
    storm_mode = thunder_check_int ( &thunder );
    if ( THUNDER_NOISE_LEVEL_INTERR == storm_mode )
    {
        log_printf( &logger, "Noise level too high\r\n\n" );
    }
    else if ( THUNDER_DISTURBER_INTERR == storm_mode )
    {
        log_printf( &logger, "Disturber detected\r\n\n" );
    }
    else if ( THUNDER_LIGHTNING_INTERR == storm_mode )
    {
        thunder_get_storm_info( &thunder, &storm_energy, &storm_distance );
        log_printf( &logger, "Energy of the single lightning : %lu\r\n", storm_energy );
        log_printf( &logger, "Distance estimation : %u km\r\n\n", ( uint16_t ) storm_distance );
        // Reset configuration to prepare for the next measurement
        thunder_default_cfg( &thunder );
    }
}
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
额外支持
资源
类别:杂项

































