0
\$\begingroup\$

I have been doing this for years (on automotive projects) but the need finally arose to clarify:

When using a SPDT 12V relay (with internal flyback diode), should I isolate the ground trigger when using a micro-controller?

I suppose I could drag everything out and measure current when switching (I am thinking there is none), but I am charging a battery that will likely not complete tonight.

Should I use an optocoupler, or can I simply feed the ground in one pin and trigger output on another?

Oh yeah, Arduino UNO is the target controller.

Thank you


Edit://

Maybe I should also clarify the relay wiring:

http://i.imgur.com/6kPhxdT.png

(will be replacing switch with Arduino)


Note that the previous description was incorrect. Please see diagram drawn from circuit.

\$\endgroup\$
3
  • \$\begingroup\$ I don't know what your pin numbers refer to, but the Arduino outputs (actually, GPIO) are 5V, so if off, you will be delivering 12VDC through the coil to the output pin. Doesn't sound like a good idea. I would definitely use an optocoupler between the Arduino and the relay coil. \$\endgroup\$
    – R Drast
    Apr 30, 2015 at 12:03
  • \$\begingroup\$ I understand that most people try to pass the positive voltage through the pins. I am passing the ground. I guess the real question I have is whether the current flows on the path of least resistance. Power -> relay wire length ~6 inches. Ground -> relay path about ~80 ft (round trip). Is working fine as is with microswitch. No heating, no arcing. Also note that the battery is providing power to relay only Arduino will have separate power. So really just 'bridging' two pins on Arduino to act like a switch. \$\endgroup\$
    – Gabriel
    Apr 30, 2015 at 13:58
  • \$\begingroup\$ You are connecting the ground when you turn on the relay, so yes, at that point, your Arduino output is at ground. However, when it is DISABLED, you still have 12V on the relay, which means 12V on the Arduino output. The relay might not even drop out, since I believe the Arduino internally pulls the outputs high (to it's 5V rail) which is not an open circuit like a microswitch is. \$\endgroup\$
    – R Drast
    Apr 30, 2015 at 15:25

1 Answer 1

1
\$\begingroup\$

You are going to need an interposing transistor driver between the microcontroller and the relay.

There are two reasons for this:

1) Your relay coil takes more current than the microcontroller can supply.

2) The output voltage of the microcontroller is either 0V or 5V. The bottom end of your relay coil has 12V on it when it is not pulled to ground.

You don't need an optocoupler unless there is a need to electrically isolate the controller power supply from the relay coil power supply.

schematic

simulate this circuit – Schematic created using CircuitLab

The above assumes that you are using a relay with built-in flyback suppression diode and the top end of the relay coil is tied to your 12V power rail.

Note that the ground of the 12V rail is tied to the controller ground.

\$\endgroup\$
1
  • \$\begingroup\$ "You don't need an optocoupler unless there is a need to electrically isolate the controller power supply from the relay coil power supply." Well, that is the thing... They are already isolated. and the round trip coil ground wire length is about 80 ft. \$\endgroup\$
    – Gabriel
    Apr 30, 2015 at 14:02

Your Answer

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

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