Jump to content

Controlling Power Relays from a microcontroller


TerryE

Recommended Posts

PREAMBLE NOTE:  This thread was really a separate topic so split off from Logging from DS18B20s.

 

I've just put together my first breadboard of my switch design and got is working in a couple of hours.  I have to switch my 2 × SunAmp and the Willis, all of which have 3kW elements and the UFH pump.   This is a little convolved because I want my electrician to install the 240V side and sign this off. So I will be using 4x pukka DIN rail mounted power relays to CE and relevant approvals.  (such as the FINDER 22.21.9.024.4000 Power Relay, SPST-NO, 24 VDC, 20 A, 22 Series, DIN Rail).  Their coils, in this case, will be driven by 24V DC inputs which draw roughly 1.25W to close the contact.  The normal way to drive these from a microcontroller would be through a set of Darlington pairs (the UNL2308A gangs up eight of these pairs) and this chip is rated up to 0.5A collector current per pair.  On the input side this chip can be directly driven by the esp8266 GPIOs similar to this PIC example:

 

relay-driver-circuit-using-uln2003.jpg?r

 

I still need to check if I need the the external Zener diodes as a free wheeling diode to avoid back emf effects. My fallback is to use a second bank of lower spec relays to switch the 24V.   This might seem like over kill but the cost and complexity is in the noise.  I mainly need my sparky to be comfortable with his installation.    Hey Ho and onwards.

Link to comment
Share on other sites

I also got the 230 V side signed off with just switched outlets for things like the ASHP, heating controls, MVHR and water heating, so that it was then OK for me to add stuff after the switched outlet without falling foul of Part P.

 

For switching power I've used SSRs pretty much everywhere, rather than relays.  The advantage for high current stuff is that they zero volt switch, so there's no hefty switching current or spikes and they are optoisolated and easily driven directly by a microcontroller pin (the ones I used are typically around 10 mA at 5V).  I've used 25 A ones in the main, really just to have a bit of headroom.  The other advantage of using these is that you get an LED indicator built in, rather than having to add it to a DIN rail relay.

 

I did use relays for the heating controls, but that was only so I could use some simple relay/diode logic, and avoid using a microcontroller, plus it made it easier to control the dry contact operated ASHP.  They are the Finder DIN rail ones, with the extra LED module to show which relay is on.

  • Like 1
Link to comment
Share on other sites

I'll also so take a look at SSRs (solid state relays).  The challenge that I find is not working out how to do this, because there are just so many solution options available, but rather picking a good one from the resilience and maintenance perspective.  Cost is in the noise.

Link to comment
Share on other sites

My issue was finding solid state relays that are DPDT. 

 

I may have found a way to simplify a stat changeover though using the valve change over switch assuming it fully isolated - the joy of using off the shelf parts ..!

Link to comment
Share on other sites

8 minutes ago, TerryE said:

I'll also so take a look at SSRs (solid state relays).  The challenge that I find is not working out how to do this, because there are just so many solution options available, but rather picking a good one from the resilience and maintenance perspective.  Cost is in the noise.

 

I agree 100% with that, and the long term maintenance and repair issue was one that became more important to me as time went on.  I've been putting together a manual for the house systems, with a really basic level of detail, so that, with luck, someone other than me will be able to understand both how everything works and the reason that it was done in the way it was.  The biggest challenge for me has been reining in the tendency to make things complex when they don't need to be, just because it's fun!

Link to comment
Share on other sites

Not directly related to this thread, but something that I recommend for anyone needing to do hardware debugging is a Bitscope which you can get for around £80 (though I bought mine pre-vote for nearer £60).  Even so it's for more than an order of magnitude cheaper then the DLOs we used to buy. 

58d7f23b42a25_BitscopeOutput.thumb.png.ebe11633184b6b10c98994396d50b568.png

  • Like 1
Link to comment
Share on other sites

 

9 hours ago, JSHarris said:

For switching power I've used SSRs pretty much everywhere, rather than relays.  The advantage for high current stuff is that they zero volt switch, so there's no hefty switching current or spikes and they are optoisolated and easily driven directly by a microcontroller pin (the ones I used are typically around 10 mA at 5V).  I've used 25 A ones in the main, really just to have a bit of headroom.  The other advantage of using these is that you get an LED indicator built in, rather than having to add it to a DIN rail relay.

 

@JSHarris Jeremy, it looks like I will go with the Crydom CKRD2420 models.  Thanks for the steer.  As you say, you can control these through a 5V GPIO and there are no back EMF issues that you find with mechanical relays.  There are £57.45 from Farnell and £35.09 from RS.  Guess where I'll be getting then from?  As you say, I am very reluctant to go to an unknown supplier for something like this as I will be putting 3kW through them.  They've got some thumping heat sinks on them, so need decent airflow.  Have you just got them mounted on a bare DIN rail or in some form of DIN enclosure?

 

8 hours ago, PeterW said:

My issue was finding solid state relays that are DPDT.  I may have found a way to simplify a stat changeover though using the valve change over switch assuming it fully isolated - the joy of using off the shelf parts ..!

 

Peter, I am not sure why you'd need double pole or double throw for power switching applications.  I would be interested in a little background :)

Link to comment
Share on other sites

Sorry @TerryE - need to switch two thermostats over when a 3 way valve switches over to drive the correct temperature to an ASHP. Using 5v logic and 12v valves was the original idea but then found 220v versions of the same 2 way and 3 way valves. Issue is that ASHP needs a 220v thermostat as a controller signal but wanted to do everything in 5/12v so it was easier for me.  

 

any clearer..?? 

Link to comment
Share on other sites

@peter if this is just a 220 VAC signalling route (ie. the current is in the mA rather than A) then a 2 channel opt isolated relay board based on the small Songle relays would do this fine.  They are cheap as chips. (£4-8 in the UK.)  Or even a couple of ITEAD Studio Sonoff switches that I mention earlier in the topic.

Link to comment
Share on other sites

14 hours ago, TerryE said:


@JSHarris Jeremy, it looks like I will go with the Crydom CKRD2420 models ... as I will be putting 3kW through them.  They've got some thumping heat sinks on them, so need decent airflow.  Have you just got them mounted on a bare DIN rail or in some form of DIN enclosure?

 

@JSHarris, Jeremy I'm not sure if you noticed this Q in the exchange, but I would value your opinion. Thanks

Link to comment
Share on other sites

@TerryE, Sorry, I missed this earlier.  I used the non-DIN rail mount ones, bolted to the back of a diecast alloy box as a heatsink.  The box gets very slightly warm with a load of 3kW, so with the big heatsinks on the DIN units I'm sure they would be OK inside an ordinary DIN rail enclosure. 

 

Link to comment
Share on other sites

I was reading on this StackExchange topic that SSRs typically have a 1% heat loss in the internal thyristors or ~ 30W per "on" relay in my case. Not enough to merit a work around but in the case of my small equipment cupboard -- when combined with the waste heat from the 2 × SunAmp -- enough to include top and bottom ventilation into the toilet area (which has an MVHR extract in the ceiling). 

 

I like the idea that one guy mentions of paralleling up an SSR and a mechanical relay so you switch on the SSR for only a second or so, so that when you turn on (or off) the mechanical one, this as done at 0V across the contacts so no contact wear or sparking causing EM interference, and not material wastage from the SSRs which are only on for a few seconds per cycle.  Very elegant, but not cost effective in my case :) 

Link to comment
Share on other sites

From the data sheet the on state voltage drop for the CKRD2420 is given as 1.6 V peak at 20 A.  At 13 A, assuming the on state voltage drop is the same, then the power dissipation would be 20.8 W peak, or a bit under 15 W rms. 

 

That tallies pretty well with the way the most heavily loaded SSR I have seems to behave, it's just bolted to the back of a diecast box that's about 120mm wide, 95mm high and 60mm deep.  I did run an end mill over the inside base of the box to get a flat mounting surface, and used a bit of thermal grease, but this may have been overkill for switching 3 kW.

Link to comment
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
×
×
  • Create New...