JC

ROBO | Flame Sensor

Functions

  • detects the presence of fire using the infrared light emitted by it

    • The IR photodiode detects IR radiation and sets a value.

    • The LM393 comparator compares a set value and provides a digital output depending on if it reaches the threshold.

    • An analog value can also be provided to determine the intensity of the flame, which is directly from the terminal.

    • The sensitivity can be adjusted to avoid triggering.

Pins

  • VCC Pin uses 3.3V or 5V

  • GND Pin connects to GND

  • Digital Pin can read from high or low only.

  • Analog Pin can read a specific value

Pin Connections

Sensor

  • D0 Pin → Pin 2

  • GND → GND

  • VCC → 5V

Green LED

  • negative pin → GND

  • positive pin → Pin 6

Red LED

  • negative pin → GND

  • positive pin → Pin 5

Buzzer

  • negative pin → GND

  • positive pin → Pin 12

Code

Using D0 Pin

int sensor=2;
int green=6;
int red=5;
int buzzer=12;

void setup()
{
  pinMode(sensor, INPUT);
  pinMode(green, OUTPUT);
  pinMode(red, OUTPUT);
  pinMode(buzzer, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  if (digitalRead(sensor) == 1 )
  {
    digitalWrite(green, LOW);
    delay(0);
    digitalWrite(red, HIGH);
    digitalWrite(buzzer, HIGH);
    delay(500);
    digitalWrite(red, LOW);
    digitalWrite(buzzer, LOW);
    delay(0);
    Serial.println("** Warning!!!!   Fire detected!!! **");
  }
  else
  {
    digitalWrite(green, HIGH);
    digitalWrite(red, LOW);
    digitalWrite(buzzer, LOW);
    Serial.println("No Fire detected");
  }
  delay(100);
}