2
\$\begingroup\$

I am using a relay module to drive a solenoid based on the output from my micro-controller which provides 5v signal. Following is what the circuit looks like:

enter image description here

My objective is to hook up both relay module and solenoid to separate power supply so that they do not create noise in my micro-controller circuit.

However, since relay module requires micro-controller output, Can I say that it has to share the same ground (i.e same power source as the micro-controller)? Meaning I can only provide separate power supply for blue color part and yellow color has to source the same power supply as micro-controller?

What is the common approach to isolate power for solenoid and relays?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Apart from reverse EMF they don't really produce much noise. If there's a flyback across each coil, that's usually sufficient. Or you could replace the relay with a MOSFET driver. \$\endgroup\$
    – Lundin
    Jun 22, 2021 at 14:30

2 Answers 2

1
\$\begingroup\$

However, since relay module requires micro-controller output, Can I say that it has to share the same ground (i.e same power source as the micro-controller)? Meaning I can only provide separate power supply for blue color part and yellow color has to source the same power supply as micro-controller?

Yes, the 'output' from the relay to the microcontroller needs to be referenced to the same ground as the microcontroller. Otherwise when the microcontroller brings the port connected to the relay to a low or high voltage no current will flow.

However, the +5V on the switch side of the relay (or blue terminal block) can be connected to anything you want and functions as a switch.

What is the common approach to isolate power for solenoid and relays?

You can use different supplies, or you can use an isolated dc dc converter. It may not be necessary to isolate the solenoid at all, isolating is typically used to separate power systems if the loads (especially switching loads) create noise for other loads or if there are problems with EMI (electromagnetic interference).

Isolation can come at cost (isolated supplies can be more costly than regular DC DC converters), you could probably just use two separate supplies and not keep them isolated. Make sure you have a good ground (if running wires make sure that they are low enough resistance to prevent common mode voltage (voltages are generated when running large current through resistance/wires).

\$\endgroup\$
2
  • \$\begingroup\$ "Yes, the 'output' from the relay to the microcontroller..." -- I think the "output" is better described as being from the microcontroller to the relay. \$\endgroup\$
    – ErikR
    Jun 21, 2021 at 15:48
  • \$\begingroup\$ That's why I put 'output' in quotes, as the OP describes output from the relay to the micro and I wanted to follow their convention, typically the output is described from the vantage point of the micro, and the relay would be described as an input from the microcontroller not the other way around. \$\endgroup\$
    – Voltage Spike
    Jun 21, 2021 at 15:52
1
\$\begingroup\$

Some relay modules have optocouplers to isolate the microcontroller side from the relay side and have a jumper to optionally tie the power supplies.

My (possibly incomplete and/or incorrect) understanding goes like this:

If you don't tie the power supplies together, the MCU signal drives the LED in the optocoupler. The phototransistor, transistors/MOSFETs, and relay coil are powered from a separate board supply. And if you wanted the relay to control power to a solenoid, you'd need to provide power for that circuit as well. So potentially, that would be a third supply.

The 5V relay boards, however, are popular because they can be driven from the same supply that a 5V MCU (like many Arduinos) use. I think that defeats the isolation between the relay coil and the MCU, which is why many of the 5V boards don't have the optocouplers.

In my use case, the relays are controlling 12 VDC circuit (solenoid valves), so I'm considering using a 12 VDC relay board with the opto-isolation, and using a 12-volt supply for both the relay board and the solenoids it will control. That should protect the microcontroller, and even allow me to use a 3.3V MCU as long its outputs can source enough current to drive the LEDs in the optocouplers.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.