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:
Use a mosfet connected to the arduino pin to switch a 24v power circuit that’s connected to the coil of the relay.
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.
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.
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:
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.