Flame / Light sensor Module KY-026

  • Flame / Light sensor Module
Below the corresponding code:

an example project for the flame Sensor.
int Relay = 7 ; // Pin for relay
int Buzzer = 5; //Pin for buzzer
int RedLed = 6 ;// The pin for the RedLed
int GreenLed = 8 ;
int Digitalpin = 3; 
int Analoogpin = A3; // define the flame sensor interface
 
int val ;// define numeric variables val
float sensor; //read analoog value

// here i set up the tones, you can change them @ void loop.
int tones[] = {261, 277, 293, 311, 329, 349, 369, 392, 415, 440, 466, 493, 523 ,554};
//              1    2    3    4    5    6    7    8    9    10   11   12   13   14
// You can add more tones but i added 14. Just fill in what tone you would like to use, @ void loop you see " tone(Buzzer, tones[12]); " below,  digitalWrite(Buzzer, HIGH);
// here you can change the tones by filling in a number between 1 and 14
 
void setup ()
{ 
  Serial.begin(9600);
  pinMode (Relay, OUTPUT) ;
  digitalWrite(Relay, LOW);
  pinMode (Buzzer, OUTPUT) ;
  digitalWrite(Buzzer, LOW);
  pinMode (RedLed, OUTPUT) ;// define RedLed as output interface
  pinMode (GreenLed, OUTPUT) ;
  pinMode (Digitalpin, INPUT) ;//
  pinMode (Analoogpin, INPUT) ;// output interface defines the flame sensor
  //+++++++++++++++++++++++++++++++++++++++++++
  //Part of buzzer tones
  for (int i = 0; i < Buzzer; i++)     {
}
  
}
 
void loop ()
{
  sensor = analogRead(Analoogpin);
  Serial.println(sensor);  
 
  val = digitalRead (Digitalpin) ;// digital interface will be assigned a value of 3 to read val
    if (val == HIGH) // When the flame sensor detects a signal, RedLed flashes
  {
    digitalWrite (RedLed, HIGH);
    digitalWrite(Buzzer, HIGH);
    tone(Buzzer, tones[6]);
    delay (100);
    digitalWrite (RedLed, LOW);
    digitalWrite(Buzzer, LOW);
    noTone(Buzzer);
    delay (100);
    digitalWrite (RedLed, HIGH);
    digitalWrite(Buzzer, HIGH);
    tone(Buzzer, tones[1]);
    delay (100);
    digitalWrite (RedLed, LOW);
    digitalWrite(Buzzer, LOW);
    noTone(Buzzer);
    delay (100);
    digitalWrite(Relay, HIGH);
// Set relay to LOW if you want the alarm to switch off a device, setting the device to HIGH will turn on a device for example a sprinkler
// Then un-Comment //  digitalWrite(Relay, HIGH); at the else statement at the bodem of the code.
    delay (100);
    digitalWrite (RedLed, HIGH);
    digitalWrite (GreenLed, LOW);
    digitalWrite(Buzzer, HIGH);
    tone(Buzzer, tones[3]);
    delay (100);
  }
  else
  {
    digitalWrite (GreenLed, HIGH);
    digitalWrite (RedLed, HIGH);
    delay(10);
    digitalWrite (RedLed, LOW);
    digitalWrite(Buzzer, HIGH);
    noTone(Buzzer);
//  digitalWrite(Relay, HIGH); Uncomment if you want the alarm to switch off a device, when flames are detected.
//  for example something that works with gas.
  }
  delay(1000);
}

SCHEMATIC:
Arduino GND --> Module G
Arduino +5V --> Module +
Arduino digital 4 --> Module D0
Arduino A3 --> Module A0
Specifications
Wavelengths: 760 nm to 1100 nm
Most sensitive: 60 degree
Working voltage: DC 3V - 5.5V

Write a review

Please login or register to review

Flame / Light sensor Module

  • Webwinkel Keurmerk en klantebeoordelingen

  • 14 dagen bedenktijd 
  • Verzendkosten voor eigen rekening
  • Product Code: KY-026
  • Availability: 14
  • 2.49€

  • Ex Tax: 2.06€

Similar Products

2 Color LED Module RG Small

2 Color LED Module RG Small

Below the corresponding code:// Arduino test code for KY011 int redpin = 11; // select the pin for ..

2.29€ Ex Tax: 1.89€

Hall Magnetic Sensor Module

Hall Magnetic Sensor Module

Im Folgenden finden Sie den entsprechenden Code zu sehen:Ein Beispiel für ein Projekt für die K..

2.36€ Ex Tax: 1.95€

Infrared Receiver Module

Infrared Receiver Module

Below you can see the corresponding code.an example project for the Infrared Receiver//Author: Danny..

2.29€ Ex Tax: 1.89€

Hit/Shock Sensor Module

Hit/Shock Sensor Module

Below you can see the corresponding code: An example project for the Shock Sensor//Author: Danny va..

2.36€ Ex Tax: 1.95€