How to make fire alarm system with arduino.

Posted by moudud 14/05/2019 0 Comment(s)

 

How to make fire alarm system with arduino.
 
 


Circuit Diagram :

 


 

 

Connections
BuzzerPinArduino pin
VCCD2
GNDGND

Flame Sensor

VCCVCC
GNDGND
D0D3

 

 

 


Code

 

 

// constants won't change. They're used here to set pin numbers:
const int buzzerPin = 2;     // the number of the buzzer pin
const int sensorPin = 3;      // the number of the sensor pin

 

// variables will change:
int sensorState = 0;         // variable for reading the sensor status

 

void setup() {
  // initialize the buzzer pin as an output:
  pinMode(buzzerPin, OUTPUT);
  // initialize the sensor pin as an input:
  pinMode(sensorPin, INPUT);
}

 

void loop() {
  // read the state of the sensor value:
  sensorState = digitalRead(sensorPin);


  
  if (sensorState == LOW) {
    // turn buzzer on:
    digitalWrite(buzzerPin, HIGH);
    
  } else {
    // turn buzzer off:
    digitalWrite(buzzerPin, LOW);
  }
}


 

 

 

Write a Comment