Introduction: Build a Simple Power Outage Monitor
Hello, and welcome to my Instructable for building a cheap, simple, somewhat useful power outage monitor! If you're here, it's probably because, like me, you live in an area that experiences occasional power outages. Congratulations? At any rate, you've probably also done some searching for an IoT type product that works well enough and doesn't cost a lot of money...and no doubt you've been disappointed. Most of the monitors available are either dumb-devices (rely on physical presence and simply sound an alarm) or rely on a landline phone connection (remember those?) to call a pre-specified number. None of those are what I was looking for, which was just a simple device that could sense when it lost power, and send an alert to my phone.
What you're going to build here is not perfect; it relies on some indirect monitoring (basically, it detects that it was disconnected from an Internet connection and sends a message when it's back online). My long-term plan is to hopefully build something with a backup battery system, that works in tangent with a UPS (for the modem/router) and some intelligence to understand when it kicks over to battery. If you're interested in something like that, visit http://powersdown.launchrock.com and let me know; it might encourage me to put some effort into it.
Anyway...with back-story and caveats out of the way... on with the show...
Step 1: Purchase a Photon Board From Particle
To start with, we're going to base our device around the Photon board, from Particle. You're going to want to pick up the "Photon Kit" package, currently available for $29.00*. These boards are great, because once you get them set up, you can program them over the web via a web browser. It's really neat to watch them flicker as the code gets updated on the device!
*technically you can probably buy the $19.00 base package, I think. I don't have that one though, so you're on your own if something doesn't work.
Step 2: Open Up Your Photon Device
Particle does a great job packaging this thing up! If you bought the kit version, it will come attached to a neat breadboard thing where you can play around with attaching LEDs that you can light up over the web. Once the package arrives, open it up and pull everything out. For our project, we'll want to focus on two parts: the device itself and the USB cable (for power). This tutorial also assumes that you have a spare USB charger adapter sitting around that you can use to power the device.
Step 3: Get Your Photon Connected to the Internet
Ok, so this is going to be the trickiest part of the tutorial. If I say the phrase "CLI" and you know what that means, you'll be in good shape; if not, Particle has a really great documentation section that beginners can start from, and if you have some general knowledge of computers you'll be able to get through it (and if not, let me point you again to a page I set up to gauge interest in pre-built devices).
The specific set of instructions you'll need to get your Photon device online are available here. I won't re-hash them in this tutorial because it's a bit long, and frankly Particle did a great job writing it up anyway. One point worth mentioning is that you can set the device up either via WiFi + a mobile device (highly-recommended method) or over USB. For some reason, my device would not detect over Wifi + mobile device, so I was forced to go down the USB route, which was much more complicated. I never could nail down why that was (working theory was that the device did not like my 2.4GHz network), but suffice to say, if you can't set it up over the easy method, you'll have to try it over USB.
At any rate, follow the linked instructions to get your Photon device online and talking to the Internet, and then jump to the next step.
Step 4: Hook Your Photon Up to IFTTT
Once your Photon device is online, it should be smooth-sailing. We're going to be using IFTTT (IF This Then That) to set up an automatic alert system. If you've never used IFTTT before, it's a fantastic service for connecting the disparate, competing standards in the IoT world. Highly recommended.
The basic workflow on IFTTT is to set up a new "event" (called "recipes") by picking a "trigger" (the "This" part of the equation) and link it to an "action" (the "That" part of the equation). For our power monitor, we're going to want to pick our Photon device as the trigger. You'll need to give IFTTT permission to talk to your device, and you can do that from within the IFTTT app or on the website when you set up a new recipe for Particle (you'll need your Photon device ID, which you can get from within the Particle app on your phone).
For the action, you're going to want to choose either Email or Gmail (if you're using a Gmail account, obviously). You'll basically be telling the recipe that, if the Photon device goes offline, it should send an e-mail to the account you specified. The process is pretty straight-forward, but if you get stuck check the IFTTT about page for more information.
Step 5: Wrapping Up
So that's about it! If you made it this far, congratulations! About the only other thing I can recommend is that you might want to make a filter in your inbox to sort out e-mail notifications from IFTTT. The drawback of this simple system is that it also notifies you when your INTERNET goes down. For some of you, that might not be an issue, but in my area the Internet will go down for 15-20 seconds often multiple times a day, so I'll get bombarded with notifications. Hopefully you live in an area with more predictable Internet service, because I do get a lot of false-positives from time-to-time.
Thanks for reading the tutorial, hopefully it was helpful! I'll give one last shameless plug to my page to gauge interest on a better IoT power monitor. If there is enough interest, maybe I'll do some work, put something together, and stick it on Kickstarter.
Runner Up in the
Internet of Things Contest 2016
Participated in the
Automation Contest 2016
1 Person Made This Project!
- Hexydes made it!
3 years ago
I want to make a project, informing me when there is power failure in my house through email not internet breakage is that possible with PHOTON because wifi wont be connected to it after the installation
Question 3 years ago on Step 1
Let me make sure I understand. When the power via the USB to this unit stops (power at the receptacle is lost), this unit has enough power to transmit an alert via WIFI (email)? Or, is another component required, such as a main console this unit talks to?
4 years ago
I could not make this project work. When photon goes offline, the particle console will never receive the offline status. I waited for hours.
5 years ago
I love the tutorial... I purchased the proton like I was supposed to. got it connected, the app sees when it goes on and offline. Unfortunately IFTTT isn't doing what I'd expect it to do. It's never seeing when it goes on and offline. Is there a delay? Even when checking the box telling it to check?
Reply 5 years ago
disregard... aparently it takes about an hour for everything to get processed through their system. Now everything is working as expected.
Reply 5 years ago
Glad you found the tutorial helpful! I forget exactly how long it takes to sync-up; I set it up over a year ago and it basically just sits there doing its thing. I haven't really messed with it since then. :)
Reply 5 years ago
I keep getting false alerts... it will say offline and then pop back online seriously half a second later. Is this typical or could it be I need to install a wifi antenna on the device to increase the range?
Reply 5 years ago
I had a lot of false negatives at first. It turned out my router was just freezing or restarting or losing connection a lot. I'd also lose internet a lot, but wouldn't notice because I wasn't using it, or my video stream had already cached, etc.
I ended up replacing my router, and the errors dropped by probably 90%. So long story short, my power outage monitor actually let me know my router was a failing piece of crap.
Not necessarily your problem, but that's what I ran into.
6 years ago
This would be so helpful! Thanks for posting all the info!
Reply 6 years ago
No problem! Honestly, as long as your Photon board hooks up with your phone, it's pretty simple. Mine didn't, and I had to set it up via USB which required me to download a bunch of stuff to manually flash the ROM and stuff. I've done things like that before, so not a huge issue, but it's also probably out of reach for people that don't have a lot of experience with that.
Thanks for checking out the tutorial, and for the comment!