Using ESP8266 / Arduino and 2n2222 for Garage Door

Hello all!

This has been much more difficult than I expected!

Update: So I went off and ordered some optocouplers per the suggestion of INTP and created the following circuit with it. Unfortunately it does NOT work!! Please see the attached schema of what I've built.

I measured the voltage across the V+ V- leads of the garage door wires and it is actually about 22V DC across the leads. When I activate the optocoupler it drops to 0.5V but the garage door doesn't open.

Considering the original control circuit it seems to me, all I should have to do is short out these two contacts! Is it possible that the 0.5V is causing the control board not to recognize the short? Is there something I can do to here I'm missing?

Again I'm just as interested in why this doesn't work as a solution (i.e. just use a relay).



What about your code? How long are you powering the transistor on/off for as this will affect the action taken as a button press.

Are the switches momentary close or momentary open (or a mixture of both)

Do you need a resistor in the emitter or collector line to limit current through the transistor?

The switches are both momentary close, and my code sets the trigger pin to HIGH for 1 second. For what it's worth, if I short the leads to the opener there is no delay (as soon as they short the door closes) so it should be plenty of time.

Yeah, the duration doesn’t matter for button press for the ‘open’ command. That is, unless you can press it super duper quickly to trigger the other commands that are controlled by caps on a DC (I.e., nothing passes a cap in DC, but there is a little bump)

Can you put your DMM across the RED and WHITE terminals and record the DC voltages and record the AC voltages when you have no buttons pressed and each button pressed?

Hold each button for 3 or 4 seconds please.

Thanks.. Tom.. :slight_smile:

Yeah I'll hook up the original board and take those measurements tomorrow and post. It's really quite confusing! Nothing about this circuit looks at all complicated..

Sending three different instructions down two wires can get complicated, your button board may work on a current rather than voltage basis.

Tom.. :slight_smile:
PS A relay would be easier. lol... :slight_smile:

Again I'm just as interested in why this doesn't work as a solution (i.e. just use a relay).

If you have the complete schematics of the rest of the control system, we may be able to understand why it doesn't work.

As per other posters, I'm also suspecting that there's an AC involved. Three buttons on two leads, two capacitors - there's some trickery behind this that I don't know. Having AC of course causes problems with your optocoupler, which effectively is a diode as well.

So just thinking about this: what happens if you take two diodes in parallel, opposite biased, and use that to short the leads? Then of course you still have the 0.7V or so drop, but at least AC passes more or less unhindered. If that works, it should also work by using two optocouplers to replace a push button.

PS A relay would be easier. lol... :slight_smile:

And a lot less fun :slight_smile:

Thank you all for your ideas and suggestions so far!

So it turns out whoever thought of AC here was right. I hooked the original control board up and this is what I found:

33V AC across the Red and White leads with no buttons pushed

~0.7 AC across the Red / White leads with open/closed pushed

~27V AC across the leads with "Light" pushed

So based on this, in theory, I should be at least able to get the open/close working with a combination of two optocouplers triggered at the same time across both leads.

Here's the next question though -- we are quickly leaving my world of understanding so this is a lot of fun! I have many questions now. Let's start with this one..

I'm super confused as to how the polarized components (i.e. both caps and the LED) are functioning in this AC circuit. The LED I sort of get (it's only being lit by the current going in a single direction since it's a diode), but I'm very confused on the caps play into this..

Either way, how could I use optocouplers to address this? I figure if I can get open/close working the rest will work fine if I put in an appropriate cap on the red lead.


Maybe the LED is even running on DC while the rest works with AC - you can superimpose one on the other. That's how you can do power over ethernet, for example. The AC signal and DC power supply don't interfere.

Capacitors let AC signals pass, while blocking DC signals. Different values of capacitors have different impedance (resistance) to different AC frequencies. Maybe they have a second pair of 1 uF/22 uF capacitors in the main control so they can see which signal is passed through?

Hmm, So I’ve given this a chance and I’m having some problems with the circuit I need to build to solve my problem. Could someone give me a hand?

How exactly could I go about setting up a circuit using optocouplers that allowed me to replicate this control board’s features? I feel like I will need at least two optocouplers just for open/close but I’m not sure.

I came up with this circuit but I feel like this isn’t correct. Any help would be very much appreciated!

Screen Shot 2017-08-01 at 3.48.32 PM.png

You're right, definitely not correct: those optocouplers don't do anything this way as both sides are linked together.

Basically what you should do is take the circuit I drawn before, and replace the switches with optocouplers. Then you still have the problem that you're apparently switching AC so you would need two optocouplers in parallel (with the emitter/collector reversed) for each switch, so six optos in all.

Okay I think I got what you mean… does this schema reflect what you were suggesting?

Screen Shot 2017-08-02 at 4.02.39 PM.png

Thank you by the way for all of your help (everyone!)

Please do not stop here, I would like to know the end of this story after making for such gripping reading.

Did the complex opto-coupler scenario work at least for the open/close part of the switch?