Flame Sensor with Arduino
Keep an eye on a candle you have burning or a fireplace!
Written By: Madeleine Schappi


Difficulty
Easy

Steps
5
Introduction
Flame sensors can detect flame and infrared light sources.
In this guide, you will learn how to use a flame sensor module with the Arduino. The flame sensor can be used to keep an eye on a candle you have burning or a fireplace.
Completing this guide will enable you to monitor a project or as a safety precaution to cut a device on or off.
Step 1 Connect Arduino 5V to the Flame Sensor

-
Connect Arduino 5V to the Flame Sensor.
Step 2 Connect Ground to the Flame Sensor

-
Connect Ground to the Flame Sensor.
Step 3 Connect Analogue 0 to the Module

-
Connect Analogue 0 to the Flame Sensor.
Step 4 Code for the Flame Sensor
const int sensorMin = 0; // sensor minimum const int sensorMax = 1024; // sensor maximum void setup() { Serial.begin(9600); } void loop() { int flameSensor = analogRead(A0); int range = map(flameSensor, sensorMin, sensorMax, 0, 3); // range value: switch (range) { case 0: Serial.println("Fire within 40cm"); break; case 1: // A fire between 1-3 feet away. Serial.println("Fire between 40cm - 1m"); break; case 2: // No fire detected. Serial.println("No Fire"); break; } delay(1000); // 1 second be }
-
Copy the code and upload it in the IDE.
-
Open the Serial Monitor
-
The sensor will detect the IR wavelengths given off by the flames.
Step 5 Test your Flame Sensor with a Flame!
-
This part of the guide should be done under Adult Supervision!
-
Test your Flame Sensor with a Flame!