Go Down

Topic: Using ESP8266 / Arduino and 2n2222 for Garage Door (Read 4101 times) previous topic - next topic


Jul 26, 2017, 06:27 am Last Edit: Jul 26, 2017, 06:39 am by coogle Reason: Adding Image directly to post
Hello All!

I am hoping someone can help me out here. I'm trying to use an ESP8266 to open and close my garage door but I'm having some problems.

I'm trying to wire this into the hard-wired control panel inside of the Garage. This consists of two leads with ~16V across them that, when shorted out, triggers the door to open or close depending on it's current state. To be more specific, it appears that the control panel's three buttons basically have three functions:

1) Standard push button shorts the two leads, and door opens and closes based on state

2) Another standard push button shorts the two leads but there is a 10uF capacitor in the circuit so I assume this means it's "pulsing" the short at some frequency. This one turns on the built-in light bulbs of the opener

3) A third standard push button does the same thing as #2, except at a different frequency using a 100uF capacitor. (This is for the "lock" feature)

I figured I should be able to make this work pretty easily with a 2N2222 transistor and one of the 3.3V GPIO pins. My ultimate hope is I can, by pulsing my GPIO high/low to simulate the capacitor's in the original circuit, implement the three functions -- but honestly I'll be happy if I can just get the door to open and close which is a simple short to ground.

I'm attaching my schema and would love some advice. It seems like this should be working to me but I'm still wrapping my head around transistors so maybe I'm messing up.

(note my first upload was the wrong schema, corrected!)

Any help?




This is a project I have in use. I used a tiny relay that has it's N.O. contacts across the local wall switch contacts. - Scotty


This is a project I have in use. I used a tiny relay that has it's N.O. contacts across the local wall switch contacts. - Scotty
An excellent idea, you do not know what sort of signal is in those wires at the pressbutton and using a transistor may cause problems.
Use a normally open set of contacts on a relay in parallel with the button contacts, and get the ESP to switch the relay, that way the circuits are isolated from each other.
Tom... :)
Everything runs on smoke, let the smoke out, it stops running....


I understand that I could probably easily solve my problem just using a relay, at least part of it -- however I'd really like to understand why the solution I came up with isn't working as much as I'd like to see something work at all.

To be specific: The circuit just doesn't work at all -- no door open/close or anything.

To help illustrate the problem and my goals, here is a schema of the original factory-manufactured control board that is typically installed. As you can see it's an extremely simple control board so I don't see any reason at all why this can't be replaced directly with all of it's features using any reasonable micro-controller.

So looking at this schema, and looking at my replacement, why is it that I can't seem to get this to behave the same?


Jul 26, 2017, 06:01 pm Last Edit: Jul 26, 2017, 06:01 pm by TomGeorge
There would be more to it than what is in your schematic, where is the controller IC that controls the motor?

The main problem is that the 3 switches in  the circuit you have supplied is  switching the positive of the supply.
The addition of the transistor switching you want to use is switching from gnd or the negative of the supply.

The factory schematic must be more detailed than that simple switch diagram.

Can you tell us your electronics, programming, Arduino, hardware experience?

A relay would be your best and safest solution, for your limited knowledge of the circuit and experience.

Tom... :)
Everything runs on smoke, let the smoke out, it stops running....



So I've built a lot of IoT devices from 16 port smart relays to weather monitoring stations and feel pretty comfortable around a soldering iron. I'm formally trained in digitals, and recently wrote my own IOT foundation library now available from the Library Manager called CoogleIOT. For my day job I'm a programmer, core PHP developer with 20 years of C, PHP, etc.... I actually built exactly this sort of device for an automatic gate using an ESP8266-01 and it worked perfectly so I'm struggling to understand what I'm messing up here! In that case the gate's control board would open the gate in "exit" mode if you shorted a lead to ground and I used 2n2222 to do so.

Where I am weak is it's been maybe 20 years since I've had to try to build circuits from simple component parts. I have a pretty decent understanding of how they work conceptually but I'm trying to regain the functional knowledge -- hence I am not so much interested in just solving my problem with a relay and more interested in understanding why I'm failing. I'm happy to read and have -- but I've hit a wall here.

You're absolutely correct the schema I provided is the circuit board that plugs into the two leads coming from the garage door opener itself mounted in the rafters. I mean, the "inside" controls for the garage which let you open/close the garage door and turn on the lights, etc. from within the garage. I am trying to replace that control panel with a WiFi device (and separate from this conversation add some reed switches to detect open/close, etc).  In the sense that there are two wires coming from the garage door opener in the rafters, and there is 16V across them which plugs into the schema I provided yes -- that schema is 100% complete. Obviously the garage door opener in the rafters has a lot more circuitry in it to actually do something with the signal produced from the control panel!



Jul 26, 2017, 06:28 pm Last Edit: Jul 26, 2017, 06:34 pm by coogle Reason: Adding Image directly to post
As you can see from the attached, I'm basically trying to replace this board with an ESP8266-12E to at a minimum replicate the function of the "Command" / Open button which, other than an LED and resistor in the way just shorts to ground as described. Ideally I'd like to simulate all the buttons (the other two modulated by a 1uF and 22uF cap). From there I can add two reed switches to two other GPIOs and control all of it over MQTT.


I guess the easiest way out would be to replace those buttons by transistors (check the voltages - then solder the transistor emitter and collector to the respective sides of the switch, and connect the basis to your ESP8266 with appropriate resistor, 1k would do).

Also connect the ground to your ESP's ground - but it's not necessarily the case that the ground is connected to this board at all.

That failing: follow the wires of that PCB and draw out an accurate schematic of it, then try to rebuild that. Again be aware that the two holes (screw connectors?) may not be Vcc or GND, but be part of another circuit.
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.


That's exactly what I did (see my original circuit) and it isn't working :) 1k resistor connected to GPIO to 2N2222 base, and the Collector attached to the V+, Emitter connected to V-. ESP8266's ground also connected to V- of the leads.

That doesn't implement all three buttons, but it *should* as far as I can tell implement the "open" / "command" switch which just shorts to ground.

It's worth noting that in my testing if I connect the base of the 2n2222 to V+ (through the 1k resistor, leaving the C and E the same) instead of to my GPIO, it works.



I don't think your schematic in #4 is correct as you show the command button closing through the LED/resistor but the PCB shows a direct connection to GND? when the switch closes. Also the capacitors have there negative terminals connected to each other and not to ground as you show.
Don't PM me for help as I will ignore it.


Jul 26, 2017, 07:25 pm Last Edit: Jul 26, 2017, 07:30 pm by coogle
The command button traces are a bit hard to see, but there is a trace between the command button on top (bottom leads) to the LED, which goes to the resistor which goes to V-.

Perhaps one big assumption I am making here that you've pointed out with the capacitor comment, is that I am assuming V- and ground are the same thing and they aren't? That said, looking at my schema in #4 if you assume the "power" is the V+ and V- (which measure 16V across them), it is correct. Consider the "power" just a representation of those two leads.

Attached is a revised schematic which more accurately represents the board (power removed) and what I'm trying to replicate using an ESP.


Jul 26, 2017, 07:42 pm Last Edit: Jul 26, 2017, 07:42 pm by wvmarle
I think this is the correct schematic of that PCB:

The interesting bits:
- two switches are in series with a capacitor, one switch just connects the two points,
- there's an LED + resistor in parallel with the switches (it doesn't appear to be switched by the button S1).
Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.


Opps you are correct on the LED my mistake! It doesn't really have an effect on the circuit.

You are also correct on the three switches. One shorts the two leads directly and the other two short the leads but use a capacitor to create a signal. The rate of discharge of the caps determines the behavior interpreted by the garage door base.

The question still remains however, which is how to replicate this circuit using a microcontroller?


What do you mean replicate it? Complete replacement so you just have the bell wire running to your ESP circuit and no panel?

Go Up