Smoke Detector with Arduino Uno

In this post we will discuss and see how to use a Smoke Detector / Sensor with Arduino Uno for detecting smoke. As usual we will use our favorite prototyping equipment, the Atmel chip based Arduino Uno (you may use an 8-bit PIC family processor also as an alternative, but then you will have to use MPLAB for burning the C programs and some USB to TTL programmer hardware) for writing the embedded C programs to interface with the sensors. Before jumping into the wiring and code for using a Smoke Detector / Sensor with Arduino Uno, a short video of my experiement with smoke detector / sensor using an incense stick is provided below. In the video you will notice that once smoke is detected, an alert saying "Smoke detected" is displayed in the serial window of the Arduino IDE.


Connect a Smoke Detector / Sensor with an Arduino Uno?

We will be using the MQ-2 series Gas/Smoke detector / sensor with Arduino Uno, for our experiment. The MQ-2 sensor has 4 pins, the wiring for the sensor and the Arduino board is shown below. In case you want to use the Digital output pin (D0) then remember to use the gas sensitivity adjustment potentiometer (can be found on the reverse side of the chip) as per your requirement. Otherwise, if you are using the Analog output pin to read the sensor then no need for using the in-built potentiometer. Use the gas sensitivity graph on Page 2 of the datasheet here to play around with the threshold values in the program below. Not only gas/smoke, but you can also detect other types of gases. Given below is my account of using this sensor. For more details on gas sensor you may refer this site.

MQ2 Smoke Detector / Senor with Arduino Uno
Figure 1 - Wiring an MQ-2 Smoke detector / sensor with an Arduino Uno


You should connect them as follows:

MQ-2 Sensor          Arduino
----------------          ----------
Vcc                 --->   5V
GND               --->   GND
D0                   --->   (not used)
A0                   --->   A0

Embedded C Program for reading the Smoke detector / sensor with Arduini Uno

You can use the following sketch for reading the Smoke detector / sensor with Arduini Uno. However, do some self testing and calibration with the threshold values.


Conclusion

Using the above example you should be able to use the MQ2 Smoke detector / sensor with and Arduino Uno. Once the alert has been detected, you will have to take some suitable action such as (but not limited to):
  • Sounding an alarm
  • Posting the alert to an IoT cloud platform
  • Activating some defence mechanism (such as sprinklers in case of fire)
  • Sending SMS and calling phone numbers

1 comment:

  1. Cool. Even
    smoke detectors
    can work with Arduino Uno. I hope one day I'll be able to do a DIY too.

    ReplyDelete