Back to Parent

Outcome


Problem Statement: Our garage door stays a few feet open about half the time. My poor dad usually runs outside in the cold before bed to peek at it and make sure it is shut. I'd like him to receive a text if the garage door is open for longer than 60 minutes so that he will know to go close it. I chose this project because I am an absolute beginner, and it seemed like something I could achieve. I have several projects that I’d like to create someday that I know could be done using reed switches and magnets, so I thought I’d try my hand at using them in a project.   

Iot my casa
Show Advanced Options

Goal: Garage awareness. Receive a text when the garage door has been open for longer than an hour. By obtaining the information on the garage status via a mobile form factor, my dad will be able to know if the garage isn’t closed from any location. This will save him having to go outside.   

Parts:

1) Reed Switch  (A reed switch makes a closed connection and completes a circuit when a magnet is near.  It consists of metal reeds in a hermetically sealed glass container. )

2) Magnet

2) Particle and materials in kit

3) Smartphone with IFTTT account

4) Adhesives to mount the photon and the magnet (I went with tape)

Setting up the board: 

Iot wired bread board
Show Advanced Options
Iot reed switch
Show Advanced Options
Image1 %282%29
Show Advanced Options
  //When you randomly find a sautering iron in your garage while doing an IoT project about your garage.   
Iot reed sauter
Show Advanced Options

I’m a little nervous that this is not the proper way to sauter a reed switch. I tried looking online to understand how to connect it, but there was very little data about this part of the process. However, the circuit is complete and the reed switch appears to function in this state.   

Iot garage circuit
Show Advanced Options
Image4
Show Advanced Options

Processing Steps of Application:

https://particle.hackster.io/team-wireless-marvels-inc/garage-door-status-alert-to-sms-text-bc52f0?ref=channel&ref_id=286_popular___&offset=69  

0 - Process loop starting. Read switches. One time initialization. Read time of day clock.

1 - Start 5 minute timer if any door just opened.

2 - Stop clock if a door closed before a timeout.

3 - Check if a door open too long if not already alerted to an open door

4 - Send alert if necessary and one not already sent. Comments refer to sending a Tweet which is how the Arduino version worked. But the Photon version publishes an event and using IFTTT to monitor events, is much more flexible than just sending a tweet. In fact we don't send a tweet in this version, we just send an SMS. But using IFTTT one can do all sorts of things.

5 - If in alert state and all doors close, send a message to indicate everything is OK again.

6 - If in alert state for 15 minutes, send a reminder that at least one door is still open. Send the status of each door.

7 - Update the time of day every hour to insure our internal clock does not drift from real time.

8 - Update the internal time of day based on how much time has passed since the last time the processing loop executed.

9 - Blink the Blue LED at a rate based on the alert state. The on/off cycle of the LED transcends multiple processing loops. Timers are set to insure the LED blinks at the correct rate.

10 - Check if any door is open or if all doors are closed.

11 - In debug mode print a time stamp every 10 seconds. Also display how many processing loops have been executed and how many milliseconds had passed since the app was started or since the last wrap around of the clock (49+ days).

12 - Delay for 10 milliseconds before returning to step 0.

13 - Show that we are about to return to the Particle firmware for it to do its processing (such as keeping a connection to the Particle cloud alive) before it returns control to the app at step 0.


Show Advanced Options

Setting up IFTTT:  This program is excellent and I highly recommend it. I’ve used the service for years and was thrilled to see that I could make an applet using the photon. The flexibility is amazing and it is exciting to be able to make quick changes with little technical overhead. For this process, I set up an event [Particle.publish(textMsg)] which triggered the IFTTT applet to send a message when ran.

Iot ifttt trigger
Show Advanced Options
Iot setting up ifttt
Show Advanced Options

Setting up the Garage and Magnet: 

Show Advanced Options
Iot garage installed
Show Advanced Options
Image3
Show Advanced Options
Image2
Show Advanced Options

Challenge:  

1) I didn’t realize that I wouldn’t get wifi in my garage, which created an issue. Luckily, we have a router extender that I was able to move into the backyard. This allowed me to prototype my idea. This challenged how I consider mobility for connected devices; the connection is only as good as their network.

2) My garage door was magnetic!  This created a problem with my reed switch.  Due to this issue, I never was able to create a working prototype.  I had to hold a magnet near my reed switch in vitro to complete my proof of concept. 

  • Reflection: This project was much more difficult than I’d anticipated.  I learned the value of breaking functionality and steps into small parts. Not only does this make the process far less overwhelming, it allows for much easier and methodical troubleshooting. I did not get to the point that I would have liked with this project- I was able to fire the trigger by playing around with the magnet and my garage, but I don’t have a homehack that could work reliably under normal conditions.   There were many steps of the process where I felt quite unsure of how to proceed. I have a lot more confidence now that I have tried this project, but I realize how much I need to learn to be able to prototype a reliable device.   I learned to stop asking, "is this right?" and start asking, "is this functional"?  I also am an absolute beginner with code and have so much to learn to be proficient.  I could not have done this project without relying on solid code libraries and the help of other students. 

Drop files here or click to select

You can upload files of up to 20MB using this form.