Imagine your on vacation or out of town and there's a fire in your house. You'll probably be informed about it if you're lucky within 20 to 30 minutes from a neighbor, but at that point it's a bit late to reverse the damage. What if we could be informed of a house fire within a few seconds or minutes? Well, I believe that can be accomplished using the Particle Photon and Particle web services.Step 1:
First thing will have to do is set up our Particle Photon. The instructions on how to setup your Particle device our described in the following link https://docs.particle.io/guide/getting-started/intro/photon/.Step 2:
Our second step is to connect our Particle Photon to our Particle relay shield v3.1 https://store.particle.io/collections/shields-and-kits and in turn connect our flame sensor to the Photon. The relay shield can be used for many different purposes, for example, there is a fire in the middle of the night the Photon will turn on the lights within the vicinity that its installed in.
Below you'll find a diagram of the Particle Photon and the wiring connection for the flame sensor.
Wiring (Flame Sensor):
- DO: D0
- + : 3.3v
- - : GND
Having followed the steps in the "getting started" link I provided in step 1 we will go into Particle Web IDE and use the code I've provided to run our program. In this project I also used IFTTT and using an applet I connected the Photon with my phone. The applet I used is the following:
Of course instead of the Electron I used the Photon and PIR sensor was replaced by a flame sensor. Don't forget to go into the applet settings and change the output message, event, e.t.c.Step 4:
Now the final step is to bring our Particle Photon into the world of IOT. We will be doing this simply by adding one line of code into our program which will publish an event and send a notification to our IFTTT applet. Below you see a picture of the code.
If you look at line 25 you'll see the publish event code I spoke about earlier. The results from this code are the following:
This is the message I get on my phone after the event in the code had been triggered.
Below is a video of my project being tested.