DIY automatic transfer switch
project , published by Maarten Tromp, last updated , 1778 words
My friend Herman was looking for an automated transfer switch (ATS) so his PC and modem do not lose power when the circuit breaker trips. An automatic transfer switch will immediately connect your devices to a different power circuit when this happens. Instead of buying a cheap one of dubious quality or spending a lot of money on a professional unit, let's see what we can DIY.
This article featured on Hackaday.
In this article:
What an automatic transfer switch does is quite simple. When power to the primary power input fails, it switches the load over to the backup power input.
Since both power inputs might be connected to entirely different electrical systems or mains phases, you need galvanic isolation between both input circuits. It is important to disconnect one power input before connecting the other. This also makes it impossible to back-feed the interrupted power circuit, which is never a good idea.
This ATS will be used for a couple of computers and connected devices, so it should be able to handle a current of at least a couple of amps.
As last but not least the KISS principle. The simpler the better, complexity is the enemy of security.
There are also many things this ATS will not be, such as power distribution unit (PDU), power filter, power monitoring device or generator switch. Those features will be left to professional models (for now).
The electronics are as minimal as it gets. The entire automatic transfer switch consists of a single electronic part; a relay. Choosing the right relay is not trivial though.
The relay needs to switch mains voltage and a couple of amps, preferably with a bit of headroom. In this case that's 230 V, 50 Hz and around 5 A. The relay itself will be powered by the same voltage.
To get full galvanic isolation between both input circuits you need to switch both live (L) and neutral (N) wires, so the relay should be a 2 pole changeover (CO), also known as double pole double throw (DPDT) type. The mains ground connections should be connected at all times.
Most power relays have considerably higher current handling on the normally open (NO) contacts than on the normally closed (NC) ones, sometimes up to an order of magnitude. For an automatic transfer switch you obviously need both NO and NC contacts to handle the needed high(ish) current.
While you could use 2 separate relays that can handle high-enough current on the NO contacts and combine those into a single CO relay, this soon becomes tricky. First you need to activate the backup power relay when primary power is lost. So you would need a third relay to detect this and operate the backup power relay with backup power, but now you have 3 relays to deal with. And second, you need to make sure that both power relays are under no circumstance activated at the same time. Relays typically have faster operate time than release time, and now you have to get timings right across multiple relays. You might need to use some form of delay to make it all work properly, adding even more complexity. Failing to do this correctly will lead to either back-feeding the interrupted input circuit or tripping residual current devices (RCD) upstream and certainly leave all your critical devices without power.
The only relay I could find that does all this, is available and affordable is the Finder 184.108.40.206.0000. It can switch 250 V, 30 A (NO) / 10 A (NC), operates at 230 V, and costs 10 – 20 Euro.
The automatic transfer switch should not become the weakest link in the (power) chain, so I prefer a robust mechanical design as well.
Using C13 / C14 sockets (a.k.a. computer power sockets), or C19 / C20 sockets would be nice and would make the switch more compact. A lot of professional equipment use these sockets too, but in my experience plugs sometimes drop out of these sockets all too easily. Blue CEE 2P+E sockets are more robust and secure, but take up a lot of space and seem overkill for a home situation. Schuco sockets are also quite big and only come in female. My personal favourite is Neutrik Powercon, which is commonly used in professional audio, but is quite unknown in IT. So the best I could come up with is normal schuko male and female plugs.
The plugs are Kopp outdoor models. They're splash-proof and mostly dustproof (IP44) and quite sturdy. The plugs can handle 16 A. I removed the splash cap and child-proof thingie from the female plug, so it's easier to use. It will always be plugged in anyway.
Power cabling is made from neoprene rubber. This is tough material and water and heat resistant. With 3x1.5 mm² (16 AWG) it can also handle 16 A.
The enclosure is a Kopp waterproof and dustproof (IP66) outdoor junction box. It is made from tough polypropylene (PP) plastic and comes with 3 good quality fittings.
Wiring to the relay is done with isolated Faston 250 crimp connectors.
All mains earth wires are kept longer than the other wiring, so if somehow a cable is pulled out of the fitting, the earth wire is last to disconnect. All earth wires are connected with a splicing connector.
Mounting the relay in the enclosure turned out to be harder than I had expected. While PP is a nice material for an enclosure, it's not easy to glue. Since I didn't have proper solvents or primer at hand, I considered friction welding, but ended up using mechanical fastening (i.e. nuts and bolts).
Testing the ATS is straight forward. After measuring conductivity to make sure everything is wired up correctly it's time to power it up. I used a few lamps as load and started plugging and unplugging both inputs of the ATS. Except for a slight click of the relay you don't notice it switching over at all. There is not as much as a flicker on any of the lights. According to the datasheet the relay takes 8 ms to operate and 15 ms to release, but since my oscilloscope is currently in storage I can't confirm this. All I can say is the unit seems fast enough to switch your PC over without noticing.
The design, minimal though it is, is released into the public domain as open source hardware. Datasheets can be found in the downloads directory of this article.
So how does this automatic transfer switch compare to the cheap one and the professional one mentioned earlier?
The cheap no-name switch and the self-built one both cost around 50 Euro. The self-made one can handle 10 A while the no-name one can handle an order of magnitude more. However, the self-made one is made from good quality brand-name parts and well constructed, while I cannot vouch for the no-name one. Sometimes many corners are cut in order to keep the price as low as possible, not meeting specifications and compromising safety. I'd rather not have one of those devices connected to mains anywhere near me or any of my equipment. But YMMV, the no-name switch might work just fine for your application.
Compared to the professional switch the self-made one only wins on price. Both can handle 10 A, but the professional one has all the bells and whistles and safeties you'd expect in a professional environment. It is most likely better designed and built than the self-made one, and that's why it comes with a professional price tag.
However, for this specific application the self-built automatic transfer switch works just fine. It gets the job done with a minimum of fuss, at an affordable price point. Now that it's finished, I packed it up and shipped it as a gift to Herman, where I'm sure it will be put to good use. Next I'll be building one for myself as well.
Today Herman received the automatic transfer switch and is currently
playing with it.
His setup is as follows. If wall power fails, the inline UPS takes over, but what if the UPS fails? Herman told me he had more down time caused by UPS failure than by power outages. With the addition of the automatic transfer switch, the UPS will be bypassed and the load will be transferred to direct wall power in case the UPS cuts out. Thus creating a redundant power setup on a single circuit with a single UPS.
A few weeks after publishing this article, Stephen Paine contacted me, explaining that he read about the ATS and would like to make one himself. A couple of days later he let me know he completed the project and included a couple of photos. Most parts came from his parts bin, only the relay had to be ordered. In addition to the labelling, both power cords have different coloured plugs to easily tell them apart. As lid to the box he used a wall socket, which makes the build nice and compact. Both power inputs have status leds, so you can see what's happening (not shown on photo).
Stephen explained that South Africa is currently having power outages (called Load Shedding) for a total of 10 hours per day. This means that three times a day or night there are planned outages of 2 or 4 hours each. He requires a medical device at night, which needs mains power to run. At home he has a 1.2 kWh battery and inverter for powering the device, but when travelling this can present a problem. While he as a portable battery pack and charger, it does not offer full UPS functionality and does not have enough capacity to power the device all night. Which is why he wanted an ATS.
He had bought a good make ATS but the transfer time was too long which meant that the device lost power and had to start up again, interrupting its function. Then he bought another ATS, but it was noisy and only switched in one direction. Not giving up, he decided to try my design and was surprised how well it worked. It switches fast enough that the device doesn't notice the changeover, finally solving the problem. All in all it's quite a story but he told it just to highlight how pleased he is to have this ATS. Last thing I heard he finished building another ATS, this time for his brother's self made UPS.
Stephen's story made quite an impression on me. I had built the ATS to address the first world problem of being annoyed by your computer losing power. But there's a whole world out there with more serious problems and I'm glad this DIY solution can be useful there as well.