1
\$\begingroup\$

I'm currently trying to understand a circuit for an ESP8266 relay board. As you can see in the schematics below, an optocoupler is used to drive the relay mosfet. I do not understand, why they are using an optocoupler for the control signal.

As far as I know an optocoupler is used to galvanically isolate two circuits from each other, to make absolutely sure, that no voltage spikes, EM-noise, ... will be induced into the microcontroller.

But in that case it doesn't make sense, because the relay is using one common GND and 3.3V Vcc, so why isolating the control signal?

Do I miss something, why the optocoupler is still a good idea?

Thank you very much!

Image

\$\endgroup\$
2
  • \$\begingroup\$ Where did this schematic come from? The only similar one I can find is here which isn't even the correct circuit for the product. \$\endgroup\$ Jul 27, 2019 at 20:27
  • \$\begingroup\$ @BruceAbbott This is the source: github.com/IOT-MCU/ESP-01S-Relay-v4.0 Here is the product bit.ly/2SKU92M \$\endgroup\$
    – John
    Jul 28, 2019 at 5:43

2 Answers 2

1
\$\begingroup\$

This circuit appears to a modified version of other similar boards which have the option of an isolated relay power supply.

My guess is that the optocoupler was left in for compatibility. The FET could be driven by GPIO0 directly, but then the signal would have to be high to activate the relay. The optocoupler acts as inverter, pulling the FET Gate high when GPIO0 is low.

By not changing the circuit the designer can be assured that it will work the same as those other boards, and users don't need to load a special version of the driver software into the ESP8266.

\$\endgroup\$
1
\$\begingroup\$

The schematic is badly laid out. The earth symbol is upside down, current is flowing from bottom to top and there is an unnecessary break in the RELAY net. (By mirroring the MOSFET and R2 the opto-transistor emitter could be directly connected to the gate.)

... the relay is using one common GND and 3.3V Vcc, so why isolating the control signal?

Many of those common hobby relay boards feature jumpers which allow the board to use one supply for everything (as shown) or the 3.3 V supply for the opto-LED only and a separate supply for the opto-transistor, FET and relay.

Do I miss something, why the optocoupler is still a good idea?

The isolation is there if you chose to use it.

\$\endgroup\$
2
  • \$\begingroup\$ The schematics is from the manufacturer. In that case, there is no jumper on the PCB, see here: bit.ly/2SKU92M In that case, the optocoupler is unnecessary? \$\endgroup\$
    – John
    Jul 28, 2019 at 5:48
  • 1
    \$\begingroup\$ I think Bruce's answer covers it. The opto-coupler inverts the logic. It also facilitates operation from an open-collector output such as ULN2003 transistor driver, if required. \$\endgroup\$
    – Transistor
    Jul 28, 2019 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.