Skip to content

Example 34: Flame Sensor ​

Experiment Overview ​

A flame sensor detects specific infrared wavelengths (760nm~1100nm) emitted by flames via an IR receiver tube, outputting an analog signal indicating flame intensity. Suitable for fire alarms, firefighting robots, and other safety applications.

Hardware Wiring ​

Board LabelGPIO PinConnected Device
AOGPIO34Flame sensor analog output
DOGPIO4Flame sensor digital output (optional)

When flame is detected, the analog value decreases (the larger the flame, the lower the value); digital output goes LOW.

JSON Configuration Example ​

json
{
  "peripherals": [
    {
      "id": "flame_01",
      "name": "Flame Sensor",
      "type": 15,
      "enabled": false,
      "pins": [34],
      "params": {}
    }
  ]
}

Peripheral Execution Linkage ​

Scenario: Fire Alarm (Polling Trigger) ​

Feature: Trigger buzzer and LED alarm when flame is detected (ADC < 1000)

Web UI Configuration Steps ​

Step 1: Ensure Alarm Peripherals are Configured

  • Buzzer: buzzer_gpio (GPIO Output)
  • LED: led_d1 (GPIO Output)

Step 2: Create Rule

  1. Click Peripheral Execution in the left menu
  2. Click New Rule button
  3. Fill in basic configuration:
    • Rule Name: Fire Alarm
    • Report Data: ✅ Enabled
    • Enable: ✅ Enabled

Step 3: Configure Trigger (Polling Trigger)

  1. Click Add Trigger button

  2. Fill in trigger configuration:

    FieldValueDescription
    Trigger TypeSelect Polling TriggerPeriodic condition check
    Target PeripheralSelect flame_01Flame sensor
    Polling Interval5000.5 seconds (fast response)
    Condition Expressionvalue < 1000Flame threshold

Step 4: Configure Actions (3 actions required)

Action 1: Buzzer Alarm

  1. Click Add Action button
  2. Fill in:
    • Action Type: Select HIGH
    • Target Peripheral: Select buzzer_gpio

Action 2: LED Alarm

  1. Click Add Action button again
  2. Fill in:
    • Action Type: Select LOW (common-anode LED on)
    • Target Peripheral: Select led_d1

Action 3: Send Alarm Event

  1. Click Add Action button a third time

  2. Fill in:

    • Action Type: Select Send Event
    • Event Type: alarm
    • Event Message: Flame detected!
  3. Click Save button

Flame Sensor Value Reference ​

StatusADC ValueDescription
No Flame>2000Normal environment
Distant Flame1000-2000Weak flame
Close Flame<1000Strong flame

Notes ​

  1. Detection Angle: Sensor detection angle is ~60°; must face the flame direction
  2. Detection Range: Effective detection range is ~20-100cm (depends on flame size)
  3. False Alarms: Strong sunlight or incandescent lamps may also trigger; set threshold appropriately
  4. Safety Distance: Be cautious of fire safety during testing; a small lighter flame is sufficient for testing
  5. Multiple Sensors: Deploy multiple sensors to cover different directions

FastBee | fastbee.cn