darkiller321863
Published © GPL3+

KY-026 Flame sensor tutorial

A tutorial for the KY-026 Flame sensor model

IntermediateProtip1,082
KY-026 Flame sensor tutorial

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
wire
×6
Breadboard (generic)
Breadboard (generic)
×1
KY-026 Flame sensor
×1
LED (generic)
LED (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Flame sensor diagram

A diagram to know how to connect flame to arduino

Code

KY-026 Flame sensor

C/C++
A program to power a led while the flame is activated
#define led 3 // define the LED pin
#define digitalPin 2 // KY-026 digital interface
int digitalVal; // digital readings
void setup()
{
  pinMode(led, OUTPUT);
  pinMode(digitalPin, INPUT);
  pinMode(digitalPin, INPUT_PULLUP);
}
void loop()
{
  // Read the digital pin
  digitalVal = digitalRead(digitalPin);
  if (digitalVal == HIGH) // if flame is detected then
  {
    digitalWrite(led, HIGH); // turn ON Arduino's LED
  }
  else
  {
    digitalWrite(led, LOW); // turn OFF Arduino's LED
  }
}

Credits

darkiller321863
2 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.