The DIY (or, if you must, "Ghetto") UPS

Originally published 2001 in Atomic: Maximum Power Computing

Last modified 03-Dec-2011 .

You know what an uninterruptible power supply looks like, right? It's a heavy beige box with an IEC power socket on one end, one or more three-pin sockets on the other, a few lights and buttons.

Well, it can be.

Or it can look like this.

This contraption works in basically the same way as a normal "dual conversion" UPS. Next to the computer, there's a big fat DC power supply, with a battery sitting on top of it. That power supply's connected to the mains on one side and to the battery and an inverter (the box on the right), in parallel, on the other. The power supply charges the battery and runs the inverter, while mains power lasts.

The inverter converts the low voltage DC back to AC power, with an efficiency of more than 85% - 100 watts of DC in, about 90 watts of AC out. If the mains power fails, the inverter just runs from the battery, and the computer (and monitor) keep on trucking. For a bit more than an hour, with this undemanding desktop PC and small-ish battery.

Many off-the-shelf UPSes can only provide power for a few minutes - long enough to save your work and shut down. All but the cheapest models have a serial connection to the PC and software that lets the computer shut itself down if you're not there when the UPS is doing its thing, and battery power's getting low.

With a Franken-UPS like this one, though, you can have as much battery backup as you can fit in your computer room.

A dual conversion UPS like this runs the inverter all the time. Most UPSes don't do that. They're "standby power supplies" instead, in which the inverter only runs when mains power fails. The rest of the time, they just pass mains power through to the output, maybe with good filtering, maybe without. The standby design makes the UPS more efficient, and also allows cheap units to have lower quality inverters, because the inverter hardly ever has to do anything.

There are also "line interactive" UPSes, which run the inverter all the time, though not at anything like full capacity; they also pass mains power through, while it's available. When power fails, the already-running inverter just picks up the slack.

Dual conversion, or "on-line", UPSes provide the best power filtering of the three flavours of UPS, and have no "cut-over" delay if the mains fails. But for domestic purposes there's not much difference, besides price, between the three.

This do-it-yourself UPS may be dual conversion, but it's about as elegant as it looks. Most people wouldn't want it.

It does let you see what's inside a normal single-box UPS, though. All of the components in this setup are just stand-alone versions of the basic bits inside a regular UPS.

The battery

UPSes need lots of battery capacity, and don't have to be particularly light. So they use lead acid batteries.

Off-the-shelf UPSes - well, the ones that are small enough to carry, anyway - use "gel cells", which are the most common kind of Sealed Lead Acid (SLA) batteries. Usually, when someone refers to an SLA battery, they're talking about a gel cell.

These batteries are cheap, they don't leak, they're highly standardised and can be bought in any electronics store, and they've got reasonable performance for the money.

The jelly electrolyte in a gel cell, though, doesn't deal well with gas bubbles, which develop quickly if it's overcharged and slowly even if it's just kept constantly topped up. The bubbles mess up the electrolyte next to the battery plates, which reduces capacity.

Cheap SLA batteries are also definitely built down to a price. Your ordinary "seven amp-hour" 12 volt SLA brick may or may not be able to deliver as much power as you'd expect from that rating, even in the lower-current two-battery 24 volt configuration that a lot of UPSes use. Don't expect more than a couple of years of life out of bargain-priced SLA batteries in a cheap UPS.

For a ton of capacity and excellent high current performance, "wet" lead-acid batteries with ordinary liquid sulfuric acid electrolyte are the way to go. You don't want to knock them over, you don't want to carry them up stairs, you want to make sure there's enough ventilation that the hydrogen they produce while being charged doesn't make your computing life unexpectedly exciting, and yes, they need occasional topping up if you want them to last well. But even a small car battery will give you 25 genuine amp-hours for computer-powering purposes. Only your ability to transport heavy objects limits the capacity you can get from wet batteries in parallel.

Automotive batteries can be had cheaply, but they don't like being fully discharged. Neither do ordinary gel cells. Run any lead acid battery flat and leave it that way long enough and the plates will sulfate, rendering the battery useless.

More expensive "deep cycle" batteries are constructed to deal better with this; they don't have the massive instantaneous current capacity of a "cranking" battery if you want to start an engine, but you can run them through full cycles over and over without harm. They still shouldn't be left flat, though.

This battery isn't a normal wet cell, or a gel cell. It's a Lifeline GPL-1300 from Concorde Battery Corporation, who make batteries for everything from racing yachts to fighter planes. This one's a sealed, valve-regulated design with liquid electrolyte absorbed onto fibreglass mat between the tight-packed plates - a superior way of making an SLA battery. The glass-mat design gives it the performance of a wet battery, and the unspillability of a gel cell.

The GPL-1300 is Concorde's smallest battery - it weighs less than seven kilograms. But it's rated to start a two litre marine diesel, and has a genuine 13 amp hour capacity for UPS applications.

You're looking at around $AU250 for one of these, though. That'll buy you a much higher capacity plain wet battery.

The power supply

A UPS needs something to charge its battery, and run the inverter when the mains hasn't failed. Charging lead acid batteries via the "constant voltage" method is easy. Charging them well is somewhat less easy.

If you connect a lead acid battery to a power supply that's set to deliver the same voltage as the battery can hold when it's fully charged, you'll charge the battery, and you won't overcharge it. This is called a "float" charge; it's not the fastest way to get amp-hours into the battery, but you can leave the charger connected forever without toasting the battery.

Unfortunately, a float charge will never quite top off a battery. And if you leave a lead acid battery on float forever, it'll slowly sulfate, just as if it were left flat briefly. A "topping charge" of about 2.4 volts per cell (14.4 volts, for a 12 volt battery) is needed about every six months, for maximum battery life.

The charge circuitry in really classy commercial UPSes may do these periodic topping charges, but don't expect them from a cheap unit.

For the Lifeline battery I used, the float voltage is 13.2 to 13.4 volts, depending on temperature - higher temperature, lower voltage. I provided that by using my 25 amp variable-voltage bench supply, set to that voltage.

There's no way to do automatic topping charges with this thing, but there's nothing stopping you twisting the knob up to 14.4 volts for a few hours every six months. And this power supply's 25 amp continuous rating means it can deliver 300 watts at 12 volts. Given the 85 to 95% efficiency of current-model inverters, that means you can run at least a 255 watt resistive load (about which more in a moment...) from it.

A supply like this isn't cheap, though. This one's a Jaycar Electronics MP-3088, which lists for $AU359. Ordinary car battery chargers, from your local discount auto parts place, are a lot cheaper than that.

If you want 25 amp current capcity, though, you won't get it from just one cheapo charger. Instead, you'll have to take multiple, identical chargers and hook them up to your battery in parallel. This is about as elegant as making a 24-outlet powerboard out of double adaptors, but it'll work, provided your chargers don't try to do anything clever. Which cheap ones won't; some of them don't even have a fuse. It's important that the chargers be identical, though; cheap and nasty chargers that're meant to be exactly the same won't necessarily be. It's advisable to do some judicious multimeter probing, to see if the various positive terminals of a gimcrack parallel rig are all actually at the same potential when it's running.

Cheap chargers may or may not let the battery go flat through them, backwards, when the power goes down; the worst case scenario here is the destruction of the charger, though simple loss of battery charge is more likely. Bench supplies probably won't do this - mine certainly doesn't. Like most bench supplies, it has good reverse current and overcurrent protection.

If you've got a charger that has no reverse current prevention circuitry, though, then you'll need some sort of battery isolator - a fancy one meant for multi-battery vehicles, or just a big fat diode. Cheap chargers may not deal well with the voltage drop from a diode-based isolator; they'll have to deliver more volts to achieve the same charge current, and they may get funny ideas about the battery's state of charge.

The ratings on cheap chargers are generally pretty optimistic, but three "10 amp" chargers ought to be able to manage 25 amps continuously. Four certainly will, unless they're from a very seedy manufacturer.

If the battery voltage at full charge doesn't significantly exceed the float voltage, then you can leave your cheap chargers connected forever. If it's higher, then you'll slowly cook the battery; if it's lower, then you're going to have early sulfation problems.

But those chargers sure are cheap.

The inverter

This is a 300 volt-amp (VA) 12-to-240 volt inverter of slightly elderly design, with a not-so-great surge power rating - the amount of power it can deliver for a brief moment.

Watts may equal volts times amps, but only for DC circuits, or AC circuits running purely resistive loads, like heaters or incandescent lights. Computers and monitors aren't resistive loads. Technically speaking, they have a pretty nasty "power factor". A 300VA inverter can be expected to run only about 210 watts worth of PC gear; maybe even less. For more on this as it applies to computer UPSes, check out APC's PDF format white paper on the subject, here.

Just because a computer has a 300 watt PSU, though, doesn't mean it needs a 430VA inverter. It'll only need that if it fully loads every one of its PSU's output rails, which it almost definitely doesn't.

These days, you can get a 300VA inverter with a 900VA surge rating and better than 90% efficiency for about $AU160 - Jaycar have one, MI-5062, at that price. For less than twice the money, you can get a 600VA continuous, 1500VA surge inverter, which is enough to run pretty much any PC, and its monitor.

Surge rating matters, because many devices draw a lot more current on startup than they do when they're running. Laser printers and refrigerators, for instance, have such huge startup current demands that you need an apparently massively over-rated inverter if you want to run them. Computers aren't that bad, but CRT monitors can still be a problem.

The computer I powered from this rig is a humble Celeron box with a 15 inch monitor. The PC without monitor draws a peak current of about 8.5 amps from the battery, through the inverter, on startup. Then it settles to less than six amps.

The monitor's degauss circuit, though, draws more than the peak power capacity of the inverter.

Since practically all CRTs automatically degauss when they're powered up, that's a problem. Another 15 incher I tried just pegged the needle on my ammeter for a moment when turned on, and then sat there in standby mode.

Fortunately, the old Mitac monitor in the picture can still start up when it tries to degauss itself and fails. It just draws a nice steady eight amps, with no scary surge. So the PC with monitor has a peak draw of a bit less than the inverter's constant output capacity, and then settles down to about 70% of capacity.

Note: If you don't know how thick a wire to use to carry, say, 20 amps (to give a decent safety margin), that's a good sign that you're not quite ready for this project.

The solution to the monitor surge problem, of course, is either to use a more modern inverter with a big surge rating, or to use a lower power monitor, like an LCD screen. 15 inch LCDs (which have more screen area than a "15 inch" CRT) draw less than 40 watts and have no startup surge to speak of. So they're excellent candidates for "alternative power" applications.

Inverter waveforms

The "waveform" of an inverter is how the inverter's output voltage changes as it goes through its positive/negative alternating-current cycles. The rate of oscillation for all Australian 220/240 volt inverters should be the same 50 Hertz (cycles per second) as ordinary mains power in this country, but the voltage-versus-time graph of an inverter's output can be quite different from that of mains power.

If, for instance, the voltage rises practically instantly to full positive, holds there for half a cycle, then drops practically instantly to full negative for the other half-cycle, then you're looking at a "square wave".

Normal mains power alternates in a smooth sine wave - well, it does when it's not being polluted by spikes and sags and surges, anyway. This sinusoidal waveform, shown in green in this picture, is only accurately imitated by more expensive "sine wave" inverters. You can buy UPSes that have sine wave inverters - you're looking at maybe $AU900 for a 750VA line interactive one. You can buy sine wave inverters as separate items, too.

PCs don't need them, though. They'll work fine on modified square wave power - that's the red waveform in the picture. Inverters that output this waveform are cheaper than sine wave units.

Most AC motors - power tools, for instance - will run OK from modified square wave power as well, but they're likely to draw about 20% more power than you'd expect, and may buzz annoyingly. Things with circuitry that relies on clean sine wave power - electric clocks, bread makers, some battery chargers, the "shaded pole" motors used by ceiling fans - are likely to misbehave.

The blue waveform in the picture, by the way, is a plain square wave. It's pretty hard to find plain square wave inverters any more. Which is good, because you probably don't want one. They can run some, but not all, motors, and they're fine with incandescent lights. But even computer power supplies aren't guaranteed to work properly on this exceedingly "dirty" power.

Why do it yourself?

What's a separate-boxes do-it-yourself UPS rig good for, besides making you look all technical and competent?

Well, it lets you have monstrous battery capacity, if you like.

You can't swap higher capacity batteries into most off-the-shelf UPSes. That's not just because bigger batteries won't fit in the box; the standard charger circuitry is also unlikely to deal well with more capacity. If a charge takes longer than it should, or the charge current goes too high, the UPS is likely to assume there's something wrong with the battery.

Better commercial UPSes have a standard battery expansion connector; some cheap-ish units will deal OK with more battery capacity, but you have to solder your expansion cable to the appropriate terminals inside to make it happen. Don't bet on this being possible with J. Random UPS, though. And the more capacity you're adding, the less likely it is to work.

Oh, and if your cheapie UPS isn't expecting more battery capacity, it won't be expecting more run time either. So it may overheat and die, if forced to run at something near to full power for much longer than its standard battery could manage.

Use a dumb charger, like my DC power supply and a dedicated inverter of reasonable quality, and you won't have these limitations. You have to keep an eye on your battery, and you have to set your voltage carefully. But you can also use a bank of truck batteries to power your PC for a week without mains, if you like.

A separate-boxes UPS is also useful for more things than a one-box unit. The little sealed battery in this setup has more than enough poke to start my car, for instance, which is more than a 7Ah SLA brick can manage.

(I have used a small SLA battery to start a car, once, but only indirectly; I took the freshly charged SLA and hooked it up in parallel with the car's flat battery, and just left it there for half an hour to push a little charge into the thing. Then I unhooked the SLA, and started the car from the now slightly charged main battery.)

A bench power supply is also a generally useful thing. I use mine all the time when I'm building and testing things, or when I just feel like setting fire to a pencil.

And the inverter can be hooked up to a car battery anywhere to power various gadgets.

(Note - driving around the city with a passenger who's pointing a 240 volt disco strobe at unsuspecting pedestrians is neither condoned, nor encouraged, by the author. And even though it makes rain look really cool, please do not stand in the rain holding the strobe.)

If none of these advantages appeals to you, of course, then there's no reason for you to buy these separate components. They won't give you a top-class charging system (unless you shell out for a top-class battery charger, anyway), they don't interface with a computer in any way, and they're hardly a neat and tidy solution.

But if you're looking for an industrial-capacity UPS solution, and don't like the prices of the off-the-peg options, it might be easier than you think to roll your own.