Help understanding optocoupler wiring

Hi all
I have a project with a 4 module optocoupler relay, controlled by an esp32 Arduino.
I wired the project following the instructions to isolate the esp32 MCU and the relay, powering the relay with an external 5v psu from JD-Vcc and Ground, and then the VCC to the MCU.

I understand that having separate Grounds isolates the high voltage circuit from the MCU and thus protects it.

However, I fail to understand how this works since a common ground should always be there for a circuit to work, right?
What's working as a common ground here? or why does it work without one?

The other thing I don't understand is why the VCC, even when you are powering the relay's JD-Vcc and Ground using an external PSU
Why do I need to connect also VCC to the MCU?

Thank you in advance for the help

Show us a good schematic of your circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.


An electrical circuit is just that - a circuit. There must be a complete path for the current to go from one part to another and return.

The matter explained in the reference is simply that when you connect one part to another, and specifically an input device, you must connect not only the "signal" line but the corresponding return from one to the other otherwise you do not have a circuit.

So you connect 5V and control line from the ESP32 to the relay module (with the VCC to JD-VCC link removed). The return is the 5 V, not ground.

How to add a Relay to Arduino has some comments on this, but may not be as helpful as you would like.

The one and only purpose of an optocoupler is to
- electrically isolate


- transfer a signal

which is done not by electrity but instead

by light

(the two arrows in the middle

To keep the fully electrical isolation the GND of the arduino must be kept dis-connected from the relais-boards ground

best regards Stefan

Imaging you had a light dependant resistor on an input pin.

Then you shine a flash light on it, the resistance changes and you can see that effect on the Arduino pin.

There is no connection between the batteries in your flash light and the Arduino.

Thank you all for the replies.
I think I get the idea now!