Introduction: WiFi Smoke Detector

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.

Comments

author
Dilleswar+raoM made it!(author)2016-12-27

i am finding difficulty in finding link for IFTTT

author
guzforster made it!(author)2016-03-02

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!

author
FlegmatoidZ made it!(author)2015-08-08

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

author
guzforster made it!(author)2016-03-02

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...

author
Proto+G made it!(author)2015-08-08

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.

author
FlegmatoidZ made it!(author)2015-08-08

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.

author
Proto+G made it!(author)2015-08-08

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

author
Proto+G made it!(author)2015-08-08

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.

author
guzforster made it!(author)2016-02-27

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?

author
Proto+G made it!(author)2016-02-27

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.

author
guzforster made it!(author)2016-03-02

Thanks!

author
guzforster made it!(author)2016-02-27

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.

author
william444555 made it!(author)2015-09-26

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?

author
thaty.joplintellez made it!(author)2015-09-21

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 .
Cheers

please

author
nireves made it!(author)2015-08-06

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.

http://www.seeedstudio.com/depot/datasheet/MQ-2.pd...

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.

Thanks!

author
Proto+G made it!(author)2015-08-07

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.

author
ashleyjlong made it!(author)2015-08-05

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!

author
Proto+G made it!(author)2015-08-05

That's great!

author
MechEngineerMike made it!(author)2015-08-05

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/

author
Proto+G made it!(author)2015-08-05

Thank you! It definitely would add to it. I have a few WeMo switches laying around that will do the job. IFTTT will trigger the outlet on and off for me. If there is smoke detected. It could even be used to trigger a solenoid for a fire sprinkler system.

author
miguipda made it!(author)2015-08-04

Dear Proto G,

Thank you for this perfect need and could I ask you to allow upgrading it with those functionalities :

- adding a Temperature + Humidity sensor

- adding a CO2 sensor

- adding a presence (PIR) sensor

why does I ask this ?

Because it would be the first sensor I could use without needing a home automation gateway. My router with OpenWRT OS could then access the sensors value without having to depend on a home automation gateway.

author
Proto+G made it!(author)2015-08-05

I have already done what you're looking for here:

https://www.instructables.com/id/IoT-Command-Center...

It has temperature, humidity, light, sound, vibration, motion and gas sensors.

author
PannK made it!(author)2015-08-04

ONly over WiFi ? will it text you while you outside ?

author
Proto+G made it!(author)2015-08-04

It will text me anywhere. It needs to be connected to the wifi in the house, but it doesn't matter where I am.

author
PannK made it!(author)2015-08-04

Oh thats really cool if so! love your project

author
Proto+G made it!(author)2015-08-05

Thank you!

author
Yonatan24 made it!(author)2015-08-04

That looks really cool, Just wondering about how much power (MaH/Watt) does it use while on standby

author
PaulB56 made it!(author)2015-08-04

how to insert codes in the device?

author
Proto+G made it!(author)2015-08-04

After you set up your device, go to build.particle.io

Then click create new app and copy and paste the code from the text file I provided.

Click flash and that's it.

About This Instructable

21,844views

255favorites

License:

Bio: 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 ... More »
More by Proto G:Levitating Platform1000W Portable Induction HeaterHow to Make a Metal Key With a 3D Printer
Add instructable to: