Switching between two mains AC sources using solid state devices - Page 1
Forum section: electronics / beginners

author: gnif
author_rank: Unknown
timestamp: January 31, 2022, 12:06:56 pm
content: Hi All,I am at it again, trying to design something useful to me but once again stopped by my lack of understanding... I have two AC sources I need to switch between dynamically that might be out of phase with each other. The switchover delay while waiting for phase sync is not an issue (ie, can take 10s of seconds if needed), but when it does I want the phase to be in sync and to switch at the zero voltage crossing (or as close to as reasonably possible).I have attached what I have so far which does the phase and zero crossing detection as best I can figure how and yes I do think there is room for improvement here, however at this time it's just a proof of concept. The area I need help with is the "Magic goes here..." section. The two sources `AC1` and `AC2` need to be switched according to the output of the flip-flop, and it needs to be high side switched unless I am mistaken here. The lamp is the simulated load.Just a high level guide is all I am looking for a this point, I am happy to do the research and investigation needed to produce something viable once I understand what is needed here.

author: dmills
author_rank: Super Contributor
timestamp: January 31, 2022, 12:31:51 pm
content: If this is mains AC (You don't really say) it is nastier then you think, because you need to switch both phase and neutral or you risk a fault condition putting high voltage on the pins of a putatively disconnected plug.Were I doing it I would probably use a set of relays or contactors with force guided contacts to provide the (monitored) safety isolation then a set of butch mosfets to switch, then drop the isolating relay out.

author: gnif
author_rank: Unknown
timestamp: January 31, 2022, 12:39:35 pm
content: Sorry yes, I left this detail out, it is mains voltages. I was concerned about the neutral side, glad you filled in that part.As for the relays/contractors, I wouldn't think they would be fast enough to do it ensuring it's at the zero crossing point.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: January 31, 2022, 12:56:58 pm
content: I posed this question on here quite a while ago. Since then, I run a few servers and a security system through a DPDT relay. The when the primary power goes out, it powers down the coil and allows the active and netral to connect to the power coming from the inverter. When the power comes back the relay allows the primary power to flow.It's a horrible solution but it works. It's a clearance and tolerance nightmare, but I don't worry about the out of sync. If switching does harm the input caps in the PSUs, thats lot easier to fix than drive-write crash.Pull apart any of those cheapy Jaycar UPS. They are even more horrifying.If I had my time over, I'd prolly run a pair of relays for A and N, but the ordinary din cradle and matching relay from altronics hasn't let me down for, I dunno, years. All in a metal box and fused and earthed so it can go bang if it wants. It's already paid for itself.Oh, I and added a 12v relay and a timer to the coil of the 240v relay. What that does is wait for the primary power to stay on for a time before allowing the coil to switch over to the primary. This is to avoid the primary from accepting a unstable power supply.Doesn't protect from low or high voltage, alas.I'll try and find my old thread. I recall the consensus was, you prolly shouldn't but it prolly doesn't matter.I made the thing to try and as I said made the timer later and here we are much later.

author: BradC
author_rank: Super Contributor
timestamp: January 31, 2022, 12:58:02 pm
content: Sounds like pretty much the basis for an automatic transfer switch.I'd use a DPDT contactor to select between the sources, and then follow that with a pair of triacs which are then bypassed with an DPST relay.Switch off the triacs and SPDT relay to isolate the output. Select source, then switch the triacs on at the next zero cross. At the same time or just after, bring in the DPST relay to bypass the triacs.The triacs are really only there to pick up right on the start of the zero cross and are immediately bypassed with a relay.In some older APC ATS and UPS they used a voltage booster on the critical relays to bring them in quicker. Like a 24V pulse on a 12V relay to speed it up then back to 12V to hold it in.Optionally, replace the DPDT contractor with a pair of separate DPST relays which can ensure isolation of both inputs in case of an issue with triac failure or leakage, but then you really need to make sure they are mechanically interlocked to prevent accidental cross conduction.

author: gnif
author_rank: Unknown
timestamp: January 31, 2022, 01:09:28 pm
content: Quote from: BradC on January 31, 2022, 12:58:02 pmIt essentially is. I have an IBM branded APC 2RU 3KVA UPS I use as a hybrid solar inverter/UPS, however it does a terrible job of phase sync when switching back to utility power (mcu controlled SSR on the active feed to it). Power comes back online causing an RCD on it's output to trip from time to time. In data centres I know that the RCDs on these things are either special or not used at all, however this is a home/office environment so I feel the extra protection it provides is necessary.Anyway, the UPS failed and I am now looking at building a new setup using a inverter, thus the design here.

author: BradC
author_rank: Super Contributor
timestamp: January 31, 2022, 01:22:50 pm
content: How odd. I have some older APC SmartUPS here (3, 2.2 & 1.5KVA) and they whip back into sync within 10 seconds.I'm in the process of building a front-end generator ATS with auto-start for those.How are you going to swing the inverter back into sync?

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: January 31, 2022, 01:25:35 pm
content: Quote from: gnif on January 31, 2022, 01:09:28 pmAh. What I had to do was flick the caps they put on the output earth to A and N. But don't not-Earth the inverter. Run the output of the inverter through a proper RCD.Edit: you have to decide how to manage the earth connection to the inverter's output. And if you want to tie it to the neutral.

author: Capernicus
author_rank: Frequent Contributor
timestamp: January 31, 2022, 01:31:45 pm
content: You could do it by converting to dc and back again! :0)

author: gnif
author_rank: Unknown
timestamp: January 31, 2022, 02:41:55 pm
content: Quote from: Ed.Kloonk on January 31, 2022, 01:25:35 pmSorry but would you mind elaborating on this? If it's a simple fix i'd rather repair the UPS (if I can get IBGTs to suit it) then go down this other route.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: January 31, 2022, 02:48:46 pm
content: Just been looking through my notes. The problem with the solid state solution is isolation from the grid. The RCD tripping must be addressed. What we found was temporarily disconnecting the earth of the inverter from the circuit, the trip persisted. It was tracked down to a leaky printer crap power supply. That PSU was on the same power circuit but not related to the UPS, in another room. The thing is that printer knocked out the portable RCD on the desk when I first plugged it in. So it was a pup.So, I'd go looking on that power line for something with a bit of leakage not enough to trip yet high enough when the changeover happens that it does trip. Put 10 or 20mA (ie not 30mA) of leakage on the wires to see if it trips. Think about using a 100mA sensitivity RCD. Chances are the gear in the rack is earthed to the tits anyway.Confirm your existing RCD is not faulty. Should typically trip about 27mA. You can buy a cheap earth leakage checker from Jaycar. Or just use your own resistors. A sparky will have a lot nicer leakage meter if you want to confirm and nerd out.Disregard what I said about removing the caps in the inverter. We had tried that but it wasn't the cause. I'm pretty sure the cheaper UPS don't sync up the power. Any rouge caps, my understanding, will be dissipated during the switching time of the relay/contactor contacts.You're supposed to provide Active and Neutral isolation breakers on gensets tied into the house system. The earth stays connected.HTH.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: January 31, 2022, 03:06:10 pm
content: The problem with RCDs is that they don't always last forever. And you only need two devices, one with a leak of 10mA between active and earth, and the other neutral to earth and something's only got to fart near it and it blows.

author: gnif
author_rank: Unknown
timestamp: January 31, 2022, 03:11:42 pm
content: Quote from: Ed.Kloonk on January 31, 2022, 02:48:46 pmThanks for the advice, I did go hunting for an actual earth leakage issue however I simply went around with my clamp meter and checked for an imbalance by clamping around the active and neutral lines, perhaps it's time to call in a favour... one of my mates is a sparky.I am not convinced though it's not the UPS, If I put the UPS on a house outlet that is RCD protected with no load, simply switching it's input on/off will about 40% of the time trip the house RCD, this is what lead me to believe it's a phase issue (or inrush?) with the UPS itself.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: January 31, 2022, 03:19:10 pm
content: Quote from: gnif on January 31, 2022, 03:11:42 pmMaybe not all UPS's last forever either. I went though half a dozen Jaycar UPSs and they failed hard. I built the big relay/inverter/battery frankenUPS and haven't looked back. Server class UPS might be a bit better than the ones I wasted money on, but remember how much energy you're pulling out of that little box.Unless you buy the true UPS and/or enact Capernicus' suggestion, those things aren't really meant to be run all that often I don't think. Heat's the killer.

author: gnif
author_rank: Unknown
timestamp: January 31, 2022, 03:23:31 pm
content: Quote from: Ed.Kloonk on January 31, 2022, 03:19:10 pmThis is an enterprise grade IBM UPS designed for 100% duty cycle usage with extended runtime batteries, etc.Edit: See attached... this thing is built like a tank. That's the hot-swappable power module, only one is barely showing of the two big beefy 180C rated transformers in the other end.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: January 31, 2022, 03:25:34 pm
content: Quote from: BradC on January 31, 2022, 01:22:50 pmI didn't know that.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: January 31, 2022, 03:28:49 pm
content: Quote from: gnif on January 31, 2022, 03:23:31 pmThat's why I'm a but sus of the RCD. I wonder if a lead run from another RCD still trips.

author: gnif
author_rank: Unknown
timestamp: January 31, 2022, 03:29:47 pm
content: The RCD has already been replaced in an effort to fix this.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: January 31, 2022, 03:32:34 pm
content: Quote from: gnif on January 31, 2022, 03:29:47 pmBut did you try another power circuit?

author: gnif
author_rank: Unknown
timestamp: January 31, 2022, 03:34:27 pm
content: I'd have to have another one to test withEither way I guess it's time to look at pulling some cables and running a dedicated feed for this thing, with it's own RCD.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: January 31, 2022, 03:40:40 pm
content: Quote from: gnif on January 31, 2022, 03:34:27 pmYep. Get the 100mA RCD. I presume everything's attached to metal and well earthed. But get a look on a screen what that trip wave looks like and on what wire. It might reveal what you need to look for in the UPS. What about a current probe connected to a scope?

author: David Hess
author_rank: Super Contributor
timestamp: February 01, 2022, 01:22:57 am
content: The simplest fail-safe solution uses a single DPDT relay or contactor so there is no possibility of shorting the two sources together.An alternative might be using 4 zero crossing type solid-state relays with the optocouplers for each side wired in series, with the middle point driven by the selection signal so it is not possible for both solid-state relays on one side to turn on. But now I would worry that they turn off slower than they turn on.

author: gnif
author_rank: Unknown
timestamp: February 01, 2022, 01:27:31 am
content: Thanks but yes, I have abandoned this due to the safety concerns, I don't think I am capable of engineering something that is safe here.

author: BradC
author_rank: Super Contributor
timestamp: February 01, 2022, 01:34:17 am
content: Now with a bit more understanding of what you are trying to do, just use relays. I have an APC rack mount ATS here where the switchover time is well under the holdup of any power supply (generally < 10ms including time to detect failure on the current input) and they use multiple relays in series. Unless something you have really can't tolerate missing 1/4 of a cycle (relay switching time), the added complexity using solid state switches is significant.Heck, I have a manual static bypass panel around one UPS here that uses a spring-preload rotary switch. The switch time is in the order of 10ms and nothing notices.

author: BradC
author_rank: Super Contributor
timestamp: February 01, 2022, 01:35:51 am
content: Quote from: gnif on February 01, 2022, 01:27:31 amGrab a second hand ATS and let it do all the work for you. I paid a couple of hundred bucks for an AP7721 a few years ago.

author: gnif
author_rank: Unknown
timestamp: February 01, 2022, 01:40:48 am
content: I am actually starting to think I have a earth-neutral bond issue completely unrelated to all of this. I have verified in the meter box a good bond between earth and neutral on all feeds into the house however when I go to any outlet and meter the resistance between earth & neutral I am seeing it pulsate.Setting my meter to min/max and fixing the range on k/ohm I am seeing it peak out as high as 20.69k... I know this has gone way off topic from the original post but I believe it might be related but I am not familiar enough with these things to know if this is abnormal behaviour or some switching PSU somewhere might be causing this? or I am measuring it wrongly? Max voltage I am reading is 1.4V AC between N & E.Edit: Further thinking on this... I think it's unrelated and I am just measuring things improperly as the voltage here will cause inaccurate measurements, I will need to cut power and test again when I get a chance.

author: Ed.Kloonk
author_rank: Super Contributor
timestamp: February 01, 2022, 02:26:51 am
content: By connecting the meter to N and E you are diverting current that's on the return neutral and into the earth. Not surprised as you go farther away from the NE link that you see some funk.

author: BradC
author_rank: Super Contributor
timestamp: February 01, 2022, 02:30:17 am
content: Quote from: gnif on February 01, 2022, 01:40:48 amThat's the key. Think about it this way. You are measuring the voltage drop across a loaded neutral conductor. You have your meter on one end, and the other end is connected via a (hopefully) completely unloaded earth wire. If you took all the loads off that circuit you should measure 0V.I don't think that's the issue. A line-interactive UPS does odd things to the power when it switches on and off. The APC UPS you showed a picture of is essentially a set of SmartUPS built into modules. If you look at the circuit you'll find there is no bond between neutral and earth in the UPS, so when it's on battery your down-stream devices have neutral floating with respect to earth and in my experience it floats up such that the neutral and active are equidistant from earth. When it switches back to mains the neutral is suddenly clamped to earth. That's going to do strange things to any suppression capacitors in the downstream devices and provide a peculiar current pulse. The UPS also has one or more capacitors internally that are used with current transformers to measure the mains and load waveforms.Remember these transformer based UPS were designed well pre-RCD.

author: gnif
author_rank: Unknown
timestamp: February 01, 2022, 02:46:06 am
content: Thanks, ok so back to the topic then, except for the running of new cables and using a 100mA RCD, is there anything more I should be doing to the UPS to make it more suited? Ie, is it safe to bond it's neutral output to mains neutral?

author: BradC
author_rank: Super Contributor
timestamp: February 01, 2022, 02:55:09 am
content: Quote from: gnif on February 01, 2022, 02:46:06 amI've never been game to try. I spent enough time repairing my 2.2KVA UPS when the fets went up in smoke. I don't want to be going back in there or trying to fix the 3KVA unit (which is SMD) if I did "something I really didn't need to do".If this is an easily reproducible fault I'd be trying to record it to start with. For example I have a nice current probe for my scope, so I'd start by putting that on the earth to the UPS and setting a trigger to capture any anomaly on the earth. Whatever you try and do to work around the fault is likely to be expensive, so it'd be worth getting a handle on what is actually happening first.

author: gnif
author_rank: Unknown
timestamp: February 01, 2022, 02:57:36 am
content: A current probe is not cheap either and I don't have one...Edit: For the record, I am measuring N float up to 55V when the UPS is operating.Edit2: Also I managed to get the UPS running again with some IBGTs from another parts UPS, they are almost the right modules, enough to test with if I don't put a load on the unit though. Still to find some compatible IGBTs that are not fakes from china.

author: BradC
author_rank: Super Contributor
timestamp: February 01, 2022, 03:42:59 am
content: You could try connecting a 5/10W incandescent bulb between Neutral and Earth and see what happens. It's an experiment I've been meaning to do but haven't got around to taking a UPS out of service to try it out.

author: gnif
author_rank: Unknown
timestamp: February 01, 2022, 03:44:29 am
content: Good idea, I will give it a go

author: gnif
author_rank: Unknown
timestamp: February 01, 2022, 04:20:17 am
content: I can report that bonding the ups N to mains N has no ill effects on this unit and the output is now mains neutral referenced.

author: BrianHG
author_rank: Super Contributor
timestamp: February 01, 2022, 04:38:40 am
content: I have done this before right at my fuse box with my AC mains. (Note that I have 120v, I switched 1 side/phase but the technique can be adopted to 240v).1. Do not use a small relays or solid state, I blew more than one up and also blew up the output mosfets in my inverter after a number of switches.EG:During the switch of the tiny contact space, either a tiny arc is formed or one side may accidentally get welded while the other side switches, potentially throwing 100s of amps into my inverter's output.Once I switched to one of these relays:The gap and time between the two switch positions has become large enough that I never had a problem again. In use for a decade. In fact, the larger amount of time even allows for your second AC source to be out of phase with the primary power source without a destructive impact, yet still be plenty fast enough not to trigger any problems with my PC servers or house appliances as they might only see ~ a missing single phase.As for the switching the 12v relay coil, I used an AC optocoupler to monitor my AC mains tied to a PIC microcontroller. For the MCU code If it saw a break in the AC mains 60Hz, it would transfer to the inverter immediately before any of my AC powered equipment would die. To switch back, it would wait for a clean 30 seconds of power from my utility, then, I had the option to wait until the 60Hz phase would approximately match before turning off the relay. (Note that my 2kw inverter was always powered on, even when the battery was being charged on it's input terminals. My Gel type 12v batteries lost their bulk charge capabilities after around 5 years and had to be replaced, but this is most likely a quality issue with my home-made charger.)

author: gnif
author_rank: Unknown
timestamp: February 01, 2022, 04:46:33 am
content: I am not sure this applies to my situation as I have been putting up with these random RCD trips for quite some time now (12+ months) while switching utility power to the UPS via a MCU controlled SSR. The UPS has been modified to not charge my batteries as I use a solar/MPPT charger for that. I had simply wrongly assumed the APC phase sync/switch was junk as the HP UPS I was using before I upgraded I could hear would actually sync up with the mains phase before switching over, and it never caused a RCD to trip.The idea of the MCU and disconnect is so that I can run of solar/stored power until my battery array gets to a certain point and then restore mains power, so one cycle a day. If we do have an actual outage the UPS will function as normal.

author: gnif
author_rank: Unknown
timestamp: February 01, 2022, 05:15:00 am
content: Interestingly now the UPS doesn't go THUNK each time the power is reconnected, clearly the mains caps & transformers were being hammered by this clamping.Edit: Well it still does, but it's nowhere near as loud as it was.

author: BrianHG
author_rank: Super Contributor
timestamp: February 01, 2022, 06:32:19 am
content: Quote from: gnif on February 01, 2022, 05:15:00 amI used to have a 100watt incandescent lamp in-between the primary mains charger side after my charger re-connect relay. Sort of like a constant on soft-start resistor which would glow dim until that switch was enabled. This completely eliminated the random occurring connection 'THUNK' on my charging/switching system even I switched over to a 0v crossing solid-state relay. However, if you are manually completely disconnecting this part of your circuit, this may not be an option for your setup. IE: in my setup, when reconnecting power, there was a small pause where the light would glow dimply before the high current switch enabled.

author: gnif
author_rank: Unknown
timestamp: February 01, 2022, 06:51:15 am
content: Actually I do have this option, that's a really good idea as I would like to reduce the inrush current simply for longevity reasons.