Sahar Soleymaniniaz faghih
Published © GPL3+

Arduino UNO based fire and smoke (gas) detection system

An early warning system designed using Arduino UNO and a smoke sensor to detect fire hazards and trigger an immediate alarm.

BeginnerFull instructions provided3 hours72
Arduino UNO based fire and smoke (gas) detection system

Things used in this project

Story

Read more

Code

Gas code

Arduino
This Arduino code reads analog values from two input pins (A0 and A1) and turns an LED on or off based on those readings.
void setup() { 
 pinMode(13, OUTPUT); 
 Serial.begin(9600); 
} 
 
void loop() { 
  int valA0 = analogRead(A0); 
  int valA1 = analogRead(A1); 
  Serial.print("A0: "); 
  Serial.print(valA0); 
  Serial.print(", A1: "); 
  Serial.println(valA1); 
  
  if (valA0 < 800 ||valA1 > 300) { 
    digitalWrite(13, HIGH); 
  } else { 
    digitalWrite(13, LOW); 
  } 
 
  delay(100); 
}

Credits

Sahar Soleymani
3 projects • 0 followers
niaz faghih
3 projects • 0 followers

Comments