WiFi Smoke Detector




Introduction: WiFi Smoke Detector

About: Electromechanical Engineer, Product Designer, Maker. I love to make prototypes and teach others in the process. I graduated from UCF and spent two years working at NASA.

This is a simple WiFI Smoke Detector that texts me when it senses smoke. I made this for my battery storage area in case of a lithium polymer fire. I still have all of my regular smoke detectors installed and I don't suggest relying only on this, but rather as an extra layer of protection. If I had a house I would install a proper fire alarm system that calls the fire department, but I live in a small apartment so I can't. I can set this one to email and call the local fire department as well(local laws apply). In my county it is allowed as long as you register it with the fire department. Either way, I would rather call the fire department myself when I receive multiple texts.

This solution is much better than only using regular smoke detectors. If something happens while I'm a work, the whole place will burn down. Accidents happen, and when you live in an apartment complex, any one of your neighbors could cause a fire. I live a mile from work so if I receive a text, lives could potentially be saved.

Step 1: What You Will Need

1. Particle Photon

2. MQ2 sensor

3. Piezo buzzer

4. Prototyping Board

5. 5V USB battery or usb wall charger

6. IFTTT(If This Then That) account for texting, calling, emailing, controlling outlets.

Step 2: Assembly and Soldering

After you decide where you want your components, mark out an outline with a marker and cut out the excess board. Solder each component to the Photon as follows:

Solder the negative lead of the piezo speaker to the ground of the photon and the positive lead to digital pin 0.

Solder the negative lead of the MQ2 sensor to ground and the positive lead to Vin. The reason for connecting it to Vin and not 3.3V is because the sensor needs at least 5v. Make sure your power supply is at least 5v and no more than the specified max voltage on your sensors datasheet. Solder the lead labelled A0 of the MQ2 sensor to analog pin 0. Note that there is a D0 pin on the MQ2 breakout board but it is not needed to function properly.

Step 3: Upload the Code

One of my favorite features of the Photon is the ability to wirelessly upload your code to the Photon via wifi. Copy the code from the provided text file and paste it at build.particle.io

Click the device you want to upload to and click flash. I have also included the chunk of code that allows you to continue using the Particle mobile application so you can get real time reads from your devices analog pins and it also allows you to write to your digital pins.

Step 4: Setup With IFTTT

Once you setup your IFTTT account, you will need to go through and activate the channels that you want to use.

Use the SMS channel for texting.

Use the Phone Call channel for calls.

Use the Email or Gmail channel for emails.

Use the WeMo channel to control outlets.

I use the Gmail channel to text because there is a limit to SMS text messages on IFTTT but there is not a limit on emails so I found a little work around. To text via email, find out what format your cell provider uses. Here are some common providers and their format:

Alltel: phonenumber@message.alltel.com

AT&T: phonenumber@txt.att.net

T-Mobile: phonenumber@tmomail.net

Virgin Mobile: phonenumber@vmobl.com

Sprint: phonenumber@messaging.sprintpcs.com

Verizon: phonenumber@vtext.com

Nextel: phonenumber@messaging.nextel.com

US Cellular: phonenumber@mms.uscc.net

You can have IFTTT monitor a variable on your device and trigger a channel when it surpasses a certain value but I have found it more reliable for the device to publish an event instead. That way, all of the logic is handled at the device end and IFTTT just has to see if an event has been published.

Step 5: Thank You

I hope you find this instructable helpful! Feel free to ask any questions and I would be glad to answer them if I can.



    • Tiny Home Contest

      Tiny Home Contest
    • Metalworking Contest

      Metalworking Contest
    • Water Contest

      Water Contest

    30 Discussions

    Hi! I tried your project and it work very good for me. I just want to ask you if is possible to wiring also a temperature +humidity sensor like AM3202 (DHT22) and send the °C and %humidity on the thinker ios app. I really a newbie and i don’t know nothing about elettronic and particle photon language.
    Could you help me? I need these project to control my 3D printer.
    Thanks in advance

    i am finding difficulty in finding link for IFTTT

    Also, would you care to explain how the code for working with the mobile app works, since when we flash the code, the original Tinker app gets erased?.. That part tricked me!

    Nireves is right - MQ2 is not suited for for anything but flammable gas. I was trying to see it it can measure cigarette smoke or the one from the soldering iron - nothing. However, it was able to register a "fart" behind the closed doors (sounds funny, but it really detects farts with incredible sensitivity).

    What you actually need is Optical Dust : Sensor: https://www.sparkfun.com/products/9689

    5 replies

    Yes, I'm building my fart detector XD - MQ-2 detects Methane, which is one of the gases we produce when we fart. But it should also detect smoke, specially CO...

    I'm sorry to break it to you, it does work for smoke. There must be something wrong with yours. Try adjusting the sensitivity. I have tried lighting matches, burning paper, blowing out candles, solder/flux smoke and the sensor detected in all situations. Is the MQ2 the best sensor for smoke? No. Does it detect smoke? Yes. Every datasheet says it detects smoke and it does. Most modern smoke detectors use a multitude of sensors, not just one so yes, this could be improved with additional sensors.

    Well, it shows something above noise level if you surround it with smoke. It wont,however, warn you about the possible fire by being few meters from light smoke. Try it with acetone and it will peak to its max. Even 5 meters away.

    Oh, and you're right that it makes a great fart detector! Very sensitive to farts haha.

    Again, is it the best sensor for smoke? No. Is it suitable for smoke? Yes. Mine will pick up cigarette smoke from across the room as well as other smoke. It may not peak to the maximum saturation level, but that is not necessary. If anything, it's ability to detect flammable gas is a benefit. This is used in addition to my household smoke detectors. If you read my article, you would know that I made this for my battery storage area in case of a lithium polymer fire. It serves that purpose perfectly.

    Hi! Thanks for this neat instructable! I didn't understand what the SensorA0 variable is doing. It's not being read by anything. The only variables being read are sensorValue and threshold. Is there a reason you're connecting SensorA0 to the cloud and not sensorValue?

    2 replies

    I went over the code and I think I added that in case I wanted to have IFTT monitor the value, but instead just went with monitoring the value in the code and publishing an event. If you want the cloud to monitor that value just add the line

    SensorA0 = analogRead(A0);

    ...but I think it is better how it is.

    Hi again! Do you by any chance have the squematics for this project? I'm doing the same connections but with a "raw" MQ-2 instead of brick. For some reason it's going nuts on the reading, always reaching 3.3v.

    Nice instructabal, could you change the sensor to sence carbon monoxide aswell as smoke and have it send differant messages and potentialy get a loud buzzer as carbon monoxide is very dangerous?

    hello incredible project that I would love resolvieras a doubt that I have . as you connect the module to the wifi in the house . thank you. and if you give me the list of materials used .


    I don't think the MQ2 is the right sensor for this job. It's designed for combustible gas/vapor leak like propane (like from a LPG tank) or methane (household gas). The little heater inside the sensor burns the gas and the resistance of the element drops. The circuit reads this drop in ohms.

    The datasheet from Seeed Studio says it can detect smoke but gives no specifications for smoke detection. The smoke would have to be combustible smoke (like unburned carbon), but if the smoke is pure ash (mostly silicates) then it may not trigger the alarm.


    I do see that other people have used this sensor as smoke detector but they also don't give any results. A YouTube video shows it being tested with the gas from a lighter (butane). https://youtu.be/YgEOnZ-7i8o

    I'd be curious what your tests show as a detection limit for actual smoke.


    1 reply

    It is indeed very sensitive to combustable gas but it is also suitable for smoke detection. I did not buy my sensor from Seeed Studio but many other datasheets also claim to detect smoke. I have tried lighting matches, burning paper, blowing out candles, solder/flux smoke and the sensor detected in all situations.

    My fire chief father would have loved something so portable. I was not allowed to play at anyone's house unless they had a working smoke detector. He would actually come in to test it and carried spare batteries in his glove box just in case. If Wi-Fi had existed back then I'm sure he would have strapped one of these to the top of my head!

    1 reply

    Great job, voted! I know you've already seen my smoke detector disconnector, you could make a much better version of it by adding a wifi-relay module to this project! https://www.instructables.com/id/Prevent-House-Fires-with-the-Smoke-Detector-Discon/