In this tutorial, we are going to make a Simple "Smoke Detector" Alarm using an ATtiny85 microcontroller. In a world with so much instability, we are always in danger of being caught by a fire, which may be harmful to both the environment and individuals. If we don't take any safety precautions, the odds of being caught in a fire are substantially higher. As a result, a smoke detector should always be present to alert people to the presence of a fire, allowing them to take appropriate action to avoid any loss or damage. This circuit is simple and quick to construct, and it includes an MQ2 smoke that can sense any fire, smoke, or gas. For output, the buzzer is used as an indicator.
Talking about the MQ2 Sensor, two layers of steel surround the Sensor. The voltage is used as the output, dependent on the gas concentration. To put it another way, voltage is proportional to the amount of gas present. The voltage would be more prominent when the concentration of smoke is higher. Similarly, as the concentration decreases, the voltage drops.
PCBWay commits to meeting the needs of its customers from different industries in terms of quality, delivery, cost-effectiveness, and any other demanding requests. As one of the most experienced PCB manufacturers in China. They pride themselves to be your best business partners as well as good friends in every aspect of your PCB needs.
Smoke Detector Circuit
Hardware Components
Arduino Code
#define MQ2pin (2) // PB2 Of ATtiny85
float sensorValue; // variable to store sensor value
int Buzzer = 3; // PB3 Output Buzzer
void setup()
{
pinMode(Buzzer, OUTPUT);
delay(20000); // allow the MQ-6 to warm up
}
void loop()
{
sensorValue = analogRead(MQ2pin); // read analog input pin 0
if(sensorValue > 300) // Smoke Detected
{
digitalWrite(Buzzer,HIGH);
delay(2000);
digitalWrite(Buzzer,LOW);
}
delay(2000); // wait 2s for next reading
}