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:
Virgin Mobile: email@example.com
US Cellular: firstname.lastname@example.org
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.