Jump to content

Controlling 24v relay

dlink377

Hi, I am planning to install simple home automation at my home, however, I am stuck about how to active the 24V DIN mounted relay using my Arduino (mega).

 

I know i can use two options: another 5v relay, or a mosfet?

 

If using another 5v relay, i will use 5v relay and optocoupler (just like those cheap relay board).

If using mosfet, i will just see normal mosfet diagram on google, just like controlling 12v PC fans or LED strips.

 

Which one is a better choice? I am planning to connect it to MCP23017 or any other IO expander (as I need 32 inputs and 32 outputs). Computer will communicate with the arduino using rs485.

Link to comment
Share on other sites

Link to post
Share on other sites

If the relay needs 24v to energize you're better off just using the mosfet. If the relay can be energized with 5v its as simple as connecting one side of the coil to the ground pin on the arduino and the other side to any writable pin. Then just use a digitalwrite() to activate the pin energizing the relay. 

Link to comment
Share on other sites

Link to post
Share on other sites

You could also use a cheaper and potentially easier to work with transistor with a resistor on it's base pin to limit the current (and not damage the transistor). 

A 24v relay would work just fine with a wide range of input voltage (typically anything from around 15v and up), so the voltage drop on the transistor of around 0.6-0.8v won't be a problem.

Also you should consider using a latching relay and use two i/o pins if needed, one to turn on the relay and have it latch, another one to unlatch the relay.  This way once the relay is set to some position, you don't use any power to keep it on that position.

Link to comment
Share on other sites

Link to post
Share on other sites

I would just use something like this for your application. Its arduino based and has all the relays and logic you would need built in.

http://www.robotshop.com/en/ardbox-plc-18-i-o-arduino-industrial-module-relays.html?gclid=CMTou4S-gtQCFRSGfgodV1MNBA

Case: Phanteks Evolve X with ITX mount  cpu: Ryzen 3900X 4.35ghz all cores Motherboard: MSI X570 Unify gpu: EVGA 1070 SC  psu: Phanteks revolt x 1200W Memory: 64GB Kingston Hyper X oc'd to 3600mhz ssd: Sabrent Rocket 4.0 1TB ITX System CPU: 4670k  Motherboard: some cheap asus h87 Ram: 16gb corsair vengeance 1600mhz

                                                                                                                                                                                                                                                          

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

16 hours ago, Silverwolf_7 said:

If the relay needs 24v to energize you're better off just using the mosfet. If the relay can be energized with 5v its as simple as connecting one side of the coil to the ground pin on the arduino and the other side to any writable pin. Then just use a digitalwrite() to activate the pin energizing the relay. 

I actually can just buy 12v or even 5v relay for doing to the job, but it seems 24V is a standard for electrical works like this, so I just following the standards.

 

If using 5v relay, I would just using optocoupler to activate the relay, just like those cheap relay boards on ebay.

 

14 hours ago, mariushm said:

You could also use a cheaper and potentially easier to work with transistor with a resistor on it's base pin to limit the current (and not damage the transistor). 

A 24v relay would work just fine with a wide range of input voltage (typically anything from around 15v and up), so the voltage drop on the transistor of around 0.6-0.8v won't be a problem.

Also you should consider using a latching relay and use two i/o pins if needed, one to turn on the relay and have it latch, another one to unlatch the relay.  This way once the relay is set to some position, you don't use any power to keep it on that position.

I would look into using normal transistor to activate the 24V relay. I guess relay doesn't use that much power, only 1W usually.

 

How about using another relay to activate the 24v relay? I am guessing extra protection, as I have two isolation between the AC line with the arduino, not including optocoupler to control the small 5v relay.

 

Latching relay is so expensive. I need to control 300 light group, need around 300 pieces relay, another 300 pieces of 220V AC relay to detect the state. One set of 24v omron relay and din rail mount is around USD 3.00, a latching relay easily goes up to USD 20.00 each.

 

9 hours ago, bob345 said:

I would just use something like this for your application. Its arduino based and has all the relays and logic you would need built in.

http://www.robotshop.com/en/ardbox-plc-18-i-o-arduino-industrial-module-relays.html?gclid=CMTou4S-gtQCFRSGfgodV1MNBA

I need around 300 I/O minimum, at different location, using ready product (not DIY) is not feasible for me.

 

However, I have plan to buy those RS485 DI/DO controller, I seen one locally for only USD 70.00 (32 inputs, 32 relay output, RS485 and RS232 communication). I am just worried about the durability of the product, and how exactly I can communicate with the device itself using RS485.

 

As on Arduino currently, I just buy RS232 to RS485 converter at the host and RS485 to RS232 converter at the end.

Link to comment
Share on other sites

Link to post
Share on other sites

Transistors can have high voltage on collector and emitter pins, 12v or 24v is not a problem. On the base pin, they only need voltage above a threshold, so they'll work even if your controller works at 3.3v or 5v.

 

 

12v relays are cheaper to manufacture than 24v, and they're also used more often because in general more electronics are designed to work with voltages less than 24v (there are more regulations and tests and safety things that products must pass if they work with 24v or more, that's why you also see up to 19v in laptop power adapters and not higher voltages)

SP = single throw, DT = double throw , SP = single pole , DP = double pole , TP = triple pole etc see attached pdf for transformer terminology

In quantity, you can buy SPST (single pole single throw) relays for less than 1$, here's an example 0.8$ each if you buy 100:  ORWH-SH-112D1F,000 General Purpose Relay SPDT (1 Form C) 12VDC Coil Through Hole 10A 12V

To control both LINE and Neutral you'd need two such relays, for a cost of around 1.6$

DPST OR DPDT are usually more expensive than SPST or SPDT , but they can be convenient if you're space limited. For example, here's one that's DPDT and can carry 8A continuously for  1.7$ each if you buy 100 : RT424012 DPDT (2 Form C) 12VDC Coil Through Hole

It's only 8A max on high voltage side because SPST/SPDT only need to handle the heat produced by the contact resistance of one contact, and these have two sources of heat.. so higher A relays would be more expensive.

 

These 12v relays turn off below around 2v and are guaranteed to turn on from around 9v so you don't need super precise 12v power supply for them.

Most are also designed in such a way that they're by default insulated, they low voltage coil is far away and insulated well enough from the high voltage side that you generally don't need optical insulators.

The way I would do it would be to get a cheap 12-15v AC transformer, use a bridge rectifier and a capacitor to convert that to DC and smooth it out a bit  and a 7812 linear regulator to get 12 v for the relays, and a 7805 or something equivalent for the microcontroller's 5v and rely on relay's default isolation.

If you're paranoid, you can always get a transformer with two secondary windings and use one to power the relays and one to power the electronics and then use optical isolators between the two sides... it would generally be cheaper to use two secondary windings than spending 2-3$ on an isolated power supply module for the microcontroller side.

 

These 12v relays use around 30-35mA when they're on, so you just have to size your transformer to let's say 45mA per relay and add maybe 50-100mA for your microcontroller.

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×