Custom DC UPS, bypass AC-DC stage & Support Automatic safe shutdown

Yeah, it would depend on the inverter/ups.

I’ve had this setup for a few years with an APC Home UPS (850VA sine wave inverter).

What I’ve noticed is that it bulk charges at >14V for a while and then switches to float charging at 13.5V

The 10A being sent to the buck/boost converter doesn’t appear to affect the inverter’s charging in any way, I think the charger is voltage based, not current based.

Being current-based would add extra complexity and safety issues with the shunt being a point of failure/liability.

It’s also what I noticed with my Luminous 3.5kVA and Optimus 2300 inverters, the charger is voltage-based, it doesn’t detect current draw to switch charging modes.

@yugaaa would know more about this, I think I’m sure

1 Like

Assuming a router/AP+switch that is always on, how about using something like esp8266/esp32? It can be powered directly from UPS battery (12v to 5v dc-dc converter) and with a sense pin connected directly to mains power (can use hilink 230v to 5/3.3v). This will detect the power outage. All this can be done inside UPS casing as both battery+mains can be tapped inside.

Next, using INAxxx, monitor the battery voltage if needed or wait X minutes and trigger shutdown of devices via ssh.

Maybe better IC’s are available to better capture the battery fuel gauge, but that would make the setup complicated.

To bring them back up, if the NAS/server is connected to switch, send WoL packets via wifi (or w5500 spi lan module for more adventures).

Of course this will require some code to be written to esp but nothing too complicated for someone experienced.

Also wifi AP and a switch can be powered up for quite some time via UPS if other power hungry devices (like NAS, servers) are shut down well before the battery depletes. This means, no need for separate power backup for router/AP/switch.

I thought about this some time ago but never got time to research and try it.

1 Like

The esp8266/esp32 will work fine. But if we need some manual control, or send updates to phone like setting up a telegram bot. A RPi is a good choice.

But esp8266 is very low power that is an advantage.

—-

I guess all people are running their setup on home inverters. The battery voltage they would like to monitor will be of that one.

So they can time it and shutdown systems safely when battery is at 50%.

—-

Dedicated always on mini ups de-couples our router+rpi/esp8266 from home inverter.

And if we make it monitor our home inverter battery voltage.

We can program exactly when to shutdown our systems and bring them back on.

But is it worth it?

Or should we just run our RPi/esp32 on home inverter?

Ordered few parts today for DIY Lead Acid Battery based, always ON, DC Mini UPS, if the basics work fine, then I will try and implement smart features.

5 Likes

My use case is not based on home inverter for now.

Unless directly connected to battery, the response time is greater than 10ms where devices may reboot. So its a no.

My server(s) and router/APs are already on cheap 600w/1100va online UPS.

I would be shifting to bigger NAS server, Adding two mini pcs, 1 raspberry pi 5, ucg fiber, u7 pro, uap-ac-lr(for IoT) etc. so would be shifting to better online UPS but still within budget but with lifepo4 12ah battery.

For now I just want my nas and 2 mini pcs to shut down which rpi should be able to do.

The thing is I dont wanna blindly turn them on and off, specially HDD nas server. Only if needed.

I can just bite the bullet and get UPS that interacts well with NUT. I would still want router and wifi to be up for 2 hours at-least in case of outage with online UPS.

DIY stuff gets expensive real fast.

I have 2 small dc output ups for basic routers that are no longer in use.

I think I can definitely use it to power rpi zero 2w or even rpi 5.

I think main issue is detecting battery level accurately of main power backup. Looking forward for you poc.

When you mention main power backup, what exactly are you referring to in your setup?

Is it this?

And if so, are you looking for a reliable way to shut down the devices connected to this UPS when its battery is close to the end?

Yes this or any other online ups.

Not close to the end. Like 50% would do then only router/aps/rpi can continue to run till it dies completely. Then once main is back for few mins then turn servers on.

So as I read more about this. Turns out it is very very hard to estimate the state of charge % when lead acid battery is under load.

But it is very easy to rough estimate the state of charge under no load condition. These are resting voltages.

SOC (%) Voltage (V)
100% 12.70 – 12.80
90% 12.60
80% 12.50
70% 12.42
60% 12.32
50% 12.20
40% 12.10
30% 11.96
20% 11.81
10% 11.65
0% 11.50 – 11.60

We also have to wait a little if measurement is done right after charging, to let the voltage stabilize.


Measuring the correct state of charge under load is a completely different ball game and is very hard.

AI Summary

Under load, the battery voltage no longer represents state of charge. Instead, it becomes a function of several interacting variables:

  • Load current
  • Battery internal resistance (which increases with age)
  • Temperature
  • Battery chemistry and construction (flooded / AGM / GEL)
  • Recent charge or discharge history

Because of this, simply measuring battery voltage while current is flowing tells us almost nothing about remaining charge. The same battery can show wildly different voltages at the same SOC depending on the load.

For example:

  • A healthy 12.6 V battery may drop to 12.1 V at 2 A
  • The same battery may drop to 11.6 V at 10 A
  • Neither of these voltages means the battery is “50%” or “empty” it just means the battery is supplying current

This voltage drop is mostly due to internal resistance, not depletion of charge.


Why APC UPS (and other UPS manufacturers) don’t rely on voltage under load

APC UPS units do not attempt to calculate SOC directly from voltage under load. Instead, they solve a different problem:

“How long can this battery power the current load?”

This is a much more useful and achievable goal.

To do this, APC UPS systems use a battery runtime model, not a voltage-to-SOC lookup table.


What APC UPS actually measures

During operation, an APC UPS continuously measures:

  • Battery voltage under load
  • Battery discharge current
  • Load power (watts)
  • Battery temperature
  • Historical battery data (age, self-test results)

From these inputs, the UPS estimates remaining runtime, not true SOC.


Runtime estimation instead of SOC

UPS vendors care about runtime, because that is what the user needs to know during a power failure.

Internally, the UPS uses:

  • A known battery capacity (Ah)
  • A discharge model that accounts for Peukert’s law (lead-acid batteries deliver less usable capacity at higher currents)
  • Measured internal resistance (from periodic self-tests)
  • Temperature compensation

As the load changes, the UPS dynamically recalculates:

Estimated runtime = f(load power, discharge current, temperature, battery health)

This is why the “remaining time” display on a UPS changes when you plug in or unplug devices.


Battery self-tests and internal resistance tracking

APC UPS units periodically perform self-tests, briefly running on battery while measuring:

  • Voltage sag
  • Recovery behavior
  • Discharge current

From this, they estimate internal resistance. As batteries age, internal resistance rises, causing:

  • Larger voltage drops under load
  • Shorter runtime

When the UPS detects that the modeled runtime no longer matches expectations, it flags “Replace Battery” — often long before the battery completely fails.


Why APC still shows “battery percentage” in some models

When APC shows a “battery %” indicator, it is not a pure SOC measurement.

It is usually:

  • A normalized representation of remaining runtime
  • Or a hybrid value derived from coulomb counting + voltage + model correction

In other words:

That percentage answers “how much usable energy remains for this load,” not “how chemically full is the battery.”

So I am not gonna attempt to do anything related to battery charge measurement. It’s a can of worms.


Best option I think in your case would be to stick with predefined time, and if under that time power doesn’t come back then activate safe system shutdowns.

1 Like

By experience, ~11.5V is good cutoff voltage, under load or at rest. It doesn’t need to be an accurate percentage, it just needs to be a reasonable amount over 0.

Ideally, see at what voltage the low battery alarm triggers and add half a volt to that. For my Luminous inverters, it’s 10.8V (under load)

1 Like

For my luminous zelio 1100 its around 11.2-11.3v
I also have luminnous optimus 2800 but it never got discharged fully for me to measure the voltage.

1 Like

Sorry, I meant inverter cut-off due to low voltage.

The low voltage alarm is indeed at 11.25V and inverter cut-off happens at 10.8V

1 Like

Yes, the inverters are voltage based and it is a simple add on chargibg circuit if you look at the schematics.
It is an offline inverter and not an online ups which does regulate the current feedback.
Most inverters put out constant current for charging.

Apologies for delayed response. I am out of the country and TE does not work on wifi and I have to use an extremely slow mifi to access TE.

1 Like

Yeah. Thats where this discussion got revived again. Without smart ups with network support you can use smart plug to detect outage. Then shut system down based on time.

If we detect voltages on battery directly via DIY stuff then that gets janky or expensive. So better to get UPS with network access.

1 Like

So it’s just a matter of detecting 11.25V under load via RPi.

Should be good enough for us.

2 Likes

Yep. Need to check feasibility of this without making too many wires hanging around.

There will be lot of wires everywhere. :melting_face:

Step 1. Make it work somehow.
Step 2. Make it right.

3 Likes

The details in the picture (Battery SoC, V, I, W, Ohm, time) is interesting for me.

Could you share the setup details for this SoC Monitor ? Does it measure Bi-Di Current to measure the Charge ? How accurate they are ?

Is this build related to DIY Wi-Fi Battery Monitor for Inverters/UPS (IoT Lead Acid Battery?) ?

Use a DC - DC UPS?
a 12AH small battery will easily keep it running for several hours

Do you know any?