Relay – Purpose of Optocoupler in Circuit to Drive MOSFET/Relay


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!


Best Answer

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.