中级
30 分钟

使用MAX30105和STM32F302VC远程监测烟雾水平和状况

净化空气:烟雾检测和预防的未来

Smoke Click with CLICKER 4 for STM32F302VCT6

已发布 7月 22, 2025

点击板

Smoke Click

开发板

CLICKER 4 for STM32F302VCT6

编译器

NECTO Studio

微控制器单元

STM32F302VC

探索我们的先进烟雾检测解决方案如何增强您预防和减轻火灾风险的能力,为每个人创造更安全的环境。

A

A

硬件概览

它是如何工作的?

Smoke Click 基于 MAX30105,这是 Analog Devices 出品的一款用于烟雾检测应用的高灵敏度光学传感器。该传感器是一个集成的粒子感测模块,内含 LED 灯、光电探测器、光学元件以及具有环境光抑制功能的低噪声电子设备。为了检测烟雾,MAX30105 通过光电探测器感测到 LED 灯的光线被烟雾粒子反射。粒子感测子系统包含环境光抵消(ALC)、一个连续时间 sigma-delta 18位 ADC 和一个专有的离散时间滤波器。ALC 内部有一个跟踪/保持电路,用于取消环境光并增加动态范围。ADC 输出数据率可从 50sps 程序至 3200sps。MAX30105 集成了红色、绿色和 IR LED 驱动器,用于调制 LED 脉冲

以进行粒子感测测量。LED 电流可从 0 程序至 50mA。板载温度传感器用于校准粒子感测子系统的温度依赖性。这个温度传感器的固有分辨率为 0.0625°C。粒子感测启动后,IR LED 在近距离模式下被激活;当检测到物体时,自动切换到正常模式。近距离模式可以重新进入。Smoke Click 使用标准的 2 线 I2C 接口与主 MCU 通信,支持高达 400KHz 的时钟数据速率。传感器使用 1.8V 电源,该电源在此 Click board™ 上通过 SPX3819MS 提供,SPX3819MS 是 MaxLinear 生产的一款 500mA 低噪声 LDO 电压调节器。为了使这个传感器能与更高的逻辑电平一起工作,Smoke Click 配备了 PCA9306,这是 Texas

 Instruments 出品的一个双向双向 I2C 总线和 SMBus 电压级转换器。其中一个可用的中断状态可以通过 INT 引脚接收,并通过 SN74LVC1T45 接收,SN74LVC1T45 是 Texas Instruments 出品的单比特双电源总线收发器,具有可配置的电压转换和三态输出。这款 Click board™ 可以通过 PWR SEL 跳线选择使用 3.3V 或 5V 逻辑电压级别,这样,3.3V 和 5V 兼容的 MCU 都可以正确使用通信线。此外,这款 Click board™ 还配备了一个包含易于使用的功能和示例代码的库,可用作进一步开发的参考。

Smoke Click top side image
Smoke Click bottom side image

功能概述

开发板

Clicker 4 for STM32F3 是一款紧凑型开发板,作为完整的解决方案而设计,可帮助用户快速构建具备独特功能的定制设备。该板搭载 STMicroelectronics 的 STM32F302VCT6 微控制器,配备四个 mikroBUS™ 插槽用于连接 Click boards™、完善的电源管理功能以及其他实用资源,是快速开发各类应用的理想平台。其核心 MCU STM32F302VCT6 基于高性能 

Arm® Cortex®-M4 32 位处理器,运行频率高达 168MHz,处理能力强大,能够满足各种高复杂度任务的需求,使 Clicker 4 能灵活适应多种应用场景。除了两个 1x20 引脚排针外,板载最显著的连接特性是四个增强型 mikroBUS™ 插槽,支持接入数量庞大的 Click boards™ 生态系统,该生态每日持续扩展。Clicker 4 各功能区域标识清晰,界面直观简洁,极大

提升使用便捷性和开发效率。Clicker 4 的价值不仅在于加速原型开发与应用构建阶段,更在于其作为独立完整方案可直接集成至实际项目中,无需额外硬件修改。四角各设有直径 4.2mm(0.165")的安装孔,便于通过螺丝轻松固定。对于多数应用,只需配套一个外壳,即可将 Clicker 4 开发板转化为完整、实用且外观精美的定制系统。

CLICKER 4 for STM32F302VCT6 double image

微控制器概述 

MCU卡片 / MCU

STM32F302VC Image

建筑

ARM Cortex-M4

MCU 内存 (KB)

256

硅供应商

STMicroelectronics

引脚数

100

RAM (字节)

40960

使用的MCU引脚

mikroBUS™映射器

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
Interrupt
PD0
INT
NC
NC
TX
NC
NC
RX
I2C Clock
PB10
SCL
I2C Data
PB11
SDA
Power Supply
5V
5V
Ground
GND
GND
1

“仔细看看!”

Click board™ 原理图

Smoke Click Schematic schematic

一步一步来

项目组装

PIC32MZ MXS Data Capture Board front image hardware assembly

从选择您的开发板和Click板™开始。以CLICKER 4 for STM32F302VCT6作为您的开发板开始。

PIC32MZ MXS Data Capture Board front image hardware assembly
Thermo 21 Click front image hardware assembly
Board mapper by product6 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
PIC32MZ MXS Data Capture Board NECTO MCU Selection Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto image step 11 hardware assembly

软件支持

库描述

这个库包含了烟雾点击驱动的API。

关键功能:

  • smoke_set_registers - 设置寄存器值的功能

  • smoke_enable_disable_interrupts - 启用或禁用中断功能

  • smoke_read_leds - 读取启用的LED值的功能

开源

代码示例

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

/*!
 * \file 
 * \brief Smoke Click example
 * 
 * # Description
 * This Click includes internal LEDs, photodetectors, optical elements, and low-noise electronics 
 * with ambient light rejection. The sensor can detect a wide variety of smoke particle sizes. 
 * It also has an on-chip temperature sensor for calibrating the temperature dependence of the 
 * particle sensing subsystem. The temperature sensor has an inherent resolution 0.0625°C.
 *
 * 
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initalizes I2C driver, applies "set registers check green values" settings, 
 * "enable FIFO data ready interrupt" and makes an initial log.
 * 
 * ## Application Task  
 * This example demonstrates the use of Smoke Click board. It reads reflected green values and
 * temperature from an internal sensor and displays the results on USART terminal.
 * It usualy takes two or three readings in order to get corect readings. Expect big values when you do.
 * 
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "smoke.h"

// ------------------------------------------------------------------ VARIABLES

static smoke_t smoke;
static log_t logger;

static float temperature;

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    smoke_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.

    smoke_cfg_setup( &cfg );
    SMOKE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    smoke_init( &smoke, &cfg );

    smoke_reset( &smoke );
    smoke_default_cfg ( &smoke );

    log_info( &logger, "---- Application Task ----" );
    Delay_ms ( 100 );
    if ( smoke_read_leds( &smoke ) != SMOKE_OK )
    {
        log_info( &logger, "---- Init Error ----" );
        for( ; ; );
    }
}

void application_task ( void )
{
    smoke_read_leds( &smoke );
    
    log_printf( &logger, "Red : %llu\r\n", smoke.red_value );
    log_printf( &logger, "IR : %llu\r\n", smoke.ir_value );
    log_printf( &logger, "Green : %llu\r\n", smoke.green_value );
    log_printf( &logger, "------------------------------\r\n" );
    
    temperature = smoke_read_temp( &smoke );
    
    log_printf( &logger, "Read Temperature[ degC ]: %.2f\r\n",  temperature );
    log_printf( &logger, "------------------------------\r\n" );

    Delay_ms ( 1000 );
}

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

额外支持

资源

喜欢这个项目吗?

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