Arduino Flame Sensor Module Issues

My flame sensor is failing to detect flame however it is detecting movement???

My flame sensor:

My code:

int led_pin = 22; // Assigns led to digital pin 22
int flame_sensor_pin = 23; // Assigns flame sensor to pin 23
int flame_pin = HIGH; // state of sensor

void setup() {

pinMode (led_pin, OUTPUT); // declaring led pin as ouput

pinMode ( flame_sensor_pin, INPUT); // declaring sensor pin as input for Arduino

Serial.begin (9600); // setting baud rate at 9600
}

void loop() {

flame_pin = digitalRead (flame_sensor_pin); // reading from the sensor and writing it to flame_pin for IF statement

if (flame_pin == LOW) // Telling sensor to print to serial port and activate LED if there is fire.

{

Serial.println ("We're all gonna die!!!!!!!!!!1");
digitalWrite (led_pin , HIGH);
}

else

{

Serial.println (" All is well");

digitalWrite ( led_pin, LOW); // Otherwise keep led off.
}
}

1 Like

So... I actually solved this problem myself immediately after posting this but I thought I'd post it because someone might run into this problem and not find too much information like I did.

This model of flame sensor is called a Near - IR sensor and it works by detecting light within the 0.7u to 1.1u range. Here is a picture to help visualization:

Well... The reason my flame sensor wasn't working correctly was:

  1. A code error that had the flame_pin == LOW as opposed to HIGH so it was activating the LED when there was no input.

  2. But, the sensor was detecting the light within my work area that was emitted by a regular light bulb because the light bulb works but heating up a filament and the heated filament emits light within the detectable range of the sensor. So, everything was as it should be!

1 Like