Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
csw
Published © GPL3+

Flame sensor with arduino

This project will use KY-026 sensor to see if there is a flame and print it in the Serial moniter

BeginnerFull instructions provided12,192
Flame sensor with arduino

Things used in this project

Hardware components

Arduino uno
Arduino Mega/Due/Nano will work
×1
ky-026 Flame sensor
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Shematics for Flame sensor

D0 to arduino 7
VCC to arduino 5+
GND to arduino GND

Code

Flame Sensor

C/C++
// Flame Sensor Module

int LED = 13; // Use the onboard Uno LED
int isFlamePin = 7;  // This is our input pin
int isFlame = HIGH;  // HIGH MEANS NO FLAME

void setup() {
  pinMode(LED, OUTPUT); // put onboard LED as output
  pinMode(isFlamePin, INPUT); //flame sensor should be input as it is giving data
  Serial.begin(9600); //begin Serial communication
  
}

void loop() {
  isFlame = digitalRead(isFlamePin);//Readd the data gien by the flame sensor
  if (isFlame== LOW)  //if it is low
  {
    Serial.println("FLAME, FLAME, FLAME"); //Print Flame Flame
    digitalWrite(LED, HIGH);  //LED on
  }
  else                           //if not
  {                               
    Serial.println("no flame"); //print no  flame
    digitalWrite(LED, LOW);    //off the LED
  }
}

Flame Sensor

C/C++
// Flame Sensor Module

int LED = 13; // Use the onboard Uno LED
int isFlamePin = 7;  // This is our input pin
int isFlame = HIGH;  // HIGH MEANS NO FLAME

void setup() {
  pinMode(LED, OUTPUT);
  pinMode(isFlamePin, INPUT);
  Serial.begin(9600);
  
}

void loop() {
  isFlame = digitalRead(isFlamePin);
  if (isFlame== LOW)
  {
    Serial.println("FLAME, FLAME, FLAME");
    digitalWrite(LED, HIGH);
  }
  else
  {
    Serial.println("no flame");
    digitalWrite(LED, LOW);
  }

Credits

csw

csw

0 projects • 3 followers

Comments