Arduino flame sensor not working, and reading not appearing on LCD

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);
const int fireSensor = 5;
void setup() {
lcd.init();
lcd.backlight();

pinMode(fireSensor, INPUT);

}
void loop(){
int fireValue = digitalRead(fireSensor);
if (fireValue == HIGH) {

lcd.setCursor(0, 1);
lcd.print("Fire Alarm");
digitalWrite(redLED, HIGH);

}
else if(fireValue == LOW) {

lcd.setCursor(0, 1);
lcd.print("No Fire Detected");
digitalWrite(redLED, HIGH);

}
delay(2500);
}

This is my code and ive added an image of the sensor im using. i have connected the DO pin to D5 and the vcc pin to 5v. there seems to be twisting screw on the top of the blue part of the sensor, im not sure if it affects anything. im using a remote controller to test the sensor (something i saw in a video) because i cant use a fire close to the sensor, but even then my bic lighter doesnt seem to register.
download

Please use code tags when posting code (<code> button in post editor).

Did you connect the grounds?

The blue potentiometer with screw is a sensitivity adjustment.

First off, I apologize for not using the code button, this is my first time using the forum.

Second, yes I have connected the G pin to GND on my breadboard.

and about the potentiometer, if i tighten it clockwise does that decrease or increase sensitivity?

Turn the screw to determine the effect. Also, consult the documentation, if there is any.

How can i test the sensitivity if I'm using a digital pin? Also is the remote controller method correct or will it not work?
i hope you will pardon my lack of knowledge i havent worked on such a sensor before.

Your program prints out the value read from the digital pin. Remove this line,
delay(2500);
or replace the delay with a smaller value, and while watching the LCD, turn the screw until the flame is detected.

1 Like

Will try now, give me a few moments.

I would try first seeing in the Serial monitor what you're getting, if anything.

so add

Serial.begin(9600);

to setup(), and

 Serial.println("No Fire Detected");

where the similar lcd.print line is, similarly

Serial.println("Fire Alarm");

also where appropriate for you.

Lastly, just like there's an adjustment screw on that sensor, on the back of the LCD there is likely a small potentiometer to adjust the contrast. Sometimes they are set poorly from the factory, at least I know it's happened to me.

Ok so i have tried your method, i put the delay on the true statement. the issue now is that is instead of saying "fire alarm" the lcd says "fire alarmdetected" how do i fix this?

  lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print("Fire Alarm");

and

  lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print("No Fire Detected");
1 Like

Just print the digital output on the serial monitor as 1s and 0s, and watch that while adjusting the screw, with flame present or flame not present. You should find a setting that reliably detects flame.

"Flame detected" could correspond to either be a 1 or a 0, depending on how the sensor is designed.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.