↑ Return to Projects

Garage Door Minder – Photon IoT

Photon from Particle.io

Photon from Particle.io

I wanted to be able to monitor and control my garage door from my Smartphone and get e-mail notifications when the door was left open. Around the time this idea came up I had just run across the Photon from Particle.io. The Photon is a WiFi enabled IoT processor (actually a STM32 ARM Cortex M3) with 18 mixed signal GPIO pins. It also includes a free back-end cloud and Web IDE. Their add actually says you can be up and running “in minutes” using their out of the box firmware (which you can replace later) and their Tinker Smartphone app.

Next question was what should a Garage Door Minder do? decided on 5 things:

  • Be able to tell if the garage door was open or closed.  This required 2 limit switches.  One for all the way open, one for all the way closed
  • Be able to tell if it was light outside or not.  This I implemented with a CDS cell
  • Be able to tell if a car was present in the garage or not
  • Be able to tell the temperature, just because I could and I wanted to test the I2C interface on the Photon
  • Be able to simulate pressing the Garage door open/close button
  • Be able to send e-mail if the garage door was open “too long” (whatever that might be)

Tossing all the necessary IO together resulted in a circuit diagram like this:

Garage Door Minder Circuit

Garage Door Minder Circuit

Using the out of the box Photon software and the Tinker app is was easy to get the basic sensors up and running.  Getting the I2C interface to the temperature sensor was another story.  To get to the built in I2C I needed new Photon software.  Fortunately the WebIDE that Particle.io provides includes a copy of the out of the box Photon software (Tinker in the WebIDE) as a place to start.

The Photon firmware already includes a Wire module to support the I2C interface.  It appeared that it would only take a few lines to read the I2C temperature sensor, a Wire.beginTransmission(), a few Wire.read() and Wire.write() commands, plus some housekeeping calls followed by a Wire.endTransmission() call and there was the  I2C temperature value.

But…. How to debug was a big question?  There is no debugger in the WebIDE.  A little digging, turns up the fact that if you plug in the Photon’s USB port to a PC, it enumerates as a COM channel which you can then connect to with any basic terminal emulator.    Couple that with the fact that the Photon firmware includes a Serial module to communicate with the resulting COM port and you’ve got basic print line debug capability.  It’s not great, but at least I could do some basic troubleshooting and even confirm that yes indeed the I2C routines were properly reading the data from the I2C temperature sensor.

Side note – when you re-flash the software on the Photon, make sure you disconnect the terminal emulator session first and then reconnect after the flash.  otherwise it hangs the serial connection.

2nd problem, the Tinker App doesn’t understand how to interact with my new I2C temperature variable.  Do I have to build a whole SmartPhone app to see if the new variable is successfully published?  No!  You can use a handy dandy PHP Dashboard located here.  With the dashboard you can view Published Variables and even call Published Functions.  Yup, that’ll also come in handy because I need a published function if I want to be able to remotely ‘press’ the garage door open/close button.

So this allowed me to get the basic Photon side of the Garage Door Minder up and running.

Hand-wired Garage Door Minder circuit

Hand-wired Garage Door Minder circuit

Here’s the simple garage door limit switches.  Just triggering off the location of the arm that runs back and forth across the screw drive

Garage door limit switch, one at each end of the travel

Garage door limit switch, one at each end of the travel

 

Here’s the car sensor.  It’s a reflective IR distance sensor placed on the ceiling with the IR emitter on the floor so now it operates as a beam break sensor.

fig-3-lr

Car sensor. Top the IR receiver, bottom, the IT transmitter on the floor. Car present, breaks the beam

 

Here’s the Garage Door Minder Firmware.  Note that you’ll have to go get the SMTP module too.

 

Now on to the client side…..

Garage Door Minder – Client Software

The Particle Smartphone application by Particle.io is pretty good for doing very basic IO.  It supports Digital IO as well as reporting on Analog inputs, but that’s about as far as it goes.  What I needed really was more just a basic user interface without having to write a complete Smartphone application. The approach I …

View page »

Garage Door Minder – Logging software

Next, I also wanted to be able to log data being produced by my Photon IoT Garage Door Minder. Looking at it there were two types of data I wanted logged.  Periodic data, like the temperature and Event data like Door Opening or Closing.  The other question was where to store the data and the …

View page »

Garage Door Minder – IFTTT interface

Goal here was to connect my Google Home to the Particle Photon Garage Door minder.  Can you say “Ok Google, Open the Garage Door”…. Several pieces make this come together.  First the Google Assistant Service on IFTTT.com allows you to process OK Google commands and then take action on them.  Second, there’s a Particle service …

View page »

Garage Door Minder – SMTP

One thing I wanted to add to my Garage Door Minder was the ability for it to notify me if the door was open too long.  My first thought was to add the ability to send e-mail messages.  How hard could that be? Turned out that there is no SMTP library available for the Photon, …

View page »