Controlling 24V industrial relay with arduino

Hello. Welcome. And thank you for the click......

Little background: I’m good with code and plug and play hardware... and can do basic soldering... but my knowledge of electronic circuits and components I’m no good. I tried to search online for answers but I’m a little stuck.

I have been trying to figure out how to control relays with 24v DC coils from an esp32 or similar arduino.

What I’ve read so far is:

  1. Use a mosfet connected to the arduino pin to switch a 24v power circuit that’s connected to the coil of the relay.

  2. Use a 5v relay to control the 24v relay

I was actually hoping that there was a #3 option such as an easy to use premade breakout board or shield to send 24v signals from the arduino.

The idea behind all this being that industrial relays are usually not 5v coils but 24v coils. I want to be able to use all these 24v relays in my panels... and instead of using a 24v plc controller (which I don’t have) I wanted to control it with the arduino (since arduino is my jam!) Looking for an easy option, I know I there’s an easy way I just don’t know how.

Hi @LEDBuilder_dot_org

Are the 24V used to drive the relays AC or DC?
If it is DC, there are modules with MOSFET on the market.
You turn on his gate on arduino, drain on relay, supply on Gnd, (The Gnd of the arduio must be connected to the Gnd of the relay source) the other side of the relay at +24V .
This link is an example of usage.

Perhaps the IRF520 is not the best model for these cases, due to the gate voltage (RDS), but there is a wide variety of MOSFETs on the market.
And this is a link with an example module with 2 Mosfets.
15A 400W MOS FET Trigger Switch Drive Module PWM Regulator Control Panel for arduino|pwm controller|panel controlpanel switch - AliExpress u & DEVICE = C & albpg = 1234649595286 & albpd = pt32803005422 & gclid = Cj0KCQjwkIGKBhCxARIsAINMioKO9JBMx2lS2Tm88K69NU13ld5PtuPPVi_ghmVJSmOK3E1XMQc7VEoaAjyOEALw_wcB & gclsrc = aw.ds & aff_fcid = 86d968af656f4b09a11710b837b6066a-1631669314173-01939-UneMJZVf & aff_fsk = UneMJZVf & aff_platform = AAF & sk = UneMJZVf & aff_trace_key = 86d968af656f4b09a11710b837b6066a-1631669314173-01939-UneMJZVf & TERMINAL_ID = 5ff2ab04af0a496d8c70d91eb177dca1

RV mineirin

You left out one very important detail. It the relay coil AC or DC?
If it's AC, then you have to use an intermediate relay.
If the 24V is DC, then I would simply use a logic-level MOSFET to control the relay directly.
There's lots of choices, but I use what I have in my kit. In this case a 2N7000.
You can use this schematic for an example, just replace the motor with the relay:

Wow great, thank you for the explanation. I updated the original post to mention that the coils are DC yes.

so does that mean I could use this? oh wow that would be perfect.

Yes, apologies not AC, its a DC 24V.

I didn't expect to get answers so quickly. Thank you.

Well. To bare my soul here I don't know anything about MOSFETs, well, starting to. Confused they are like low voltage relays, phew. I need to do some research. But yea this is really interesting.

I guess the general consensus is MOSFET.. Would this work?

How much current do the 24V relay coils require?

No, a TRIAC would do nicely. For less than 100mA, a MOC3021.

I've never used a TRIAC, but don't you need a zero-crossing circuit to keep it on?

Hi @SteveMann
If you are going to use it only as a switch you don't need zero crossing,

but you can also use MOC3041 which only triggers the triac after zero corssing.


RV mineirin

Series resistor for input diode of the MOC missing! :astonished:

Hi @Paul_B

oops, I inadvertently deleted it when I copied part of my original drawing.
It does have a resistor in series with the MOC LED;

RV mineirin :grin: :grin: :grin: :grin:

Original schematic

11.5 mA DC 24V

A note in regard of the relay boards using optocouplers and a series green indicator LED.

The green LED and the IR LED in the optocoupler have a combined threshold voltage which approaches 3.3 V, so it may be better to connect the series pair to a 5 V supply if you have that, and allow the ESP to pull down to drive them properly. May even be a concern with a red LED.

If you are controlling multiple relays, I would go with a TPIC595 power shift register, 8 outputs and only 3 control wires to MCU, your application is what it's designed for.