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!
Argel Enriquo Galante
Created March 6, 2016

Detector de incêndio Florestal Inteligente

This system was designed as a faster way to detect fires outbreaks avoiding irreversible damage to the environment and the resident famile

Intermediate4 hours872
Detector de incêndio Florestal Inteligente

Things used in this project

Story

Read more

Schematics

Esquema

Code

Detector

Arduino
IDE ARDUINO 1.0.6
#include "SIM900.h"

#include <SoftwareSerial.h>

#include "call.h"
#include "LiquidCrystal.h"
#define Luz_Fundo 7


int led = 7;
int ledgrin = 11;
int ledred = 12;
int buzzer = 7;

int pino_A0 = A0;
int mq2 = A1;
int mq3 = A2;
int valmq3 = 0;
int valmq2 = 0;
int valor_a = 0;

LiquidCrystal lcd(9, 8, 5, 4, 3, 2);
CallGSM call;

void setup() {
  Serial.println("Testando GSM Shield...");
     
     //Inicia a configuracao do Shield
     if (gsm.begin(2400))
          Serial.println("nstatus=READY");
     else Serial.println("nstatus=IDLE");
  
  Serial.println(" DETETOR DE CHAMAS ");
 
  pinMode(11,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(10,OUTPUT);
  
  Serial.begin(9600);
  lcd.begin(16, 2);
  
}

void loop(){

 delay(1000);
 
  int valor_a = analogRead(pino_A0);
  valmq2 = analogRead(mq2);
  valmq3 = analogRead(mq3);
  Serial.print("sensor de chama: ");
  Serial.println(valor_a);
   Serial.print("sensor de gas: ");
  Serial.println(valmq2);
  Serial.print("setor1");
  Serial.println(valmq3);
  
 if (valor_a < 450)
  {   
   
  digitalWrite(12,1);
  digitalWrite(7,1);
  digitalWrite(11,0);
  tone(12,500,1000); 
  lcd.clear();
  lcd.setCursor(4,0);
  lcd.print("ALERTA");
  lcd.setCursor(0,1);
  lcd.print(" FIRE DETECTE SETOR 1 ");
  
  delay(1000);
   
      Serial.println("FIRE DETECTED");
      Serial.println("Discando Para Central (9 1 1) ....");
      call.Call("90909913830xx");
  delay(10000);
  
  Serial.println("Desligando...");
  call.HangUp();
      digitalWrite(led, HIGH);
      delay(1000);
      digitalWrite(led, LOW);
   }
  
 
if(valmq3 >=30){
  Serial.println("ALERTA");
  digitalWrite(12,1);
  digitalWrite(7,1);
  digitalWrite(11,0);
  tone(12,1000,2000);
   lcd.clear();
  lcd.setCursor(4,0);
  lcd.print("ALERTA");
  lcd.setCursor(0,1);
  lcd.print("FOCO DETECTED SETOR 2")
  Serial.println("Discando Para Cental (9 1 1)....");
  call.Call("90909913830xx");
  delay(10000);
  
  Serial.println("Desligando...");
  call.HangUp();
  
  delay(1000);

}


 
if(valmq2 >=20){
  Serial.println("FOCO DETECTED SETRO 3")
  digitalWrite(12,1);
  digitalWrite(7,1);
  digitalWrite(11,0);
  tone(12,500,1000);
   lcd.clear();
  lcd.setCursor(4,0);
  lcd.print("ALERTA");
  lcd.setCursor(0,1);
  lcd.print("FOCO DETECTADO SETOR3")
  Serial.println("Discando....");
  call.Call("90909913830xx");
  delay(10000);
  
  Serial.println("Desligando...");
  call.HangUp();
  
  delay(1000);

 
  
  
  
}
else{
  digitalWrite(11,1);
  digitalWrite(12,0);
  digitalWrite(7,0);
  lcd.clear();
  
  
  lcd.setCursor(0,0);
  lcd.print("DETECTOR DE FOGO");
  lcd.setCursor(0,1);
  lcd.print("GAS AMB =");
  

  
  lcd.setCursor(8,1);
  lcd.print("0,");
  lcd.setCursor(9,1);
  lcd.print(valmq2);
  lcd.setCursor(12,1);
  lcd.print("%");
 
 
  
 
   
  
  


}
  
}




 
 
 

 
  
  
  

  
  
  
 
    
 
  

Credits

Argel Enriquo Galante

Argel Enriquo Galante

2 projects • 2 followers
Técnico em Informática

Comments