Arduino Smoke Detector With Buzzer

by | Mar 4, 2023 | Arduino, Basic Coding, Coding

Home » Coding » Arduino Smoke Detector With Buzzer

Introduction of the Project

Are you looking for an exciting and practical DIY project that could help keep you and your loved ones safe? Look no further than building an Arduino Smoke Detector with Buzzer! In this DIY Arduino project, we will produce sound using a buzzer if the gas sensor detects the smoke. With easy-to-find components and our simple step-by-step instructions, you’ll be up and running in no time. This project is a mini reflection of the fire safety system.

Not only will you gain valuable knowledge about programming and circuitry, but you’ll also have the peace of mind that comes with knowing you’re prepared in case of an emergency. So what are you waiting for? Start building your Arduino Smoke Detector with Buzzer today, and be the envy of all your tech-savvy friends!

 

Supplies

In order to make a Smoke Detector using a Buzzer, we will require the following components. For physical projects, the components can be purchased online or from any electronics center. For online projects, the TinkerCad website can be used.

Components

Circuit Diagram

Arduino Smoke Detector With Buzzer

Steps To Build An Arduino Smoke Detector With Buzzer

Step 1: The first thing to do is to assemble all the components on the Digital Board or Physical Table.

Piezo:

Step 2: Then connect the +ve terminal of Piezo to the ground (GND) pin of the Arduino.

Step 3: And connect the -ve terminal of Piezo to the 5-number pin of the Arduino.

Gas Sensor:

Step 4: Connect the B1, H2, and B2 terminals of the Gas sensor to the 5V pin of the Arduino.

Step 5: Connect the H1 & A1 terminal of the Gas sensor to the GND pin of the Arduino.

Step 6: Connect the A2 terminal of the Gas sensor to the A0 number pin of the Arduino.

Source Code

int buzzer = 5;
int sensor = A0;
void setup()
{
pinMode(5, OUTPUT);
pinMode(A0, INPUT);
}
void loop()
{
int sensorValue;


digitalWrite(buzzer, LOW);


sensorValue = analogRead(sensor);
if(sensorValue >= 500)
digitalWrite(buzzer, HIGH);
}

Explanation of the Code

1. Firstly, we initialized two variables, “buzzer” and “sensor” to which the respective component is connected to their respective Arduino pin number.

2. In the setup function, we have configured pin numbers 5 and A0 of the Arduino for input and output purposes.

3. In the loop function, we have declared a variable “sensorValue” to store the value of the gas sensor. Then we are reading the value from the sensor.

4. If the “sensorValue” is greater than or equal to 500, we give power to the piezo, which makes a buzzing sound.

Output

We have demonstrated the final output of this Arduino project below.

Arduino Smoke Detector With Buzzer

On starting the simulation, the Buzzer will produce a sound if the Smoke’s value detected using the Gas sensor is greater than 500.

 

More Arduino Projects>>>

You May Also Like To Create…