SmartThings Garage Door Opener Using a Particle Photon

2016-01-16 in Home Automation using tags SmartThings , Photon

I’ve been integrating multiple parts of my home lately with SmartThings and wanted to get my garage door opener attached as well. There are multiple off the shelf products for this but they all are fairly expensive for what they do and some work better than others. I wanted to keep my existing opener and switches while adding the ability to control it automatically and remotely. Being able to see when the door is left open by accident is a plus as well.

Moving the door is as simple as just connecting the two terminals together just like the wall switch does. Since this is a higher voltage than a micro controller can handle on its own using a relay was necessary. I chose the Particle Photon as the microcontroller as it let me use Arduino libraries but gave me a quick way to get an API end point on the internet without any fuss. These are great and at $19 USD they are well worth the ease of use over something like an cheaper ESP8266.

I also wanted to be able to reliably detect the state of the door which required some sort of sensor. I already had a spare IR distance sensor on hand from a different project so I mounted this to the ceiling pointing down above where the door was while open. This meant that when the door was closed the IR distance sensor would not detect it but when opened it would reflect the beam and indicate the door was present. It was unlikely anything else would get in the way to present a false reading as well given the range of the sensor. The sensor is analog so was very easy to read on the Photon. I just had to establish rough range values by reading it and holding my hand at various distances to figure out a good threshold to consider that it was the door in the way of the sensor and not someone standing below it or a car in the garage.

Once I had the physical control working via the Particle API the integration with SmartThings was next. This required writing a device type for the Particle Photon that defined the API calls in the Particle Cloud service as well as allowing me to easy put my API credentials in. Since I wanted the distance sensor to be able to report back the state of the door without being polled I also had to write a SmartApp which allowed the Photon to update SmartThings via an API endpoint in the SmartApp.

Sensor Install

In the end this worked quite well and ended up costing about $30 USD so pretty reasonable.

All the files with the Photon and SmartThings code as well as the 3d printable case model can be found in my Github repository.