Arduino with Fire Sensor, LED and Buzzer (Code)

Arduino with Fire Sensor, LED and Buzzer

Hello everyone! Today I will show you how to use a fire sensor with arduino. The required kits are :

  1. An arduino and its adapter
  2. Few jumper Wires
  3. A fire sensor
  4. A led
  5. A breadboard
  6. A buzzer
  7. A lighter
There are 4 pins on the digital sound sensor. They are :
  1. AO-Analog pin
  2. GND-Ground pin
  3. VCC-positive power pin
  4. DO-digital output pin
There are two legs on a LED. The longer leg is positive and the shorter leg is negative. A buzzer has similar legs. The steps to setup hardware are listed below:
  • Connect "VCC" pin of the sensor to 5V pin on the arduino.
  • Connect "GND" ground pin to GND pin on the arduino.
  • Connect "AO" analog output pin to any analog or digital pins on the arduino.In this tutorial I connected it with A2
  • Connect longer LED leg to pin 13 on the arduino. If you want to use anyother pin on the arduino, you need to use a 220 ohm resistor.
  • Connect shorter LED leg to GND pin on the arduino.
  • FIx buzzer on the breadboard.
  • Connect longer buzzer leg to pin 11(or any other pin) on the arduino.
  • Connect shorter buzzer leg to GND pin on the arduino.
The setup is complete. Now, upload the code and enjoy.

Check out the tutorial

const int ledpin=13; // ledpin,flamepin and buzpin are not changed throughout the process
const int flamepin=A2;
const int buzpin=11;
const int threshold=200;// sets threshold value for flame sensor
int flamesensvalue=0; // initialize flamesensor reading
void setup() {
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
pinMode(flamepin,INPUT);
pinMode(buzpin,OUTPUT);
}
void loop() {
flamesensvalue=analogRead(flamepin); // reads analog data from flame sensor
if (flamesensvalue<=threshold) { // compares reading from flame sensor with the threshold value
digitalWrite(ledpin,HIGH); //turns on led and buzzer
tone(buzpin,100);
delay(1000); //stops program for 1 second
}
else{
digitalWrite(ledpin,LOW); //turns led off led and buzzer
noTone(buzpin);
}
}

Comments

  1. What type of sensor it is? If it's a 5 way flame sensor will that work the same way??

    ReplyDelete
  2. Sir will you give that for purchase ...

    ReplyDelete
  3. why does it detect other than fire like sun light etc....

    ReplyDelete
  4. These LED Street Lighting System are Incredible! The LED Technology is comparatively new into the world which comes with a added benefit of collecting the data which can be used for analyzing the traffic pollution

    ReplyDelete
  5. Where to write code in proteus

    ReplyDelete

Post a Comment

If you have any problems, please do notify me.