[How-To] Build the ULTIMATE Garage Door Monitor

Rupp said:
I must admit I have the attention span of a 4 err 3 year old so it lost me when all the math started.

Remember that this How-To uses an abridged explanation for all the math. Make sure you go through the Analog to Digital Converters Guide to get a more detailed explanation of using the slope intercept formula (didn't want to go through that much detail here as I wanted to concentrate on the hardware and methodology specific to monitoring the garage door).

It's pretty simple and the Guide offers a very detailed step by step approach. Please let me know if you have any problems as I may modify any parts that don't make sense.


electron said:
The only thing I can think of is by using a 802.11b wireless adapter which can run serial over WiFi. Then you could use something like an Ocelot or the 10-bit PH Anderson analog to digital converter BSR uses in this tutorial...
Hmm, would those Lantronix serial to ethernet adapters work (that people use for XAP and are sold cheaply on E-Bay)?
Not sure, but even if it does, he would have to get a WiFi bridge, which would probably put him in the same price range as the WiFi serial adapter (will have to look it up to confirm this tho).
Well, I'm using one of those Lantronix EPS1 print servers to access a Peter Anderson kit over ethernet myself and it works great. Any PC app that either connects to an IP socket or to a serial port through a port redirector works well. I have about 7 of these print servers in service right now for various applications.
cool, then all you need is try to locate a cheap wireless bridge, and you are good to go (assuming you have access to power)!
Guy Lavoie said:
Well, I'm using one of those Lantronix EPS1 print servers to access a Peter Anderson kit over ethernet myself and it works great. Any PC app that either connects to an IP socket or to a serial port through a port redirector works well. I have about 7 of these print servers in service right now for various applications.
I have a Lantronix EPS1 that I would be willing to try with my PH Anderson A-D board, but need a little more input as I'm not familiar on how to do this with IP Socket or Port Redirection. Can HomeSeer do this?
I use this software:


to make my.elk compatible with IP based devices. Basically it creates a virtual serial port, which is remapped to an IP address, in this case, the IP of the Lantronix unit. That should be it, simply connect your software to the virtual serial port instead of the regular serial port.
Although this is very cool, it seems overly complicated (admittedly, the only thing I wanted was to be able to remotely control the garage door, and also see if the garage door is opened or closed -- so my solution is not as precise as this one). Here's what I did:

I bought one of these ($15):


You screw one part onto your garage floor, and the other onto the garage. When the garage door is closed, it closes the circuit (logic one), and when the garage door is opened, the circuit is opened (logic zero).

Next, I got one of these ($90 including the enclosure):


This is a little microcontroller that has digital inputs. I have it mounted to a garage door, and ran wire to the garage door sensor. I wrote a little "BASIC" (pseudo-basic) program that senses whether there's been a change on the input with the sensor. If so, it then sends "open" or "closed" (text ASCII) on the rs232 port. Also, the microcontroller has a relay output, which I ran to the garage door opener itself. If you send a command "actuate" to the controller on the rs232 port, the controller closes the relay contacts for 1 second, which causes the opener to open or close the garage door.

Now, like every good HA person, I have an Ethernet port in the garage that's hooked into our home network. Therefore, finally, I got the equivalent of one of these ($125) (I actually bought mine from neteon.net, and have the older DE-311 version, which is a little more expensive):


This is a device that allows you to route rs232 communications over a standard TCP/IP Ethernet network. The idea is that you install software on your computer that gives you a "virtual" com part, which is virtual in the sense that the com port is located remotely, on the network, as opposed to being a physical port on the computer.

I use Girder (www.promixis.com) and myhtpc (the predecessor to Meedio, www.meedio.com) for control. Girder receives the commands from the Ethernet serial server, and updates a file accordingly. Myhtpc displays a closed garage door icon when the garage door is closed, and an open garage door icon when the door is open. In effect, Girder writes a small text file indicating which jpg to use (closed or open). When I click on the icon in myhtpc, myhtpc sends a command to Girder, which then sends a corresponding command to the microcontroller to momentarily close the contacts on the garage door opener to open/close the garage door. I can provide more details on this, but in effect, myhtpc uses .my text files to display things, and I just have Girder rewrite the .my file when there's a garage door open/close event.

We actually have two garage doors, but the nice thing is that you need just one microcontroller (which has a number of inputs and a couple of relay outputs) and one serial port Ethernet server for both. The only thing I had to buy again was another garage door sensor, which is only $15. So the complete solution is under $250.

Voila! ;)

- Mike.
Dang! I use that same magnet and a powerflash X10 module and it works perfectly. Total cost $35.
This How-To is about the Ultimate way of doing it. It lets you know the exact position of the door.

Yes, you are doing the "standard" monitoring of the garage door that many beginner HA enthusiasts enjoy. ;) Certainly no question about your methodology.

An even simpler way of controlling your garage door would be to incorporate THIS How-To and use standard equipment that many of us already have.

Please note that this How-To was meant for the advanced user however who desires to know the exact position of the garage door (as stated in the beginning paragraphs).


I would implement this if I had the right equipment if for no other reason than
because I can". I just do not have any wire that runs from my wiring closet to my garage. And all that analog to digital talk makes me nervous.
I got some 10-Turns potentiometers and made some calculation on how this would work for the Elk-M1 in its simplest form. The issue here is that the M1 has an internal resistance of 2200 ohms. If you just connect the potentiometer to an M1 analog input, you aregoing to get a voltage divider. However I noticed (just from matematical calculations, have not tested yet), that the output voltage is not linear to the the pot resistance. The linearity become worst as the pot resistance go higher. Notice that the pot neets to have connected only two contacts (one side and the middle contact)

With a 1500K potentiometer, the highest voltage that you are going to get is 5.6V. Assuming asource voltage of 13.8V an resolution of 8 bits, this give you only 103 discreet values (255*5.6/13.8), which is not too bad. See attached the resuting Ohms to output value graph.

However if you decide to use a potentiometer with higher resistance then the resolution improves (max output voltage gets closer to 13.8v) but the linearity goes down badly, specially in the lower part of the graph. Definitively not good.

I would have to make an actual experiment to proof these values.

I wonder if it is possible to connect it in a similar way to what BSR is doing: with an external voltage source (from the same M1) and using all three contacts of the Pot. Need to analyze what effect will have the M1 internal resistance.

This is different that BSR model because his A/D converter works just as a voltage metter and has almost infinite resistance. Thats why he get perfect linearity.

NOTE: I'm sure that I have uploaded images from my harddisk before, but cannot find the button now. How do I do it? The IMG button asks for an URL.

NOTE 2: I uploaded the chart with the resistance to voltage line as my avatar. Open it to see it.
Ideally, the Elk should allow you to remove the 2200 ohm pullup from the circuit when you want to use an input strictly in analog mode. This would give you a much higher input impedance. That's one nice thing about the ADI SECU16, there is a jumper specially for this. Unless the M1 does have a provision for this and we just don't know where?
Another option is to use a Phidgets Encoder.

Generates events via COM and the programming would be simpler. Of course, you have to get USB to your garage door. :D