Introduction
A
smoke detector is a device that senses
smoke, typically as an indicator of fire. Commercial security devices issue a signal to a fire alarm control panel as part of a fire alarm system. It is also a household detector, known as a
smoke alarm. Generally, it issues a local audible or visual alarm from the
detector itself. (Source
Wikipedia).
Part of list:- Arduino
- Smoke sensor MQ-5
- Bread Board
- Hookup wires
- Buzzer
- Led.
Connection From Sensor To Arduino Board:
- The first pin can take A0 or D0 connected to an Arduino board.
- The second pin Gnd can be connected to Gnd to an Arduino board.
- The third pin Vcc can be connected to 5V to an Arduino board.
Connection From Led To Arduino Board:
- The positive pin on the led can be connected to digital pin 13.
- The negative pin on the led can be connected to Gnd.
Connection From Buzzer To Arduino Board:
- The positive pin on the buzzer can be connected to digital pin 10.
- The negative pin on the buzzer can be connected to Gnd.
Programming- const int sensorpin = A0;
- int led = 13;
- int buzzer = 10;
- int sensorValue = 0;
- void setup()
- {
- pinMode(led, OUTPUT);
- pinMode(buzzer, OUTPUT);
- Serial.begin(9600);
- }
- void loop()
- {
- Serial.println("Welcome to c#corner");
- sensorValue = analogRead(sensorpin);
- Serial.println(sensorValue);
- if (sensorValue < 100)
- {
- Serial.println("Smoke Detected");
- Serial.println("LED on");
- digitalWrite(led, HIGH);
- digitalWrite(buzzer, HIGH);
- delay(1000);
- }
- digitalWrite(led, LOW);
- digitalWrite(buzzer, LOW);
- delay(sensorValue);
- }
Explanation
When the smoke detect the LED can be HIGH.
The value can be shown in the serial monitor accurately.
Then the smoke detected automatically the buzzer can produce the sound.
Output
Read more articles on Arduino: