Watch video directly on YouTube
Hardware list
- IR Flame Sensor module
- any Arduino board
Optional: other parts required to control 12 V device.
IR Flame Sensor
This sensor is able to detect a flame by sensing light wavelength between 760 – 1100 nanometers. The test distance depends on the flame size and sensitivity settings – during my tests a reliable maximum was around 1 meter. The detection angle is 60 degrees, so the flame does not have to be right in front of the sensor.
The sensitivity is adjustable with the blue digital potentiometer – if it is too high, then you will get false positives because of ordinary light. The working voltage is compatible with Arduino (3.3 – 5 V), so the connection is straightforward using just three wires.
There are two sensor outputs:
- Digital – sending either zero for nothing detected or one for a positive detection
- Analog – sending values in a range representing the flame probability/size/distance; must be connected to a PWM capable input
Circuit
The circuit diagram show only the sensor connection. If you would also like to control 12 V devices (as shown in the video), then follow the instructions from the article Control 12V devices with Arduino or Raspberry Pi.
Code
/*
Project name: flameSensor
Description: Fire detector based on Arduino with a flame sensor. When fire is detected, turn on a 12 V device.
Created by Pavel (DarkBlueBit.com) in 2016 <https://darkbluebit.com>
*/
// lowest and highest analog sensor readings:
const int sensorMin = 0;
const int sensorMax = 1024;
const int pinDevice = 2; // 12 V device
void setup() {
pinMode(pinDevice, OUTPUT);
}
void loop() {
// read the sensor on analog A0:
int sensorReading = analogRead(A0);
// map the sensor range (four options):
// ex: 'long int map(long int, long int, long int, long int, long int)'
int range = map(sensorReading, sensorMin, sensorMax, 0, 3);
// range value:
switch (range) {
case 0: // close fire
digitalWrite(pinDevice, HIGH);
delay(20);
break;
case 1: // distant fire
digitalWrite(pinDevice, LOW);
break;
case 2: // no fire
digitalWrite(pinDevice, LOW);
break;
}
delay(10); // delay between reads
}
0 Comment for "Arduino Uno Fire Detector 4PIN Flame detection Sensor "