does this connection make sense?

hello
does the connection on picture attached make sense?
since there is a logic level converter, shouldn't the vcc of the relay be connected to the 5v power supply?
i'm new to electronics, how should i connect this in order to have the common ground?

note: the esp32 is actually connected on a computer. the jumper on vcc and jc-vcc is removed, the picture is just illustrative.

I don't think you need this logic level converter at all. The optocouplers on these relay PCB's work on 5 volts (negative logic).

Erik_Baas:
I don't think you need this logic level converter at all. The optocouplers on these relay PCB's work on 5 volts (negative logic).

yes, but the esp32 works with 3v3
i read it still works, but i was running with many issues, sometimes the relay wasn't triggering, that's why i decide to use to LLC
actually this connecting is working, although it failing to activate the relay sometimes, and while analyzing my connections "again" i notice this, and it seems weird
since i'm not an electronic expert, maybe someone could help

If you have exactly module depicted its schematic looks like :

And you don't need any voltage level converter:

  • Remove JS jumper
  • Connect Vcc to ESP Vcc
  • Connect INx to ESP pins
  • Connect JD-Vcc an GND to 5V relay power supply
  • You don't need to connect relay GND to ESP GND

Specifically, you need to connect the "IN" connections to I/O pins on the ESP.

With the jumper removed, you need to connect "VCC" on the relay module to the 5 V supply on the ESP, not the 3.3 V.

That is one circuit.

Given that the relay module uses 5 V relays, you connect JD-VCC and GND to a 5 V supply of the relays. This is a completely separate circuit and may be from the same power supply you use to power the ESP module, but these two wires should run together as a pair directly back to the output connections of your 5 V supply. Similarly you should run the "IN" wires and "VCC" from the relay module to the ESP together as a group.

Paul__B:
. . .
With the jumper removed, you need to connect "VCC" on the relay module to the 5 V supply on the ESP, not the 3.3 V.
. . .

You may get away with it if the schematic is as follows, because of the voltage drop across two leds in series.
I would have used 3.3 V as @alesam has suggested.

http://wiki.sunfounder.cc/index.php?title=4_Channel_5V_Relay_Module

Don't do it. This way you can damage ESP

I don't the logic behind your statement given that the purpose of the jumper is not to select the ESP power voltage but rather to select the relay power voltage. The schematic clearly shows the jumper simply connects the relay
power input to 5V, which has no effect on the ESP, which obviously, if you understand opto isolators is on the
INPUT side of the 5000V isolation barrier.

With the jumper removed, you need to connect "VCC" on the relay module to the 5 V supply on the ESP, not the 3.3 V.

While this is more or less true, the fact of the matter is that any 5V supply with a common GND with the ESP would
work. Paul_B suggested this since because you are using an ESP . If it has a 5V output then it would be convenient
to use as he suggested. Technically, any common GND 5V source will work.

raschemmel:
I don't the logic behind your statement given that the purpose of the jumper is not to select the ESP power voltage but rather to select the relay power voltage. The schematic clearly shows the jumper simply connects the relay
power input to 5V, which has no effect on the ESP, which obviously, if you understand opto isolators is on the
INPUT side of the 5000V isolation barrier. While this is more or less true, the fact of the matter is that any 5V supply with a common GND with the ESP would
work. Paul_B suggested this since because you are using an ESP . If it has a 5V output then it would be convenient
to use as he suggested. Technically, any common GND 5V source will work.

If you take a look to original diagram posted by TS it has 2 separate power supplies. One for relay and one for ESP. If you understand optoisolators it's better mot to mix them together closing JS jumper and/or using common ground. Keep them separate.

Yes, that's absolutely true to maintain isolation, if
it's needed.

Well, here is the essential circuit simulated in LTspice to demonstrate the voltage that could be seen by a 3.3v ESP32 pin if that circuit is powered at 5 volts.
Having said that, I don't believe it to be a real risk, but demonstrating that from the data sheet may not be so easy.

RelayModule.JPG

RelayModule.JPG

It is clearly not a real risk.

In your simulation, it is using a leakage current of 410 nanoamps at 450 mV applied, or a leakage resistance of 1.1 Megohms per LED. I am not sure how realistic this is for a LED; I have never seen such a parameter specified. A typical specification is for a reverse current of 10 µA at 5 V.

If you reduce the load resistance to 100k using the same leakage resistance as a parameter, you would clearly put the LEDs into normal conduction and if you give them each a threshold of 1.5 V, then you should get about 2 V at the output.

I am sure that the protection diodes on the ESP would be more than happy to see 5 V applied through a 100k resistor, let alone a 2.2M resistance.

I can't help but wonder how two leds in series PLUS a 1k resistor could drop a total voltage of 0.91V ? (and still turn on as indicated by the photo emitting arrows)
The minimum led forward voltage is 1.8V, twice what you show for two leds in series.

raschemmel:
The minimum led forward voltage is 1.8V, twice what you show for two leds in series.

The LEDs are not the same.
One is the IR LED inside the opto coupler, with a Vf of ~1.2volt.
Leo..

I did at one time purchase a pack of dodgy LEDs with real leakage. You had to overcome the leakage before you could get up to the voltage at which they lit up. They were cheap (for that century). :grinning: I think a couple are still illuminating my doorbell push however (and don't care about the leakage). Maybe I should go check.

As noted, they clearly do have some leakage and with a ridiculous load resistance as the "emulation" above, it might show. But I have never seen such a specification.

Wawa:
The LEDs are not the same.
One is the IR LED inside the opto coupler, with a Vf of ~1.2volt.

And the other is green.

I've simply used the standard LTspice model for a LED. The point is not the ability to switch a led on (or not). It is the presentation of a voltage exceeding 3.3 volts at an ESP32 pin. Of course, you can argue that the ESP32 should be man enough to handle this, and it is anyway low current, and that is what pin protection diodes are for etc. , but bear in mind that there are some among us who may not accept this "out of spec" condition. In principle, if you stay within the specification, you avoid long and unnecessary discussion and, of course, risk losing a few opportunities.

he LEDs are not the same.
One is the IR LED inside the opto coupler, with a Vf of ~1.2volt.

Last time I checked, 1.2V>0.91V.
Which post identifies what kind of leds D2 & D3 are ?
Is this just a simple case of series connecting the opto inputs of the relays ?

raschemmel:
Which post identifies what kind of LEDs D2 & D3 are ?
Is this just a simple case of series connecting the opto inputs of the relays ?

Post #5, or simplified:

So, one IR LED in the optocoupler, and one green LED, plus a 1k resistor.

6v6gt:
... but bear in mind that there are some among us who may not accept this "out of spec" condition.

Another example that "you must always stay within specifications" is not reasonable. At least when those among us cannot interpret the specifications well enough.