Arduino Smoke Detector With LED

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

Home » Coding » Arduino Smoke Detector With LED

Introduction of the Project

Get your DIY on and safeguard your space with our Arduino Smoke Detector With LED! This innovative project allows you to build a custom smoke detector with the power of Arduino technology, complete with a bright LED to alert you to potential danger. Keep your home or office safe and stylish with this must-have gadget that’s sure to impress.

In this Arduino project, we will glow a red colored LED if the gas sensor detects the smoke. This is a mini reflection of the fire safety system.

 

Supplies

In order to make an Arduino Smoke Detector with LED, we will require the following components: To build physical projects, you can purchase the components online or from any electronics center. For online projects, we are using the TinkerCad website.

Components

Circuit Diagram

Arduino Smoke Detector With LED

Steps To Make An Arduino Smoke Detector With LED

Step 1: First, we must collect all the components on the Digital Board or Physical Table.

LED:

Step 2: Connect the Cathode terminal of it to the GND pin of the Arduino.

Step 3: Connect the Anode terminal of it to the 5-number pin of the Arduino through a resistor, as shown in the circuit.

Gas Sensor:

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

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

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

Source Code

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


digitalWrite(led, LOW);


sensorValue = analogRead(sensor);
if(sensorValue >= 100)
digitalWrite(led, HIGH);


delay(2000);
}

Explanation of the Code

1. In the beginning, we initialized two variables to which the respective component is connected to their respective Arduino pin number.

2. In the setup function, we have configured the pins of the Arduino for input and output purposes.

3. In the loop function, we have declared a variable to store the value of the gas sensor. After this, we are reading the value from the sensor.

4. If the value is greater than 100, we are glowing the LED else. It will not glow.

5. In the end, we used a delay function, which takes time in milliseconds.

Output

Once you have successfully run the source code, you will get the result as shown below.

Arduino Smoke Detector With LED

On starting the simulation, the LED will glow if the Smoke’s value detected using the Gas sensor is greater than 100.

 

More Arduino Projects>>>

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *