I often leave my home early in the morning on my bike so sometimes I forget if I closed the garage door or not. This project is so that I can check that I closed my door via my phone rather than having to circle back around.
How it WorksThis project works using a distance sensor which detects how far the garage door is from the sensor. I mount it on top of where the garage door rolls up onto the ceiling and if the distance is above a certain threshold (you must replace this with your own distance). I recommend testing the sensor values using serial log because the values aren't super accurate in my experience.
The circuit: The circuit is very simple and can be done by connecting the pins as seen in the following image.
The code on the Photon: I make sure that the data is accurate by using a lot of input. It then averages the last 3 distance values and if this average is above or below a certain distance it will mark the door as open or closed (1 or 0). These 1/0 values are averaged to see if, in the last 5 entries, the door is majority open or closed. If this state is different than the state the last time this was done, it will send an notification to your phone through an integration in the particle IDE. I have it set to only send a notification when the door closes.
Connect your Photon to your home wifi.
**MAKE SURE YOU HAVE WIFI IN YOUR GARAGE**
(if not you can use a wifi extender or a router)
IFTTT: We use an integration to trigger a webhook through IFTTT using the Publish function which can be seen in the code.
This is how the webhook integration should look, make sure that the event name is consistent across all platforms. That should not be confused with the Name which is just for you to identify the webhook. The URL will be given by IFTTT when creating the applet.
This is how the applet should look:
Event name in the IFTTT applet should be the same as the one in the integration.
ProcessAt first I focused on just writing the code. I went through a couple of iterations before I could fully make the sensor reliable due to the variability in its data.
My plan at first was to get by using the IFTTT free version. The IFTTT free version did not allow the usage of webhooks so I was going to upload all of the data I received into a google sheet. I set up a google sheets script to add new data to a spreadsheet using a webhook. I then set up an IFTTT trigger to detect when a new row was added to said spreadsheet, however I couldn't get the trigger to go off on the spreadsheet. At this point I decided to upgrade to the pro version of IFTTT so I could use webhooks to streamline this system.
Now after a few minor tweaks it works completely fine without issue.
MistakesI think that there would probably be more accurate and simple ways to do this like using a garage door tilt sensor.
I also think that I could've installed it next to an outlet to connect easier, rather than just using a portable charger for power, although it does last long because the device does not require much charge.
I definitely should've considered the fact that I don't have wifi in my garage before I started the project. As of this point for me it only works on my hotspot which makes it kind of useless and my wifi extenders did not work in the garage as I hoped they would.
Comments
Please log in or sign up to comment.