This is only a preview of the May 2018 issue of Silicon Chip. You can view 35 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "800W (+) Uninterruptible Power Supply (UPS)":
Items relevant to "Multi-use Frequency Switch":
Items relevant to "LTspice Simulation: Analysing/Optimising Audio Circuits":
Articles in this series:
Items relevant to "USB Port Protector – just in case!":
Items relevant to "12V Battery Balancer":
Items relevant to "El Cheapo Modules 16: 35-4400MHz frequency generator":
Articles in this series:
Purchase a printed copy of this issue for $10.00. |
Introducing:
Part 1:
by Duraid Madina and Tim Blythman
Our all-new 800W
Uninterruptible
Power Supply
(+)
We’ll say it right up front: this will not be a cheap project to build. But
if you do build it, we believe you will end up with a UPS that is a better
performer than anything else on the market at even two or three times the
price. And even then (unlike most commercial units), the design is quite
flexible if you wish to expand its already exceptional capabilities. So if
you’re in the market for a UPS (and who isn’t, with the quality [?!] of mains
power these days?) you will go a long way to find better value than this.
28
Silicon Chip
Celebrating 30 Years
siliconchip.com.au
We
searched
high and
low for a
high quality,
low-cost case to
house the UPS but
proved the two terms
are mutually exclusive!
However, this case is ideal for
the job, being pre-drilled and
slotted for excellent ventilation.
I
f you aren’t familiar with the concept of an Uninterruptible Power Supply (UPS), it provides a back-up for
the mains supply to an important piece of equipment
(such as a corporate server or other mission-critical system), so that it won’t shut down during blackouts.
The typical use for a UPS is to give plenty of time – a
few minutes to perhaps an hour or so – to save work before it’s lost – or in large organisations, long enough for a
mains generator to be fired up and take over.
Some UPSes are designed to give hours, and occasionally days or even more, of power to enable an enterprise
to keep working as if the blackout didn’t exist. But these
are VERY expensive systems, relying on a large (and even
more expensive!) battery bank to keep them supplied.
A UPS is now standard equipment for computer systems
in commerce or industry but they are becoming more popular for home or small business.
Laptop computers don’t need a UPS as their internal
battery does the same job. But the printer or large monitor
connected to a laptop will obviously cease working during a blackout. Powered via a UPS, work can continue.
Disaster power
A UPS like the one we are describing could be used
in a lot more situations.
ifications
Features & spnsec
plug
For example, perhaps with a few modifications, it could power all your computers, your
modem and all your entertainment equipment in the event
that you experience a blackout for many hours.
It could keep some or most lights working, allowing an
orderly (and safe) exit from deep within otherwise-dark office blocks (sorry, you’ll have to use the stairs as the lifts
won’t be working!).
Or if you have a much longer blackout, it could perhaps
run your refrigerator for several days during a long power
outage which could occur after a bush fire, a big storm or a
flood. That would mean you would not lose any food due
to spoilage. And of course, it means that you can keep your
mobile phones and notebooks and tablets fully charged so
you can stay in contact with the outside world.
Just how long you could run a refrigerator would depend on the power rating of its compressor and the temperature setting. Or perhaps it could allow you to also run
a gas heater or oven which requires 230VAC at low power
to run the igniter and the control electronics.
So a UPS is an important accessory for a variety of reasons in both business and in the home.
But why would you want to build this one instead of
buying a commercial unit? Wouldn’t that be cheaper? Not
in this case.
• Power input: 10A mai
s
• Output socket: four switched GPO
800W
er:
pow
ut
• Continuous outp
• Peak output power: 1200W
• Battery capacity: 588Wh
• Inverter type: pure sinewave
, 4h <at> 135W, 5h <at> 110W
, 1h <at> 500W, 2h <at> 260W, 3h <at> 175W
• Approximate runtime: 35m <at> 800W
<40ms (two mains cycles)
• Response time after mains failure:
cycle)
g back to mains: ~20ms (one mains
• Power interruption when switchin
ustable)
• Brownout threshold: 200VAC (adj
AC (adjustable)
260V
d:
shol
thre
out
cut• Over-voltage
y 5 hours from flat
• Battery charging time: approximatel
• Quiescent current: 19W
battery
ing off inverter, battery charging, low
• Status indicators: mains good, runn
UPS software)
rce
ng interface (compatible with open-sou
• PC interface: USB serial monitori
s are nearly flat
erie
batt
n
kout; continuous tone sounded whe
• Audible alert: beeps during a blac
e
harg
battery cut-out with zero battery disc
• Protection: 10A mains fuse, lowe)
harg
disc
es (full
• Battery longevity: at least 1500 cycl
siliconchip.com.au
Celebrating 30 Years
LiFePO4 batteries
This UPS has high capacity, very safe LiFePO4
batteries which can be
deep discharged without damage – something
that can easily occur in
a long blackout. Plus
it uses an Arduino to
monitor and control it.
And while this UPS
is conservatively rated at 800W, it actually
employs a 24V DC to
240VAC true sinewave
inverter which is rated
to deliver 1200W or up
to 2400W surge (useful
to start motors or run a
microwave oven for a
short period).
May 2018 29
To a large degree, our 800W UPS is based on existing modules which
we connect together in an appropriate manner. The photos above
show two of the main components: at left is the pair of Drypower 12V,
23Ah batteries which we connected in series for 24V DC, while at
right is the Giandel pure sinewave inverter, which is used to power
equipment from the batteries when mains power goes down.
The conservative limitation to 800W is determined by
the batteries but you could possibly run at the full 1200W
continuous output of the inverter for short periods without any problems.
So let’s talk about the batteries. Most commercial UPSes
come with sealed lead-acid (SLA) batteries. The problem
with SLA batteries, apart from being very heavy and bulky,
is that they are easily damaged or even destroyed if you
allow them to discharge below 11V – and that can easily
occur in a typical UPS.
We speak from experience – and we’ve heard that our
experience is not uncommon.
We used to have a UPS on the SILICON CHIP office server,
because blackouts are fairly common in the northern beaches of Sydney (we’ve had quite a few in the last decade). But
the one we were using failed because its lead-acid battery
was deeply discharged by a long blackout over a weekend.
We replaced it but only a few months later, it went bad
again after yet another extended blackout so we just gave
up and removed it.
As it uses Lithium iron-phosphate batteries our new UPS
design is a lot more robust than that commercial unit so
it won’t fail in the same manner. They will survive hundreds, if not thousands of blackouts (perish the thought!).
Why did we use lithium iron-phosphate batteries instead
of lithium-ion or lithium-polymer? In a word: safety! They
are much less likely to catch fire!
While a fire is unlikely with a Lithium-ion or Lithiumpolymer battery, it isn’t unheard of – and the sudden failure of a battery of this size could be very dramatic. And
since this is a DIY project, we can’t rule out mistakes being made during construction.
So we wanted the safest possible option.
While some UPSes are able to guarantee no loss of power
at all during a blackout, most operate by feeding the incoming mains directly to the load, as long as the mains voltage
is OK, but then switching over to inverter operation if the
mains waveform goes bad or disappears entirely. Normally
this switching is done with a relay or relays and so there is a
very brief switch-over period where the load gets no power.
But most devices will not be affected by this. For example,
30
Silicon Chip
all desktop and server computers these days run from a
switchmode power supply, which rectifies the mains to
charge a large capacitor or capacitors to around 350V, which
then power the switching circuitry.
It takes some time for the filter capacitor bank to discharge to the point where the output voltages are affected.
So as long as the switch-over time is short, the supply and
thus computer will operate uninterrupted.
Similarly, a motor-driven appliance such as a refrigerator will have some inertia and the loss of mains for a fraction of a second will likely not affect its normal operation.
And most low-cost UPSes do not have a sinewave output
when running off the battery. They usually have a “modified square wave” or even a square wave output, since it’s
easier to produce and the switchmode supply in a computer
will run just fine off a square wave (or even high-voltage
DC, for that matter).
Our design uses a “proper” sinewave inverter so is usable with a much wider range of devices.
Want more grunt?
Now before we go on to discuss the design philosophy
behind this project, we should point out that many aspects
can be modified or greatly expanded to suit your particular application.
Want higher power output or much longer run for more
extended blackouts? No problem, just substitute a bigger
inverter and a bigger (much bigger) battery bank.
Want to operate from solar panels to use it for off-grid
power? Again, no problem (we will discuss these various
possibilities in a later article).
12V or 24V operation?
Our initial design brief for this project was to have a
rated output of at least 500W. So what would be the right
battery voltage?
To deliver 500W, a 12V inverter would require an input
current of over 40A, which would be harsh on the battery
and inverter and require very thick cables. So we started
looking for inverters and batteries in the range of 24-48V.
It quickly became apparent that 24V batteries and in-
Celebrating 30 Years
siliconchip.com.au
These three photos show some of the other modules we used – while not so fundamental as those
shown opposite, they’re important nevertheless! At left is the Victron Battery Balancer, required because
we used (for economy reasons) two 12V DC batteries instead of a single 24V DC. Even when adding in the cost of the
balancer, two batteries are a much better proposition. Centre is the 12V switchmode power supply used to power the
Arduino, while at right is the 24V, 5A mains charger for the batteries.
verters were less common and more expensive than 12V
types, and 36V/48V batteries and inverters even more so.
Two 12V batteries (24V) seemed like the best compromise.
We decided to use two Drypower 23Ah 12.8V LiFePO4
batteries in series, which were supplied by Master Instruments (Cat No IFM12-230E2). We considered using a 25.6V
LiFePO4 battery but a similar capacity model cost significantly more than twice as much as the two 12V batteries.
Using two batteries meant that we would need a charge
balancer, to ensure that the two battery voltages are kept
similar – but even when we include the cost of the balancer, the two 12V batteries are still significantly cheaper.
This battery bank then drives a Giandel 24V/1.2kW
pure sinewave inverter which we bought from the Giandel Australia website for $138 plus postage (Cat No PS1200DAR/24). This is excellent value.
It comes with a pair of battery cables with eyelet lugs
and also a remote control that attaches to the unit using
telephone-style flat cabling. We hooked this up to an Arduino, which is then able to monitor the inverter status
and switch it on and off.
This inverter has a typical efficiency figure of around
90% and it includes a cooling fan and substantial heatsinks so it can deal with the approximately 100W of dissipation at full power.
As already noted, the inverter is rated at 1.2kW (2.4kW
peak) but the specified batteries can’t supply sufficient
current to allow such a high power delivery. They are rated at 35A continuous which works out to around 800W
at the output when you take inverter losses into account.
That’s still handily above the target we had set ourselves
for this project.
The 588Wh nominal capacity of the battery bank is specified at a 5-hour discharge rate, which is what our specification of five hours battery life for a 110W load is based on.
Curves are not provided to show how capacity diminishes
at higher discharge rates but lithium-chemistry batteries
normally have a low internal impedance so we believe our
moderate de-rating of capacity with increasing load should
be approximately right.
We also considered designing a “line interactive” or “onsiliconchip.com.au
line” UPS, where the load is always powered by the inverter and the charger provides the DC current to operate
it when mains is available. This avoids the need to switch
the load between mains and the inverter and also, poor
mains power quality (ie, distorted waveform) is not transferred through to the load.
However, that approach would require a charger capable
of around 30A which would be large and quite expensive
and it would also be less efficient due to the constant conversion from 230VAC to low-voltage, high-current DC and
back to 230VAC. Hence, we decided to design a “standby
UPS” instead, as presented here.
By the way, the inverter output is specified as 240VAC;
somewhat higher than 230VAC. So when the UPS switches
the load to the inverter, the supply voltage will typically
increase slightly.
But this is still well within the Australian mains specification of 230VAC+10%,-6% so it should not present any
problems. In many parts of Australia, the mains supply is
typically above 240VAC anyway.
Charging and mains switching
Having decided on the two most important components
of our UPS system, ie, the batteries and inverter, there were
still other important details to be determined. These included how the batteries are charged once mains returns
after the inverter has been operating (and indeed, are kept
charged long-term), how we determine when to switch the
output sockets from mains to the inverter output and how
that switching is performed.
Charging is quite simple; we purchased a 5A mains
charger designed for LiFePO4 batteries and it’s permanently
wired to the incoming mains socket so that whenever mains
is present, it’s charging the batteries. Like other Lithiumbased rechargeable batteries, LiFePO4 use a constant-current/constant-voltage (CC/CV) charging scheme.
So the charger will deliver 5A to the batteries until the
voltage across them reaches 29.2V (14.6V per battery or
3.65V per cell). It will then hold the terminal voltage at
29.2V as the charge current decreases until it reaches a low
level, at which point the batteries are considered charged.
Celebrating 30 Years
May 2018 31
Fig.1: block diagram of the SILICON CHIP
800W UPS. Much of the “magic” is in
the Arduino software and shield which
will be described in detail next month,
along with full circuit and construction details.
However, the inverter needs to be kept on constantly so
that it’s always ready to take over, should the mains supply cut out. Therefore, it draws several watts from the batteries constantly and the battery voltage will never quite
reach 29.2V (it sits at around 29.15V). This should not pose
a problem; they are effectively float charged.
Enter the Arduino controller
We’re using an Arduino Uno to monitor the mains voltage, via a small mains transformer. The primary of this
transformer is connected across the incoming mains supply
and the voltage from the secondary is divided down and
fed to one of the Arduino’s analog inputs via a biasing network which keeps the analog pin voltage in the 0-5V range.
The Arduino is constantly sampling the mains waveform and if it detects an under-voltage or over-voltage condition, or a significant deviation from a sinewave, it immediately switches the output over to the inverter. It only
switches the output back to mains when it determines that
the mains waveform and voltage are stable and have been
for a few seconds.
The switching is accomplished by using three DPDT relays which are controlled via a relay driver shield and the
Arduino. Both the Active and Neutral wires are switched.
Relay logic for safe switching
Now refer to Fig.1 which is the block diagram for our
high power UPS. It shows how the three relays are arranged.
RLY2 is the mains changeover relay and it is arranged so
that there is no possible way that the output of the inverter
could be connected to the mains. RLY1 is used to connect
mains to RLY2 (and on to the output) while RLY3 is used
to connect the inverter to RLY2 (and on to the output).
Why do we need three relays when it might seem that
only one or two relays might be able to switch the load
between incoming mains or the output from the inverter?
32
Silicon Chip
The reason for using three relays in this manner is that
there is no way to precisely lock the phase of the inverter
output waveform to the incoming mains waveform.
While both are nominally at 50Hz, they could be in phase,
180° out of phase or anywhere in between. The phase difference between them is likely to slowly drift over time,
due to slight differences in the two frequencies.
So it’s entirely possible that the momentary mains voltage could be +350V while the momentary inverter output
voltage could be -350V. A single 250VAC-rated relay is not
designed to handle 700V DC between two terminals on the
same pole. There could be an insulation breakdown and/
or major contact arcing and this could destroy the inverter.
By having an extra relay between each AC source and
ensuring that both RLY1 and RLY3 are off at the time when
RLY2 is switching, we avoid applying any more than the
normal mains peak voltage across a single relay.
When the unit is powered off, all the relays are off and
so the output sockets are not connected to anything, except
for the Earth pins, which are connected to mains Earth and
also the unit’s chassis.
When the unit powers on, it checks the mains voltage and
waveform and assuming they are good, it switches RLY1
on. This connects mains to the output sockets and load(s).
If mains goes bad or disappears altogether, the unit immediately switches RLY1 off. Then, after a short delay, it
switches RLY2 and RLY3 on. So the load is briefly disconnected from mains altogether (for around 10ms), then
connected to the output of the inverter, which is already
running.
When mains power comes good again, RLY3 is switched
off and after a brief delay, RLY2 is switched off and RLY1
switched on. Again, there is a brief period where the outputs are not connected to either mains or the inverter. This
ensures a safe change-over.
The unit is also designed to perform a sequenced change-
Celebrating 30 Years
siliconchip.com.au
over in this manner should its own power supply fail or
when it is purposefully switched off, using a switch mounted on the rear panel. This allows you to, for example, disconnect the UPS from mains so you can move it to a different location without it discharging its batteries.
Indicator LEDs
We’ve fitted three indicator LEDs on the front panel, so
you can tell what is happening. The green LED at far left
is on continuously while the output is connected to mains
and flashes if mains is not present or not clean.
The yellow LED in the middle lights continuously when
the output is being fed from the inverter. While the output is running off mains (and the green LED is solidly lit),
the yellow LED will also flash to indicate that if there is a
problem with the inverter, such as if the Arduino detects
it is not running when it should be.
The red LED at right starts flashing when the battery
voltage drops. The flashes become faster as the batteries
discharge until it is on continuously when the remaining
charge is around 10%.
The unit is also fitted with a piezo buzzer which beeps
intermittently while the output is running off the inverter and it changes to a continuous tone when the batteries
are nearly flat.
If the battery voltage drops below about 21V, the Arduino switches the inverter and relays off. It also shuts itself
down. The drain on the battery becomes almost zero. While
these batteries do incorporate their own over-discharge
protection, we feel it’s still good practice to minimise the
load at low voltages.
The unit is able to “bootstrap” itself and power back up
when mains returns and this procedure is described below.
It can also be manually switched off and powered back on
later if necessary.
Powering itself
We need a source of 12V DC to run the three relays and
Parts list – 800W Uninterruptible Power Supply (UPS)
1 vented 3U rack-mount case, 559mm deep [Bud Industries
RM-14222+TBC-14253+TBC-14263]
[Digi-Key 377-1392-ND; 377-1396-ND; 377-1397-ND]
2 Drypower IFM12-230E2 12.8V 23Ah Lithium Iron
Phosphate batteries [Master Instruments]
1 Victron Energy 2x12V Battery Balancer [Master
Instruments – www.master-instruments.com.au]
1 Giandel PS-1200DAR/24V Pure Sinewave Inverter with
cables [www.giandel.com.au]
1 5-7A LiFePO4 charger [Master Instruments, AliExpress]
1 DETA 6224B Silver Four Outlet Power Point or similar
[Bunnings 4430423]
3 12V DC coil, 10A 240VAC cradle relays [Jaycar SY4065]
3 DPDT chassis-mount relay cradles [Jaycar SY4064]
1 12V 1.3A enclosed switchmode power supply
[Jaycar MP3296]
1 12.6V CT 7VA transformer [Jaycar MM2013]
4 screw-on equipment feet [Jaycar HP0832]
1 3AG safety fuseholder [Jaycar SZ2025]
1 3AG 10A 250VAC fuse
1 connector to suit battery charger (see text)
1 Arduino Uno or compatible
1 Freetronics 8-Channel Relay Driver Shield
[Core Electronics Cat CE04549]
1 Arduino control shield (details next month)
1 green chassis-mount LED with chrome bezel
[Altronics Z0265, Jaycar SL2645]
1 yellow chassis-mount LED with chrome bezel
[Altronics Z0224] with 1kW series resistor
1 red chassis-mount LED with chrome bezel
[Altronics Z0264, Jaycar SL2644]
3 1kΩ 0.25W resistors
1 NO momentary pushbutton switch
Fasteners
8 M5 x 90-100mm bolts or machine screws
12 M5 x 10mm machine screws
28 M5 nuts
6 M4 x 10mm machine screws
6 M4 nuts
6 M4 shakeproof washers
siliconchip.com.au
4 M3 x 32mm machine screws
6 M3 x 15mm machine screws
28 M3 x 10mm machine screws
1 M3 x 6mm machine screw
34 M3 flat washers
34 M3 nuts
4 25mm-long 3mm ID untapped spacers
8 15mm-long 3mm tapped Nylon spacers
4 M3 x 25mm Nylon machine screws
Cables, wires and insulation
1 2-wire mains cable with figure-8 plug*
2 3-wire mains cables with moulded 10A plugs*
1 100mm length of 40A+ rated wire
1 2m length red medium duty hookup wire
1 2m length black medium duty hookup wire
1 2m length yellow medium duty hookup wire
1 1m length white light duty hookup wire
1 1m length yellow light duty hookup wire
1 1m length red light duty hookup wire
1 1m length black light duty hookup wire
1 cable gland to suit 3-wire mains cable
[eg, Jaycar HP0732]
1 150mm length 6mm diameter heatshrink tubing
1 50mm length 10mm diameter heatshrink tubing
1 50mm length 16mm diameter heatshrink tubing
1 50mm length 20mm diameter heatshrink tubing
* Can be cut from spare power cables, extension cords or
similar
Other hardware
2 Carinya MABF2101 Make-a-Bracket flat plates, 100 x 200
x 1mm [Bunnings 3975858]
6 Carinya MA0003 25 x 25 x 40 x 1mm angle brackets
[Bunnings 3975955]
5 adhesive wire clamps
6 small P-clamps
10 4mm crimp eyelets
2 red 6.3mm insulated crimp spade lugs (for the power
switch)
30 small black cable ties
Celebrating 30 Years
May 2018 33
5V DC for the Arduino. While we could simply run both
off one of the batteries, this would not be ideal as it would
present an unbalanced load to the overall battery pack. It
would also place a load on the batteries when they are
nearly flat.
To avoid this problem, we have fitted a small mains
switchmode power supply inside the case and wired this
in parallel with the output sockets. So when mains power is
present, this powers the Arduino and relays and when running off the inverter, the inverter powers this switchmode
converter instead. When the output is switched off, this
totally disconnects the Arduino and relay power supply.
So during a short blackout, the Arduino will be powered
by the inverter and will simply switch back to mains power
once it’s restored. But if there’s a long blackout and it powers down, when mains power comes back, the output is
disconnected. So how does it start back up and switch on
the inverter (in case it’s needed later) and RLY1?
The answer is that we’ve added a small relay on the Arduino shield which normally connects the secondary of
the mains-sensing transformer to a diode. Current flows
through that diode and into the 12V supply bypass capacitors, providing an initial source of power for the module.
(Note that this fourth relay is not shown in the diagram of
Fig.1 but it is on the control shield).
Once RLY1 is on, that relay is also energised, disconnecting the transformer from the diode. This means that
the transformer is not being loaded, so its output is once
again a good proxy for the mains voltage.
In fact, this relay is briefly energised before RLY1, giving
the Arduino the chance to verify that the mains waveform
is clean before the load is connected. The inverter can not
necessarily be used at this stage because the batteries are
probably flat. But they will start charging as soon as mains
returns and will soon be ready for use.
Switching it on without a mains source
We have considered that this unit may also be useful as
a source of emergency power. For example, you could use
it to back up the power to your fridge so that the contents
don’t go off during a blackout but you might later decide
to unplug your fridge and move it to power some other
equipment such as lights, a TV and so on.
In this case, during an extended blackout, you may need
to switch the UPS off and then later switch it back on but
unless you have a generator, you won’t have a source of
230VAC to “bootstrap” it.
So we have added a momentary pushbutton switch to
the front panel which briefly connects the nominally 24V
battery bank to the input of a 12V regulator which then
feeds the Arduino and relays.
Holding this button for a few seconds gives the unit
enough time to switch the inverter on and power the load
from the inverter. You can then release the button and the
unit will continue to run until it is switched off or the battery goes flat.
We’ve also fitted a rocker switch on the rear panel which
allows you to shut down the internal switchmode supply
that powers the Arduino and relays. This means you can
unplug the UPS from the mains, flick the switch and it will
gracefully shut down.
The batteries will remain charged and it can be powered
back on later by flicking the switch again and plugging it
34
Silicon Chip
back into mains, or alternatively, using the pushbutton
method described above.
Inverter control
The inverter has a “soft start” feature which ramps its
output voltage up over a few seconds when it’s switched on.
This would be handy in many situations but is unwanted
in a UPS because you need to be able to switch over to inverter power in a very short time. But there’s also a delay
of around 0.5-1 second between pressing the on/off button
and the inverter powering up, so clearly we have no choice
but to run it constantly, ready to switch over.
We do need to ensure it’s shut down when the batteries
go flat. While it has an internal under-voltage lockout that’s
actually very close to the minimum specified voltage for
these batteries (20V total, 10V per battery), it isn’t that accurate. We should ideally switch the inverter off before the
battery voltage drops that low. And we also need to ensure
it’s switched on when the unit is starting up.
The inverter we’ve specified is supplied with a small “remote control” box that has a single LED and a pushbutton
switch. It’s attached to the inverter via a 4-wire telephone
style flat cable. The same controls (LED and button) are
provided on the inverter itself.
The LED and button share one common connection, with
the LED wired between the common terminal and a second wire. A small current flows through this loop when
the inverter is powered. The button briefly connects this
common wire to a third wire. If the button is held down for
around half a second, the inverter starts up or shuts down.
We’ve interfaced the inverter with the Arduino using
two optocouplers. The Arduino drives one to simulate a
button press, shorting the two wires to switch power. The
second optocoupler LED is connected in place of the LED
on the remote control box and pulls an Arduino pin low
when the inverter is operating.
A software routine on the Arduino compares the inverter
status to the desired status and “presses” the button when
necessary to turn it on or off.
This isolation allows the Arduino ground to be connected to the battery negative terminal and it can then monitor the battery voltage using a simple resistive divider
(100Ω/10kΩ) to one of its analog pins, allowing it to determine the charge state, both for display purposes and to
decide when to shut the inverter down.
Choosing a case
Commercial UPSes of this size are often housed in rackmounting cases. This is convenient since they can then
mounted in a server rack, along with the servers they are
protecting. But rack-mount cases can also be fitted with
feet and used in a standalone manner.
We spent some time trying to find a low-cost metal box
to build the UPS into but in the end, couldn’t find a good
solution. It was also difficult to find a rack-mount case
which would fit all the required hardware (due to the required depth of at least 450mm) but we eventually located
one at a reasonable price.
It’s three rack units tall (3RU = 133.5mm), the standard
19-inch width and made from aluminium by a US company
called Bud Industries. It is supplied as a kit which includes
the front, back, sides and hardware while the top, bottom,
rack rails and handles are available separately.
Celebrating 30 Years
siliconchip.com.au
The completed UPS (sans lid!)
showing the internal layout.
The two batteries are clamped
under the punched metal plates
at the right while the pure
sinewave inverter is on the
left. We’ll show the layout
and construction detail next
month. While you might
think the silver Deta
four-outlet power point
on the rear panel seems
like gilding the lily
somewhat, they’re only a
couple of dollars dearer
than a boring old white
one . . . and it really
looks the part, matching
the aluminium case!
We haven’t bothered fitting the rack rails or handles to our
prototype but they aren’t expensive or difficult to obtain.
Luckily, availability is good; the case is available from
US electronics retailers Digi-Key and Mouser and they
both offer free express international delivery if you order
the required items together (see parts list). We also fitted
it with instrument feet from Jaycar as there are quite a few
exposed screw heads on the underside.
We’ve opted for a solid base and vented lid as the inverter and batteries can get quite warm during operation. The
side panels have many drilled holes which provides decent
ventilation and also makes fitting cable clamps quite easy.
One of the good aspects of using a natural aluminium
case such as this one is that it’s quite easy to Earth the entire chassis. This is critical for safety; if a mains wire comes
loose inside and contacts the case, it will cause the fuse to
blow. Otherwise, the case could become live which would
be very dangerous.
We have Earthed the rear and bottom panels separately,
with the other panels electrically connected via common
screws and also direct panel contact.
Sourcing a battery charger
Master Instruments can supply two suitable battery chargers, the Fuyuan FY2902000 (2A) or FY2907000 (7A). The
2A version has a standard 2.1mm inner diameter DC plug
so you just need a matching socket while the 7A version
uses an XLR plug; suitable sockets are readily available
(eg, from Jaycar).
Other chargers are available but they may come with
a different plug and so you will need to find a matching
socket. Or alternatively, cut the plug off and crimp some
eyelet terminals onto the bare wires for direct connection
to the battery terminals.
Regardless of which charger you use, it must be designed
specifically for LiFePO4 batteries and have a charge termination voltage of 29.2V. While these batteries are quite
robust, they may not last very long if regularly charged to
the wrong voltage.
Control algorithm
The most critical part of the Arduino software is the
“mains-good” detection algorithm. The transformer secondary voltage, which is a proxy for the mains voltage, is
siliconchip.com.au
sampled 1000 times per second, ie, 20 times per cycle for
a 50Hz supply. These samples go into a 32-sample buffer,
so there is just over one full cycle worth in the buffer at
all times.
To convert this into a meaningful number, we calculate
both a root-mean-squared (RMS) average and measure the
peak-to-peak voltage.
For a sinusoidal signal, the RMS value is exactly equal to
the peak-to-peak value divided by 2 x √2, or approximately
2.8284. The peak-to-peak calculation is usually quicker to
pick up excessively high mains voltage while the RMS calculation is faster at detecting a brownout or blackout, the
latter often being detected within a quarter of a cycle (5ms).
The RMS calculation starts by taking the average of the
ADC readings to establish a ‘mean’ that we can reference
the values to. We then add the squares of the differences
between our values and the mean.
Then we divide the sum by the number of samples –
this is our mean of squares, and its square root is the RMS
value, after which the scaling factor is applied to get our
actual RMS value in volts.
As soon as the mains voltage reading is found to be outof-bounds, the relay switching sequence begins, to transfer
the load(s) over to the inverter. The unit will not switch
the load back to mains operation unless the mains voltage
stays within a tighter set of bounds for several seconds.
This increase in the strictness acts as a kind of hysteresis, preventing the unit from switching back and forth if
the mains voltage is on the cusp of being too high or too
low. The unit will simply switch to the inverter in this case
and won’t switch back until the mains voltage goes back
to a more normal value.
The transformer introduces quite a bit of error into the
voltage measurements made by the Arduino (and to a lesser
extent, resistor and regulator tolerances). We will provide a
calibration process to allow you to set the thresholds more
accurately in a later article.
Construction
There will be detailed construction and wiring details
in the second article in this series, to be published in the
June issue. That article will also have details on the control
shield circuitry, including assembly instructions required
to build the driver shield.
SC
Celebrating 30 Years
May 2018 35
|