Monday 19 May 2014

My DIY Garage Door IP Control

It wasn't until I was 100 miles from home that I remembered I'd left the door to my new garage wide open!  There was nothing I could do about it until I got home again 8 hours later, so it got me thinking about a way of controlling it remotely.  I already have a wireless key-fob, but I wanted something with a bit more range and so my search for an IP enabled garage door began.  There are some ready-made solutions by the big manufacturers but they are expensive and somewhat restrictive.

The first step was to see what I could do with the Garador Garamatic 7 electric "motor" I already used (in combination with the key-fob).  Luckily, like all Garador electrically operated doors, it's possible to add an external impulse button to start/stop the door travel cycles.  Effectively this is just an electrical short across 2 connections inside the control unit and is usually used for a push button start/stop or a manual key switch.  See figures 10/11 in the Garador manual.

Next I found an Ethernet connected relay that included an SNMP and HTTP interface, a really nice piece of kit with a thousand uses!  There are a number of these on the market, but this one came from a UK based distributor and most importantly had the HTTP interface/API that I planned to use to pass commands from my smart phone.  Additionally it also had digital inputs on board.  Although this wasn't essential, I figured that being able to sense when the garage door was closed was also quite important - I could have used a webcam I suppose - I might still do!

Lastly, the Ethernet connection to the garage was accomplished (in the short term at least) using a pair of TP-Link powerline adapters.  To my surprise, these worked across multiple RCD units.

The connection to the door motor control unit was made using 2-core cable, into the "Normally Open" and "Common" connections on the Ethernet relay.  In order to start the travel cycle of the door, the relay only needed to close for a second, so the pulse feature of this relay was ideal for this.  For each pulse of the relay, the door will open, stop, close, stop etc but it will also stop automatically when the door reaches the end of it's travel as normal.  During testing, I was using the web interface built into the relay.

Next was the sensor to detect the state of the door.  With the relay having the ability to take digital inputs, I decided to buy a cheap reed switch usually used with household burglar alarms.  The switch was placed in a static location at the top of the door frame, while the magnet - stuck to the door - would travel as the door opened and closed.  It took some trial and error to make sure they were positioned correctly, especially as the working space was very limited when the door was closed.  The wires from the switch could be hidden nicely along the door track with the help of some cable ties.

The reed switch wires came back to the digital input 1 and ground connections on the relay so that when the door was closed, the digital input was high.

That all worked nicely, but I was still controlling and monitoring it all from the web interface on my laptop.  What I really wanted was a quick Android App!  There is a generic app to control the relay available on the Play Store but I wanted something a bit more customised...

I've been using App Inventor since it's early days, and it is more than powerful enough
to code a quick UI with HTTP GET calls to the URL which controls the pulse command on the relay and the URL to get an XML status of the relay.  The XML status contains the status of all elements of the relay, many of which I wasn't using, so I had to parse the output to capture the Digital Input element I was interested in.   I also added a quick "pin pad" login in case my phone ever gets "borrowed".  It's very simple, ugly, but perfectly functional!

There are a number of improvements I will make over time, including tidying up the Ethernet and power connections to the relay.  I could also perhaps add a second reed switch to tell me that the door is fully open.  Therefore if neither digital input is reading closed, I know the garage door must be stuck half open.  However, generally I'm really pleased with the result, never again will I be caught out, miles from home wondering if I shut the garage door behind me!

UPDATE: I've now added a 1-Wire DS18B20 Temperature Sensor which I purchased on ebay, to the relay via it's dedicated 1-wire input pins.  It really was plug and play, and now I can also read the temperature in the garage.  You will need this DS18B20 pinout....

No comments:

Post a Comment