Another attempt at a DC uninterruptable power supply


ALL NEW - Battery Finder Search for 12/24/36/48v or by capacity www.batteryfinder.net
New & used Batteries, Solar, accessories, LifePo4 cells & more 5% Coupon "Powerwalls" www.batteryhookup.com
Joined
May 25, 2017
Messages
564
I put together a 12V UPS for my wireless router a while back: https://secondlifestorage.com/index.php?threads/wireless-router-gets-a-diy-ups.10588/ It works ok, but I never was able to get it to switch fast enough to keep the router on during the switch from main power to battery power.

I've decided to rethink things a bit and see if maybe I could build one without a switch. So the battery is interactive all the time. I played around a bit and this is what I came up with:
DIYUPS.png

I figure working backwards, all the Watts from all the devices would be added up, and the total Amps drawn from the battery could be calculated. The battery would need to have enough cells in parallel to both provide the maximum Amps and to accept enough Amps from the power supply and regulator to both run the devices and allow the battery to charge without the input Amps exceeding what is safe for the battery if all the devices were off. I'd have to decide on the Voltage of the battery too.

From there, the converters and such would need to be chosen to handle the input and output Volts and Amps. Also a few safety and monitoring devices could be added. I wonder if a desktop PC could be run on direct current...
 
Looks very good (y) I checked out the relay switching time and for mechanical ones (the blue relay shown in your other thread) it's 5-15ms, too slow to keep power during an outage. Maybe, I didn't test it, a solid state relay could make it, switching time between 0.5-1ms. I often use solid state relays because I find them in old televisions, mine are low amp capacity (nearly all 2A).

Having the battery inline is a working solution although battery will always be under charge unless you add some voltage cutoff check.

I tried a cheap solution some time ago to make a backup for my WiFi Access Point, it has two power sources: it's original 12V PSU and 3x18650 cells in series. This schematic doesn't include the battery charger; plus I ignored the right section of the schematics: I stopped at the J3 12V Output and didn't add the LM317/R2/R3/J4 because I didn't need them. This is it, in case you're curious about it: https://hackaday.io/project/162077-12v-battery-backup-ups
 
If you go with a 24V 7s pack, everything will be step down regulated & currents a bit lower vs step up configs.
If you set the 120V charger to hold say 4.0v/cell the pack should last nicely & hold ~90% of it's capacity for when there's an outage.
Laptops typically take 19 or 20V, phones, etc 5V, routers 12V

One thing to consider is if the street grid is down, will your incoming internet be working as any gear in the street will be off.... Mobile tower or satellite based 'net would probably be fine for a while at least (assuming mobile tower has batteries/backup gen?).
 
Internet connectivity is often still there when the power is out. It depends on the nature of the outage. If a tree branch or car were to take out the local power lines, the data cables would be gone too. But if it's more like a substation thing, the distribution stuff can power itself for a time.

There's also the brief interruptions that only last a couple seconds when something on the grid breaks and power gets rerouted to our area automatically. It's enough to reset the home network stuff and is really annoying.

I was also thinking about limiting each cell to 4V or so. That last 0.2V has almost no energy in it. Once the battery reaches full Voltage, no Amps will be going into it anyway. I think I'll do an 8s battery so the Voltage will be between 32V and 22.5V. I figure I'll want a battery that can handle more Amps than I'd draw with all the loads.

So if the battery is needing to charge, and the devices are in use, the battery can see at least some of the current coming in. But if the battery is charging, and no devices are in use, I don't want to over-current the battery. I played with some real-life numbers I got from my various devises, and came up with this:
UPSnumbers.png

I did some rounding up since there's always losses and you don't want to run converters at full power all the time. Anyway, the most current will be drawn from the battery (and the converter charging the battery) when the battery is at its lowest Voltage, so I did my calculations with that value as a worst case. At most, the devices might want 6.7A. If I make the battery able to accept 8A, then I'll always have at least 1.3A to charge the battery. Usually more. And if all the devices are off, then the whole 8A will be available and the battery will charge faster. When the battery is fully charged, the devices will draw up to 4.69A. Usually less.

Unfortunately, the battery will be a problem. I could use old laptop cells, but I'd need 128 of them to cover the Amps, Wh, Volts, etc. I could buy fewer new ones with better ratings, but that gets expensive pretty fast. I'll play around with higher Voltage to try to get the Amps down and see if I can find a better combination.
 
This won't work for every house and home setup, but just my two cents:

I don't have my whole house off grid, yet, if its even possible. But for now, it did not take much trouble for me to power my modem and router, both 12v, directly off solar, 100% of the time. Both of them together take less than 20 watts. Add in a macbook and a windows tablet.

I have 500w solar -> 14s bank -> 12v buck converter -> wires running directly to the 12v devices I want powered. No need for AC to DC converters, no 120vac-12vdc conversion losses, no interruption to worry about if power goes down.

Would a similar situation work for you?
 
Internet connectivity is often still there when the power is out.
Yes, over here in Italy it's the same. The ISP's "routing boxes" have backup power so they don't go down when there's a power outage.

So if the battery is needing to charge, and the devices are in use
Uhm, here I have two questions:
1) The battery can't charge and discharge at the same time. What will happen? Will the system charge for some milliseconds and feed load for another millisecond... I never tried a configuration like the one on your diagram.
2) Under load when grid is up the battery will feed the load using some of it's capacity and in the same time frame (lets say 2 minutes) recharge? So it will be at 4.0V... 3.9V... then charge again to 3.95V... 3.96V and then discharge to 3.92V... 3.89V and so on? If this is the scenario then the battery will be constantly charging and discharging (constant stress); I think it would be better to feed the load directly from the AC-DC converter and switch to battery only when needed (which was your first diagram with the relay).

Oh, yes, I do like your configuration with no AC @harrisonpatm!
 
1) The battery can't charge and discharge at the same time. What will happen? Will the system charge for some milliseconds and feed load for another millisecond... I never tried a configuration like the one on your diagram.
Generally what happens here is the battery will maintain a set charge state. While the charger/psu is operational, it'll power any loads. The key here is that the charger/psu needs to be able to provide more current than what the combined devices will need. This way the batteries are never touched while there is grid power. As soon as the grid goes down, the charger/psu looses output, and the batteries immediately pick up the slack.
Then when the grid comes back online, the charger/psu will power the devices and the remaining current will charge the batteries slowly until desired SoC is reached, at which point power will will stop flowing into them.

2) Under load when grid is up the battery will feed the load using some of it's capacity and in the same time frame (lets say 2 minutes) recharge? So it will be at 4.0V... 3.9V... then charge again to 3.95V... 3.96V and then discharge to 3.92V... 3.89V and so on?
Not if the charger/psu can supply more current than the combined devices require. This would be a situation where there's some smarter electronics in play that monitors the battery SoC and would connect/disconnect the charger from the battery/load over the course of operation. This actually would not be recommended, imho.
Any kind of smart ups style electronics would need to have the ability to charge the batteries, then stop completely and only charge when the battery naturally discharges and supplies the load(s) with the charger/psu. And then when there's a power issue, it would switch over to the battery and then that is when the battery finally begins its discharge cycle.

This actually is doable, and just takes a little bit of ingenuity to set up. Basically what would need is a feedback of the input voltage to the controller. Then the output would be buffered by a large capacitor that could power the devices for a second or 2 under full load. And during this state the FETs switch the charger/psu source off and the battery FETs turn on, re-charging the capacitor and restoring full power flow. Then when power is restored, reverse the switching.
All this can actually be done with zero code written and just some diodes, FETs, capacitors, and comparitors (and probably a few other devices).
 
While the charger/psu is operational, it'll power any loads. The key here is that the charger/psu needs to be able to provide more current than what the combined devices will need. This way the batteries are never touched while there is grid power.

I don't see how this can happen with the given diagram, the battery and only the battery always feeds the load:

schema.jpg

What I was describing was based on this schema, am I missing something?
 
One tidbit in reference to APC UPSs.... as @Korishan describes, the grid input powers the output and secondarily charges the battery. A benefit of this is that one can disconnect/change the batteries without disturbing (or turning off) the loads as long as the grid holds steady during the battery maintenance window. This can be a pretty cool feature of a classic UPS design :)

@rebelrider.mike's design would not support this. This isn't bad, just a side point.
 
When the charger/psu are connected/powered, and while the charger/psu is outputting (capable of) more current than the sum of the connected devices, the battery becomes one of those devices. So it will take what ever is left over, if it needs it.

Think of the battery in this situation as a pressure water tank. The tank is there to provide water flow when the pump is not on. And the tank only provides that flow when the pump is off. however when the pump is on, then tank is re-pressurized and filled and waits for the next time time the pump is not on to provide flow.

This is why the charger/psu needs to be able to output more than the sum total of the devices connected, so that the battery isn't in a constant state of charge/discharge as the loads change current requirements.
 
I see what you say, thanks, for the PSU the battery is a load (I was thinking of the load as the devices after the battery) (y) I'd surely add a simple circuit on one pole the battery output to cut off the line when AC is available, to avoid the battery (nearly) always participating to powering the load which would cause a constant battery top up.
 
The nature of the CV CC converter is to limit Volts to whatever maximum I want to give to the battery. I figure I can limit it so each cell sees a maximum of 4V instead of 4.2V, to reduce "wear" on the the cells. So in the example of an 8s battery, that would be 32V. Once the battery is at 32V, any other loads like cell phones etc. the current would run right on by the battery and go directly to the other loads. Like Korishan said, the battery is basically in parallel with the other loads.

I just have to make sure the battery can handle the full current available for the system in the event that the other loads are off, and the battery needs charging. The other nature of the CV CC converter is to limit the current to whatever maximum I want. It does this by reducing the Voltage to control the Amps.

It looks like the best balance between Volts Amps and Wh is 12s9p. That's a total of 108 cells. I'll have to look and see if I've got that many cells of similar capacity. I've got a large stash of 18650s, but they range from 1Ah to 2.5Ah.

Charging the battery and running the loads, I'll want a CV CC converter that can output between 48V and 30V, and provide at least 6A continuously. I'll need a power supply too, that can handle more than 162W. The power supply will need to be at least 2V different from the battery, so either 28V or less, or 50V or higher. There's a 60V 400W power supply on Amazon that would work. Here is a CV CC buck converter that should handle the Voltage and current range. I would prefer one with just the adjustable pots instead of the fancy digital interface, but it doesn't seem like there's much choice in buck converters at input Voltages that high.

The other route is to go with a 12V or 24V power supply and a boost converter. Here's a 12V 360W that would work. An advantage to using 12V is that I could directly power cooling fans if I were to put this whole setup in an enclosure. And here's a boost converter that should work.

I've updated my diagram to include some switches and fuses. Not sure about the fuse ratings. I have to see what fuses I have in my stash. I don't remember what all the standard sizes are.
DIYUPS.png
 
I just have to make sure the battery can handle the full current available for the system in the event that the other loads are off, and the battery needs charging. The other nature of the CV CC converter is to limit the current to whatever maximum I want. It does this by reducing the Voltage to control the Amps.
What you could do here is use a current limiter. This can be as simple as a resistor to slow the flow, or using an oscillator and a FET (I forget which FET does this job, but easy to look up I'm sure). This way the FET would only come partially on to allow X-amps through.
Then, to the devices/loads, you could use a diode going to the loads. This way current will always flow out no matter what. So essentially you'd have the current limiter with a diode in reverse parallel. The loads would be connected to the charger/psu side, and only the battery would be on the limiter side.
Just thinking out loud, of sorts. Not sure if this approach would be the "simplest", of course, or easiest and/or most reliable either

The other route is to go with a 12V or 24V power supply and a boost converter
Definitely go with a buck converter where ever possible. Don't use boost converters. They waste more energy. And in this application, power longevity is necessity. Not to mention working longevity as well. Bucks can usually handle a lot more Amps than Boosters as well.

I've updated my diagram to include some switches and fuses.
Good idea all things considered. Could even use those glass tube (BUSS) or blade fuses usually used in automotive. The holders are cheap, and the fuses are easily retrieved from a salvage yard and big pockets :p

There's a 60V 400W power supply on Amazon that would work
Here's another: https://www.amazon.com/SJHPRMXF-Universal-Regulated-Switching-Transformer/dp/B0BWC9PMJX
Supposedly 30A output, which would be 1800W, but the title says 250W, or description says 360W. So I'm confused by this one 🤔
 
Unfortunately, FETs are a bit beyond my understanding. I really don't mind using Chinese stuff. I've used a lot of buck and boost converters for various projects, and have yet to see any malfunction unless I broke them myself.

Shopping for BMSs has thrown a wrench in the works. Turns out they make 13s BMSs, but 12s is harder to come by. 13s would actually work out better, but the Voltage is so high, finding a buck converter has been more challenging. Here is one that might work. It would also eliminate the need for a separate Volt meter.

I think I'd like to build all this in a single enclosure with a fan. I have an empty UPS case that I've been saving for a project like this. I think I even have a thermal switch somewhere so the fan would run only when the interior gets warm. I'm also pretty sure I can find a small 12V power supply in my stash o' junk.
 
Some time ago I've built a simular project with a wemos board to switch my raspberry pi's powered by a battery bank and charger.
1681501686208.png

I plan to redesign it one day to make it single board, but you get the idea.
1681501728249.png

The FET is directly switching the input power and can drain quite some current without cooling, while input is 12V, output 5V it might drain 1.5A at 12V when draining 3A at 5V.
I'm inputting the output of a 3S9P pack directly in the Wemos. The charging is currently controlled by esphome and a simple tuya plug connected between the charger and the wall socket.
I've created a node-red flow that uses my solar panels and powerwall battery state as input.
If my powerwall is >80% or battery voltage is below 10 V => charger is turned on, if battery pack is at 12.3V => turn off the charger unless the main powerwall is full, it will use solar power to power the rpi's. I've connected 12V to 5VDC converters with USB out to the outputs and those power my rpi's. This is the battery level for one day. Plan is to increase the battery capacity, so I won't need 2 cycles in winter period. The battery pack is made from old cells that were below 80% original capacity, so I'm cycling from 3.33 to 4.1V to reduce the stress as much as possible. The charger top voltage can't be adjusted, but if it was adjustable, I would cycle 3.3 to 3.9/4.0. The charger easily powers the load while charging the battery.
One disadvantage is during an upgrade of the wemos code, the pi's might cycle. I plan on putting some supercaps on the raspberry side to solve this. A simple 2 supercaps in series with 2x100ohm resistor in parallel connected to the 5V side should make it possible to survive the reboot and upgrade of the wemos board.
1681501987723.png
 
Neat project! Way over my head though, LOL.

I found my empty UPS case, but I'm not sure the batteries will fit. I have a few desktop PCs that I could empty out and build the UPS into. I'm imagining the inside of the box will look something like this:
DIYUPS2.png


I figure the batteries should go on the bottom since they're probably going to be the heaviest components, and also they should stay the coolest. I put an exhaust fan at the top, and figure the 60V power supply will be hottest, so I put that up there too. I added a 120VAC to 12VDC to directly power the fan. That way the fan will run even if the 12VDC converter is switched off or has a blown fuse. Also, I'm thinking that the fan will be unnecessary during a power outage because the two hottest components (the 60V power supply and the CV CC regulator) won't be running.

Depending on what kind of box I use, the outside may end up looking something like this:
DIYUPS3.png


If it's an old PC case, I may do something creative with the drive bay openings for the fuse and switch panel.
 
Some time ago I've built a simular project with a wemos board to switch my raspberry pi's powered by a battery bank and charger.
View attachment 29448
@ziporah
What are the three green connectors for? I see each FET drives a connector.
And how are you checking the two voltage thresholds? (below 10V and battery charge >=4.1V)
 
Last edited:
Unfortunately, FETs are a bit beyond my understanding.
FETs are easy, just lots of variants dependent on what your application is.

And there's always YT University ;) My go to for instant knowledge
 
@ziporah
What are the three green connectors for? I see each FET drives a connector.
And how are you checking the two voltage thresholds? (below 10V and battery charge >=4.1V)
The thresholds are checked using node-red. There's a feedback from the input voltage using two series resistors connected to A0
1682887356571.png


Code:
var batteryState = context.get('battery')||"low";

var newMsg = { topic: "battery_state", payload: batteryState };
if (msg.payload <= 10 ) {
    batteryState = "low";
    newMsg = { topic: "battery_state", payload : batteryState };
    context.set('battery',batteryState);
} else if ( msg.payload >= 12.2 && batteryState == "low" ) {
    batteryState = "full";
    newMsg = { topic: "battery_state", payload : batteryState };
    context.set('battery',batteryState);
} //else {
//    newMsg = { payload : "normal" }
//}

return newMsg;


The green connectors are connected to DC/DC converters powering my raspberry pi's using USB to USB C. Below the POC while I was working on it, the raspberry pi tower is in the back. (2 pi's then, 3 now).This is the box with the monitoring and pir sensor not yet installed.
1682887765673.jpeg

And the completed box below.
1682887859914.jpeg

The PIR sensor is my "get out your chair" detection. I struggled with back pains and neck issues. It is connected trough home assistent to the light control of my office. If I don't move or PIR gets undetected for 10 minutes, I automatically turn off the light, making me get up of my chair or at least move.
 
Back
Top