Project complete with Code -- Oh wait, it's normally closed? What to do

Finally got a simple ESP8266 powered gate opened up and working. The pins are controlled via MQTT messaging and tested with 3 simple LED's with 30N06L MOSFET's. So when the incoming MQTT message comes in, it sets the appropriate pin HIGH which is to GATE on the FET.

That's fine, then I realized that the garage door opener keypad is normally sending 5V on the OPEN, CLOSE, AND STOP buttons. So my N-FET model doesn't work as it's normally open and I send voltage on GATE to close it.

If I have a 5V normally OPEN connection that I need to close for about 1-2 seconds a few times a week, is there a normally open FET, Relay, SSR? I 've seen a JFET not sure if it's appropriate here.
I'm using a wall socket to power the ESP8266 so 3.3V is all I have to work with.

  1. If I looked at a normally open relay, could I use a 3.3V to 5V logic converter to power the relay and set the PIN low when I trigger it?
  2. Is there another FET that I can use the 3.3V that I have to trigger a OPEN of the circuit that is NC.
  3. Is there another way that I can use my existing 30N06L to convert it from NO to NC?

Many thanks.

I was so happy to see the lights shine when I pressed the button on my phone to MQTT then a bit of a facepalm when I realized the electrical part of my project was flawed.

Opto couplers are normally used to operate buttons on another device (that could have a different ground potential).

Connect the opto transistor across the button (collector to +), and drive the opto LED (with curent limiting resistor) from the ESP8266 pin. Resistor value should be between 330ohm and 1k.
470ohm is a safe value.

Thanks WaWa...

Is this opto isolator what you were thinking about with a 470 ohm resister on the 5v side?

So basically, when I flip supply some voltage to the LED side of the isolater (i'd guess I'd need to reduce the voltage to not burn the mini LED). that it would close the circuit and the device would come on.

In my case, I need a Normally Closed circuit, so you are thinking to keep the LED on all the time and close it for that brief second that I want to close the circuit?

That guy in the video has the basics right.
You only don’t need a second transistor to activate a (low current) switch.

The opto LED can stay on all the time. The resistor in series with the LED reduces current to a safe value (<=5mA) for LED and ESP8266 pin.

Not sure what your circuit looks like (you can draw/post it), but when the opto LED is lit, the opto transistor is switched on (closed).

Note: the ESP8266 is a 3.3volt processor and outputs 3.3volt, not 5volt.

Hi Wawa,

Attached is my current setup. The N-FET (30N06L) that i’m currently using is a NO and my garage sensor with no button pressed is sending 5V. So I need to change the NO to a NC and allow that 5V to run to the switch at the top (part of the gate) .

So, i’m thinking this optiisolator as NO will do the trick just nicely. I never knew they existed.

If I swap the NFET out for the optoisolator/coupler. put a high (say 10k?) resistor inline (remove the current 10k to ground) and throw the PIN high on the ESP8266 It should work right? I can’t test as i haven’t ordered the opto’s yet.


It might be wise to measure the current needed to operate that 5volt switch.

Use a DMM and measure the current by putting the test pins across the switch contacts.
The garage door should activate.

An opto coupler can be used if current is <3mA.
If higher, then a second transistor (amplifier) has to be added.
Report back.

Hi Wawa.

Reporting back.

Just got my opto coupler's in the mail and I can successfully keep a circuit open on my breadboard by supplying a limit amount of power on a pin (HIGH) with 470 ohm resistor.

However, if I shut off the ESP8, the port goes low and the opto opens, thus opening my circuit and the gate (circuit opens).

My gate opener is sending 5v on a pin and when a remove switch is pressed, the circuit temporarily closes and the gate opener senses that and opens the gate.
My idea for my ESPP module was to not mess around with teh gate opener but rather tap onto the switch. and run inline.
If I can keep the ESP up all the time, then it's fine. But if there is a power outage or the ESP goes dead the gate opens.

Any ideas?

Post a diagram showing how you have connected the opto to the switch, and a picture of the setup.

Hi Leo.

I haven't yet connected it to the switch. Still on my breadboard.
The garage door gate/board normally sends those 5v and the switch (push button on the way) closes the circuit temporarily.

So wondering if this would be better as it's NC. That way I can use the pushbutton or even if the ESP8266 is off, teh circuit is still closed.

I'll try to draw it up.

Thanks for your help!