Relay Opto Isolation

I fully understand this diagram for relay isolation.
6m95zlV

But I'm bit unsure if what I'm planning to do is alright.


NOTE: buck will use the same 12v supply.

Unlike from the first diagram, the arduino is powered with dc power or usb power, so arduino 5v pin outputs 5V. The issue is that I will power my esp32 on its 3.3V pin. Will that be a problem? Should relay's Vcc be directly from esp's 3.3v output? Like from the first diagram.

Or its necessary to do this?
368054379_1976188349416082_6548004789694181633_n

If the ESP32's GPIO pin draws current from the module's Vcc pin through a resistor, a photodiode, and an indicator LED, then I'm not sure 3.3V would work at all. But 12V would damage the ESP32.

Have you considered changing the buck output to 5V, and powering both the ESP32 and the relay module directly from that?

Yes, 3V3 will be iffy at best.


  • Suggest you use a 3v3 /5v driver to control the input lines on the relay board.

  • Opts or a 3v3 to 5v transistor circuit is recommended.

Then you won't have opto isolation.
Leo..

i just realize this now. so it needs to be a whole separate power supply? if that's the case, should i just use the basic connection? with the jumper attached

I think you shouldn't power an ESP development board with 3.3volt, because some parts on the board might need 5volt. A 5volt cellphone charger with USB lead is an easy way to power an ESP board, and that also will give full opto isolation.
Leo..

You're right. I should'nt use the 3.3v pin to power the esp as it dont have any regulator.
So the best thing to do is this?

Almost right.
VCC of the relay module should be connected to the 5volt pin of the ESP, not to the 3.3volt pin.
Leo..

But the esp is only 3.3v tolerant? Won't that be a problem?

Relay diagram here.
There is a ~1.2volt opto diode and a ~1.8volt indicator LED between relay VCC and the ESP pin.
The ESP pin can't receive more than 5volt - 1.2volt - 1.8volt = 2volt from the relay IN pin.

Powering relay VCC with 3.3volt will not drive the opto LED properly.
Leo..

1 Like

I get it now. Thank a lot!

can 5v for relay's Vcc come from a separate 5v supply? or its required to be from the esp?

Best to power relay VCC from the 5volt pin of the ESP.
If you power the ESP through USB, then there is about 5volt on that pin.

You can of course also power the ESP with 5volt on the 5volt pin (as well as relay VCC).
But this supply should have no shared ground with relay coil power if you want opto isolation.
Leo..

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.