Arduino Giga R1 WiFi Flame Sensor

This guide covers infrared flame sensor integration with the Arduino Giga R1 WiFi. The flame sensor detects infrared radiation emitted from flames, providing both digital and analog output signals.

This tutorial demonstrates digital fire detection for binary flame presence detection, analog infrared level monitoring for flame intensity measurement, and practical implementation for real-world fire safety applications.

Arduino Giga R1 WiFi flame sensor

Afterward, you can modify the code to activate a warning horn (via a relay) when it detects fire.

Hardware Preparation

1×Arduino Giga R1 WiFi
1×USB 2.0 cable type A/B (for USB-A PC)
1×USB 2.0 cable type C/B (for USB-C PC)
1×Flame Sensor
1×5-in-1 5-way Flame Sensor
1×Jumper Wires
1×Recommended: Screw Terminal Block Shield for Arduino Uno/Mega/Giga
1×Recommended: Breadboard Shield for Arduino Mega/Giga
1×Recommended: Enclosure for Arduino Giga
1×Recommended: Power Splitter for Arduino Giga

Or you can buy the following kits:

1×DIYables Sensor Kit (30 sensors/displays)
1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of Flame Sensor

infrared flame fire-sensor module

The infrared flame sensor detects specific wavelengths of infrared radiation (typically 760nm to 1100nm) characteristic of combustion. The sensor uses a photodiode or phototransistor responsive to the infrared spectrum emitted by flames.

The sensor provides both digital output (threshold detection) and analog output (intensity measurement). Operating voltage is 3.3V to 5V with detection range of 60cm to 100cm depending on flame size and response time under 15ms. The sensor is selective for flame signatures while rejecting false triggers from incandescent lighting and sunlight.

Pinout

Correct pinout understanding is critical for safe sensor integration. An incorrect connection may damage the sensor or produce unreliable readings due to incorrect signal levels or power supply issues.

There are two types of flame sensor modules available:

A single flame sensor includes four pins with specific electrical characteristics:

  • VCC pin: Power supply input, 3.3V to 5V DC. Typical current consumption 15mA. Connect to Arduino Giga R1 WiFi 5V or 3.3V output to provide sensor power.
  • GND pin: Ground reference, 0V. Connect to Arduino GND to establish common electrical reference.
  • DO pin: Digital output, TTL compatible (0V/5V logic levels). Output is HIGH (5V) when no flame detected, LOW (0V) when flame detected. Maximum output current 10mA. Connect to any Arduino digital input pin (D2-D53).
  • AO pin: Analog output, 0V to VCC range. Output voltage proportional to infrared intensity. Connect to Arduino analog input pin (A0-A15) for intensity measurement.

The sensor requires pull-up resistors on digital outputs, which are provided internally. No external components are required for basic operation, though decoupling capacitors (0.1μF ceramic) near VCC can improve noise immunity in electrically noisy environments.

Flame Sensor Pinout
image source: diyables.io

Furthermore, it has two LED indicators for operational status:

  • PWR-LED indicator: Power status indicator. Illuminated when proper supply voltage applied to VCC pin.
  • DO-LED indicator: Digital output status indicator. Illuminates when flame detected (DO pin LOW state).

The 5-in-1 flame sensor integrates five individual flame sensors on a single PCB, providing enhanced detection coverage and directional sensitivity. While they share the same potentiometer, VCC, and GND connections, each sensor's DO (Digital Output) and AI (Analog Input) pins function independently with separate signal processing circuits. Additionally, each sensor is oriented in a different direction, which effectively broadens the overall detection range to approximately 180 degrees of coverage compared to the single sensor's 60-degree detection cone.

How It Works

The flame sensor operates using infrared photodiode detection combined with analog signal processing and digital threshold comparison circuits.

For the DO pin (Digital Output):

  • The module has a built-in potentiometer for setting the infrared threshold (sensitivity adjustment from approximately 10% to 90% of full scale).
  • When the infrared intensity exceeds the threshold value, flame is detected, the digital output pin transitions to LOW (0V), and the DO-LED indicator illuminates.
  • When the infrared intensity falls below the threshold value, flame is NOT detected, the digital output pin transitions to HIGH (5V), and the DO-LED indicator turns off.
  • The comparator circuit includes hysteresis (approximately 50mV) to prevent output oscillation near the threshold point.

For the AO pin (Analog Output):

  • The analog output provides continuous measurement of infrared intensity from 0V (no infrared) to VCC (maximum detectable intensity).
  • Higher infrared intensity in the surrounding environment produces higher voltage on the AO pin (linear relationship within sensor's dynamic range).
  • Lower infrared intensity in the surrounding environment produces lower voltage on the AO pin.
  • The analog output has approximately 10-bit resolution equivalent when used with Arduino's ADC, providing 1024 discrete levels of intensity measurement.

Note that the potentiometer adjustment only affects the digital threshold comparison and does not influence the analog output voltage range or sensitivity.

Wiring Diagram

The wiring configuration depends on whether digital detection, analog measurement, or both outputs are required for the application. Proper connections ensure reliable signal transmission and prevent damage to both sensor and Arduino.

Since the flame sensor module has two outputs, you can choose to use one or both of them, depending on what you need.

The wiring diagram between Arduino infrared flame sensor

This image is created using Fritzing. Click to enlarge image

Flame Sensor Pin Arduino Giga R1 WiFi Pin
VCC 5V
GND GND
DO Digital Pin 7
AO Analog Pin A0

Power supply requirements: The sensor draws 15mA typical current, well within the Arduino Giga R1 WiFi's 500mA 5V rail capacity. The sensor operates reliably from 3.3V to 5V, but 5V operation provides maximum sensitivity and detection range.

Arduino Code - Read value from DO pin

The following implementation demonstrates digital flame detection using threshold-based binary output. This approach provides simple fire/no-fire status suitable for alarm systems and automated responses. The code continuously polls the digital output and provides immediate detection feedback via serial communication.

The digital detection method uses the sensor's built-in comparator circuit with adjustable threshold sensitivity. This configuration is ideal for applications requiring fast response times and definitive flame presence detection without requiring intensity measurement.

/* * This Arduino Giga R1 WiFi code was developed by newbiely.com * * This Arduino Giga R1 WiFi code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-giga/arduino-giga-r1-wifi-flame-sensor */ #define DO_PIN 2 // The Arduino Giga R1 WiFi pin connected to DO pin of the flame sensor void setup() { // initialize serial communication Serial.begin(9600); // initialize the Arduino's pin as an input pinMode(DO_PIN, INPUT); } void loop() { int flame_state = digitalRead(DO_PIN); if (flame_state == HIGH) Serial.println("The flame is NOT present => The fire is NOT detected"); else Serial.println("The flame is present => The fire is detected"); }

Detailed Instructions

For initial Arduino Giga R1 WiFi setup, refer to the Arduino Giga R1 WiFi Getting Started guide before proceeding.

  • Connect the Hardware: Wire the flame sensor to the Arduino Giga R1 WiFi according to the digital output wiring diagram. Ensure VCC connects to 5V, GND to GND, and DO to digital pin 7.
  • Install Arduino IDE: Open the Arduino IDE and configure it for the Giga R1 WiFi board. Select "Arduino Giga" from the board manager if not already configured.
  • Copy and Upload Code: Copy the provided code into a new Arduino sketch. Compile and upload to the Arduino Giga R1 WiFi. Verify successful upload completion.
  • Open Serial Monitor: Set the serial monitor to 9600 baud rate to observe flame detection status. The monitor will display real-time detection results.
  • Test Detection: Direct the flame sensor toward a flame source (candle, lighter, match). Observe the digital output status change and DO-LED indicator illumination.
  • Adjust Sensitivity: If the sensor doesn't respond appropriately, adjust the onboard potentiometer clockwise to increase sensitivity or counterclockwise to decrease sensitivity until reliable detection occurs.
  • Verify Operation: Confirm the serial output shows "flame is present" when detecting fire and "flame is NOT present" when no flame is detected. The response should be immediate (under 15ms).

Technical Note: The digital detection threshold can be fine-tuned using the potentiometer for different flame sizes and detection distances. Clockwise rotation increases sensitivity (detects smaller or more distant flames), while counterclockwise rotation decreases sensitivity (reduces false positives from ambient infrared sources).

Serial Monitor Output

COM6
Send
12:34:15 - The flame is present => The fire is detected 12:34:16 - The flame is present => The fire is detected 12:34:17 - The flame is NOT present => The fire is NOT detected 12:34:18 - The flame is NOT present => The fire is NOT detected 12:34:19 - The flame is NOT present => The fire is NOT detected 12:34:20 - The flame is present => The fire is detected 12:34:21 - The flame is present => The fire is detected 12:34:22 - The flame is present => The fire is detected
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Please keep in mind that if you notice the LED status remaining on constantly or off even when the sensor faces a flame, you can adjust the potentiometer to fine-tune the sensitivity of the sensor.

Arduino Code - Read value from AO pin

The analog implementation provides continuous infrared intensity measurement, enabling flame size estimation, distance calculation, and advanced fire monitoring applications. This approach outputs numerical values from 0-1023 (10-bit ADC resolution) corresponding to infrared intensity levels detected by the sensor.

Analog measurement is particularly useful for applications requiring flame intensity monitoring, multiple flame detection, or systems that need to differentiate between various infrared sources based on intensity levels.

/* * This Arduino Giga R1 WiFi code was developed by newbiely.com * * This Arduino Giga R1 WiFi code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-giga/arduino-giga-r1-wifi-flame-sensor */ #define AO_PIN A0 // The Arduino Giga R1 WiFi pin connected to AO pin of the flame sensor void setup() { // initialize serial communication Serial.begin(9600); } void loop() { int flame_value = analogRead(AO_PIN); Serial.println(flame_value); }

Detailed Instructions

For initial Arduino Giga R1 WiFi setup, refer to the Arduino Giga R1 WiFi Getting Started guide before proceeding.

  • Wire for Analog Output: Connect the flame sensor using the analog output wiring configuration. Ensure AO pin connects to analog pin A0 on the Arduino Giga R1 WiFi.
  • Upload Analog Code: Copy the analog reading code and upload it to the Arduino Giga R1 WiFi. The code configures A0 as analog input and reads 10-bit ADC values.
  • Open Serial Monitor: Set serial monitor to 9600 baud to observe continuous analog readings. Values will update continuously showing infrared intensity levels.
  • Test Flame Response: Direct the sensor toward flames of different intensities. Observe how analog values increase with stronger flames and decrease with weaker or more distant flames.
  • Record Baseline Values: Note the ambient infrared reading (typically 50-200) when no flame is present. This establishes the baseline for flame detection algorithms.
  • Verify Dynamic Range: Test with various flame sources to understand the sensor's full analog range. Typical values range from 200-1000 depending on flame intensity and distance.

Technical Note: The analog output is not affected by the potentiometer setting and provides the full dynamic range of the sensor's infrared detection capability. For production applications, consider implementing moving average filtering to reduce noise and improve measurement stability.

Serial Monitor Output

COM6
Send
156 158 162 687 724 891 947 982 995 1001 1018 672 534 298 147
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Project Ideas

Industrial Fire Safety System: Implement a multi-zone fire detection network using multiple flame sensors connected to the Arduino Giga R1 WiFi's digital inputs. The dual-core processor enables simultaneous monitoring of up to 20 sensors while the WiFi capability provides real-time alerts to facility management systems and emergency services.

Smart Home Fire Detection: Create an IoT-based fire monitoring system that integrates with home automation platforms. The Arduino Giga R1 WiFi's wireless connectivity enables smartphone notifications, automatic sprinkler activation, and emergency service alerts when flames are detected in critical areas like kitchens or workshops.

Gas Appliance Monitoring: Develop a flame monitoring system for gas water heaters, furnaces, or industrial burners. The analog output capability allows monitoring of flame stability and intensity, while the digital output can trigger safety shutoffs if flame failure is detected.

Laboratory Safety Monitor: Build a comprehensive laboratory safety system that monitors multiple fume hoods and experimental areas for flame or fire incidents. The Arduino Giga R1 WiFi's processing power enables data logging with timestamps, automated ventilation control, and integration with building management systems.

Welding Safety System: Create a specialized fire detection system for welding operations that can differentiate between normal welding arcs and actual fire emergencies. Use analog intensity thresholds and timing algorithms to reduce false alarms while maintaining safety responsiveness.

Data Logging Fire Monitor: Implement a fire detection system with SD card data logging capabilities. Record flame detection events with timestamps, intensity levels, and environmental conditions for fire safety analysis and compliance reporting.

Video Section

The accompanying video demonstrates the complete hardware assembly process and live code execution for both digital and analog flame detection modes. It covers proper sensor orientation for maximum detection range, potentiometer adjustment techniques for optimal sensitivity, and shows the expected serial monitor output patterns for various flame sources and distances.

Challenge Yourself

Challenge: Implement a multi-threshold flame detection system that classifies flame intensity into categories (small, medium, large) based on analog readings. Use LED indicators or buzzer patterns to indicate different threat levels.

Challenge: Create a flame position tracking system using multiple flame sensors arranged in a grid pattern. Calculate approximate flame location using triangulation algorithms and the Arduino Giga R1 WiFi's processing capabilities.

Challenge: Build a wireless flame detection network where multiple Arduino Giga R1 WiFi units with flame sensors communicate fire status to a central monitoring station. Implement mesh networking for redundant communication paths in large facilities.

Challenge: Develop a flame detection system with automatic fire suppression capability. Interface the flame sensor with relay modules to control water solenoids, CO2 systems, or alarm horns when fire is detected. Include manual override and system status monitoring.

Challenge: Implement a machine learning-based fire detection algorithm that learns normal infrared patterns and detects anomalies indicating fire conditions. Use the Arduino Giga R1 WiFi's expanded memory to store training data and classification models for improved accuracy and reduced false alarms.

Learn More

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!