APC Back-UPS Battery Run Time Mod

I got an APC Back-UPS 1400 to protect my hardware from power surges and outages. With my notebook and PC plus two monitors, network switch, PCengines router and ISP router connected, it ran about 40 minutes until the battery was empty.

By far the most “power outages” last less than two seconds and merely elicit an angry growl from the UPS before it returns to its usual, quiet 50Hz hum. However, every now and then, a transformer goes boom, and it usually takes the electricity guys about 1-2 hours to fix it. Which was too long for my UPS to bear.

So I figured I should replace its original batteries. According to APC, the model I bought does not have user-replaceable batteries. They even have this somewhat useless video on YouTube, showing how you can not replace the battery.

The Hard(-ware) Part

Well, as it turns out, you can in fact replace the battery if you are fearless and know how to use a screwdriver.

APC Back-UPS 1400 insides

The UPS contains two 12V, 7Ah lead acid batteries, standard BP7-12, which are connected in series. Unfortunately, there is no replacement battery with significantly more capacity with these dimensions, so I cut them out, drilled a hole in the case of the UPS and led the cables to the outside.

I ordered two 35Ah, 12V deep cycle lead batteries as replacement, as well as some cable and lugs to fit the M6 battery screws. I build a nice battery pack out of the paper boxes in which the batteries were shipped, and connected everything together.

New batteries connected in series in the back, original battery pack in the front
My cat เสือ (Tiger) warming his ass on the UPS, next to the finished battery pack

The Soft(-ware) Part

Now, this “Back UPS” series of APC is the dumb, cheap kind of UPS. You can’t just tell it that it now has a bigger battery. In fact they have a different series called “Smart UPS” where you can do that. Apparently they didn’t want to call this one “Dumb UPS” though.

Anyway, it has a USB interface via which it reports some status information, including the battery voltage, the estimated battery charge and the estimated remaining run time, which you can read out using apcupsd (which I run on my router, which runs pfSense):

APC      : 001,037,0959
DATE     : 2019-10-05 07:54:55 +0700  
HOSTNAME : ********
VERSION  : 3.14.14 (31 May 2016) freebsd
UPSNAME  : greenhouse-ups1
CABLE    : USB Cable
UPSMODE  : Stand Alone
STARTTIME: 2019-10-04 12:08:32 +0700  
MODEL    : Back-UPS XS 1400U  
LINEV    : 232.0 Volts
LOADPCT  : 31.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 18.1 Minutes
MBATTCHG : 1 Percent
MINTIMEL : 1 Minutes
MAXTIME  : 0 Seconds
SENSE    : Medium
LOTRANS  : 155.0 Volts
HITRANS  : 280.0 Volts
ALARMDEL : 30 Seconds
BATTV    : 27.2 Volts
LASTXFER : Unacceptable line voltage changes
XONBATT  : 2019-10-04 17:21:49 +0700  
TONBATT  : 0 Seconds
CUMONBATT: 4 Seconds
XOFFBATT : 2019-10-04 17:21:51 +0700  
STATFLAG : 0x05000008
SERIALNO : 3B1803X11330  
BATTDATE : 2018-01-18
NOMINV   : 230 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 700 Watts
END APC  : 2019-10-05 07:55:00 +0700  

As you can see here, at a load of about 30% (I ran some stress test on my PC to achieve this relatively high load), it reports a remaining run time of 18 minutes – which would possibly be somewhat accurate with the original batteries.

As it turns out, the battery charge is not calculated from the actual battery voltage. When I disconnected the power, the UPS reported a linearly decreasing battery charge and remaining run time, hitting zero after about 40 minutes (I did this with normal work load which is around 15%) – while the batteries happily still delivered 24.8 Volts (and would continue to do so for another two hours or so).

Ideally, I’d want apcupsd to shut down my hardware when the UPS reports an accurate remaining charge of, say, 30% (even though they are “deep cycle” batteries, they do not actually like being drained completely – it reduces their life span).

I found multiple sources claiming that you could calibrate the UPS by draining the battery completely with a load of between 30 and 34%. I tried that to no avail – the UPS still reports a remaining run time as if it had its original battery. Unfortunately, recharging the large battery takes approximately 40 hours because the charge current is dimensioned for the original battery, so I did not do any further tests up to now.

Instead, I set apcupsd’s BATTERYLEVEL = -1 and MINUTES = -1 and set TIMEOUT = 9000, so that the hardware would shut off after 9000 seconds (=2.5 hours) regardless of the battery charge reported by the UPS. (Ironically, pfSense’s apcupsd package wouldn’t allow setting those values to -1 due to a validation bug, so I fixed that first).

So, now hopefully I’m ready for all the power outages to come.