Introduction
I have come across several threads discussing how to actuate a garage door using a microcontroller. However, each discussion that I've read recommends circuitry that is more complicated than necessary for my particular case, and I wanted to see how simple the circuitry could be and still be able to actuate the garage door.
NOTE that your garage door motor controller unit will probably be different than mine, and so my experience might not be relevant to you. Do not assume that you should follow the same process as I did; you would risk damaging your microcontroller, your garage door opener, or worse. Garage door openers operate on high voltages (both DC and AC), and so there is a risk of personal injury. The following is not my recommendation, rather an informational log of my experience. Also, mine is an older garage door control unit, and this information might not be relevant to modern systems.
NOTE I will not cover applications for door actuation. No clever use-cases, no complicated automation, no RF/WiFi/IoT integration. I will only cover the mechanics I used for actuating the door open/close for my particular garage door unit.
I succeeded, using a microcontroller powered at +5V Vcc and using a single digital I/O pin. No other components were necessary.
Goal
My goal was to actuate the garage door by signaling the ceiling-mounted garage door motor to open or close the door (similarly to how the wired wall switch currently functions) using a microcontroller while minimizing the need for components.
Understanding the Original Wall Switch
On the outside of the wall switch, there are:
- Button: open/close
- Button: overhead light on/off
- Switch: locked/unlocked
- LED (steady): ready indicator
- Wire: DC +V in
- Wire: DC Ground
On the inside, there is a PCB that redirects the DC current through different resistors depending on which button is pressed, the position of the lock/unlock switch, or if nothing is pressed. Importantly, I observed that the open/close button shorts the +Vin to Ground (and bypasses that other circuitry and resistors).
When disconnected, the potential difference across on the two wires is 18V DC -- that would be too high for a microcontroller. However, when the wall switch is connected, the resistors within the switch's passive circuitry allow a small current to flow, and the potential difference drops to around 5V DC -- ideal for a microcontroller. And so I left the original switch in its original place, still wired into the garage door motor controller. Therefore my solution is not a replacement for the original switch, rather the microcontroller serves as an additional option for actuating the garage door.
I took some measurements of the resistance within the switch, and calculated the pull-up resistance on those 18V coming in. I then calculated the current that would flow when shorting +V to ground, and then I actually used a multimeter to measure it. The results confirmed that the current was low enough for an open drain output on a microcontroller to handle.
I followed the two wires up to the ceiling-mounted motor unit. Warning: this unit is powered high voltage AC and DC and can be dangerous! There are six terminals from right to left:
- Wall Control Switch Input: VERY HIGH +18V when no wall switch is hooked up, HIGH +5V when the wall switch is hooked up and no buttons pressed (and the wall switch is unlocked), a MEDIUM potential when the wall's "light on/off" button is momentarily pressed (and the wall switch is unlocked), a LOW-BUT-NOT-GROUND potential when the wall switch is in the locked state, and GROUND when the "Door open/close" switch is momentarily pressed.
- Ground
- Sensor Input (Photo Electric Eye): this is how the unit detects if an obstacle passes under the door while the door is closing. I tried using this as a +V source to power the microcontroller, and while it actually worked to send an "open" command, it would not work to send a "close" command, as the resulting voltage drop on this pin makes the unit think that there is an obstacle blocking the door, and consequently it disobeys close signals.
- Sensor Input (Magnetic Reed): door fully open (logic low when door is fully open, logic high when door is partially open or fully closed)
- Ground
- Sensor Input (Magnetic Reed): door fully closed (logic low when door is fully closed, logic high when door is partially open or fully open)
Note that when powered at +5V, the microcontroller can easily read the state of the magnetic switches (and therefore, it can identify the state of the door as either fully closed / partially open / fully open) as digital high and digital low input. At +5V, the microcontroller can also read the lock/unlock status of the wall switch as high for unlocked and low for locked (even though the actual low value isn't quite at ground potential, it's low enough to be read as logic low on a digital pin).
While either ground pin seems to work as common, none of the four +V terminals can serve as an adequate power supply for the microcontroller without interfering with the sensor readings required for the motor unit to function normally. Fortunately, the motor unit itself needs power, and so there is already a ceiling-mounted power outlet nearby.
One observation is that the "lock/unlock" switch doesn't change the way that the "door open/close" switch shorts the +V wire to ground -- rather the motor control unit seems to make it's open/close actuating decision after taking into account several inputs including the potential of the wall switch pin just before it was shorted to ground (which would have been a rather low potential if the switch had been in the locked position, or a high potential if the switch had been in the unlocked position), in combination with the actual open/closed state of the door as determined from the magnetic reed sensors.
Actuation
Using an Uno board, I:
- wired its ground pin to terminal 2 on the motor control unit,
- supplied it with +5V DC, and
- wired one digital I/O pin to terminal 1 (the rightmost terminal) on the motor control unit.
The digital I/O pin is setup as an INPUT (not as an INPUT_PULLUP).
To actuate the door (and simulate a momentary press of the wall switch's door open/close button), the program switches the I/O pin to an OUTPUT and drives it LOW for some time (2000 milliseconds works consistently for me, and is probably much longer than necessary) thus connecting terminal 1 to ground (terminal 2) through the microcontroller's open drain output. After a delay, I change the pinMode back to INPUT so as to stop driving the pin low.
This works flawlessly with an Uno development board. And since it just requires just three pins, I ported the code (with some modifications) to a bare ATtiny85 which works just as well. And that is how I used a microcontroller to actuate my garage door!
Of course, instead of the microcontroller, a momentary button switch could accomplish the same thing -- or even just a plain wire --, but where's the fun in that‽