1

I am trying to create a fairly standard setup: controlling 4 channel relay with NodeMCU.

I decided to use optocouplers to make connections and generally have everything working now. However I learned the hard way that NodeMCU will not boot if pin D3 or D4 is connected to ground.

I needed to rewire PCB traces to other pins to fix this.

Please, take a look at this piece of schematic - is there a better way to design this, so I can also use D3 and D4 without boot problem?

enter image description here

JYelton
  • 34,119
  • 33
  • 145
  • 265
michal
  • 111
  • 1
  • 1
    With a 1000 Ohm resistor going to the relay, I expect that you are controlling relays installed on one of the common "Arduino" relay boards, rather than controlling bare relays - in that case, the opto is redundant, as those relay modules already have an opto-isolator input. – Peter Bennett Dec 02 '21 at 22:43
  • 1
    @PeterBennett Yes, this is one of those standard relay boards, 4 channel latching relay in my case. Switching a channel requires connecting it to ground for few milisecs. – michal Dec 02 '21 at 23:05
  • connect D3 or D4 to opto pin 2 – jsotola Dec 03 '21 at 00:03
  • @michal that is not a relay, but a relay module with drive electronics built in. The link contains no technical specs or manual how it works. There is no "standard" for them. If there were specs it would be easy to suggest a circuit to send a signal to relay board, now it's unknown. – Justme Dec 03 '21 at 05:28

1 Answers1

3

You could try driving the opto active low instead of active high. The idle state would be high.

I would seriously reconsider why there are optoisolators at all in the circuit. The opto clearly does not do isolation in the circuit, and it seems like the relay takes weak logic input signal. I am assuming more power is spent driving the opto input LED that what the opto output spends driving the relay signal.

A transistor, such as FET or BJT would be far cheaper.

Depending on what the relay input is, a couple of digital buffers would isolate the IO pins from the rest of the circuit, but it can also make the relays to turn on at boot which may be something that is not a wanted feature.

Justme
  • 147,557
  • 4
  • 113
  • 291
  • 1
    The relay is a 4 channel latching relay, similar to this: https://www.wish.com/product/1pc-5v-12v-flip-flop-latch-relay-module-bistable-self-lock-io25c04-5ddc9180e799ac03db9d54d3?hide_login_modal=true&share=web Global On/Off is realised with a mosfet, and switching channels requires connecting channel to ground for few miliseconds. – michal Dec 02 '21 at 23:01