Author Topic: Building an UPS  (Read 1150 times)

0 Members and 2 Guests are viewing this topic.

Offline psysc0rpi0nTopic starter

  • Frequent Contributor
  • **
  • Posts: 328
  • Country: ar
Building an UPS
« on: January 25, 2023, 09:43:19 pm »
Hello.

I have a few 18650 Li-Ion batteries lying around and I'm thinking about building a simple UPS system, but tbh, I don't even know where to start.
First of all, I searched online for similar projects and all I see is backup batteries and nothing else.
What I want to do is a device were you connect your mains plug to feed an SBC (RockPro64) which runs 24/7 and also use the batteries to feed the SBC in case mains power outagges. So, some kind of detecting electronics and switching electronics are needed.

I found this article that seems to be the closest to what I want, but they use small input voltages, not the 240V in my case of mains voltage.
https://embeddedcomputing.com/technology/analog-and-power/batteries-power-supplies/how-to-build-an-uninterruptible-power-supply-for-home-devices

Does anyone knows any articles that shows how to uilt such device?
 

Offline paul_g_787

  • Frequent Contributor
  • **
  • Posts: 493
  • Country: gb
Re: Building an UPS
« Reply #1 on: January 25, 2023, 09:50:34 pm »
Hello.

I have a few 18650 Li-Ion batteries lying around and I'm thinking about building a simple UPS system, but tbh, I don't even know where to start.
First of all, I searched online for similar projects and all I see is backup batteries and nothing else.
What I want to do is a device were you connect your mains plug to feed an SBC (RockPro64) which runs 24/7 and also use the batteries to feed the SBC in case mains power outagges. So, some kind of detecting electronics and switching electronics are needed.

I found this article that seems to be the closest to what I want, but they use small input voltages, not the 240V in my case of mains voltage.
https://embeddedcomputing.com/technology/analog-and-power/batteries-power-supplies/how-to-build-an-uninterruptible-power-supply-for-home-devices

Does anyone knows any articles that shows how to uilt such device?

I have thought about building a lithium ion UPS in the past but never got to it. Was considering having a standard 18650 bases BMS charger running from a 5V switch mode supply to charge the batteries.
Batteries could power a small 5V regulator running a microcontroller which would monitor input and output voltage and current and control all the functions.

Then could have a bespoke switch mode output stage modulating a high frequency, e.g. 100KHz or something high-ish (for a smaller transformer than usually seen in a UPS) and a feedback would go to the output SMPS primary therefore allowing voltage regulation of the output to 240V/120V. This would then have to convert the output down to 50/60Hz sine wave somehow but never got that far into thinking about it.

Food for thought.
 
The following users thanked this post: psysc0rpi0n

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 15420
  • Country: fr
Re: Building an UPS
« Reply #2 on: January 25, 2023, 09:52:25 pm »
If weight and volume is not an issue, use LiFePo4 cells instead. Just my 2 cents. :popcorn:
 

Online langwadt

  • Super Contributor
  • ***
  • Posts: 4772
  • Country: dk
Re: Building an UPS
« Reply #3 on: January 25, 2023, 09:54:11 pm »
a few diodes would go a long way
 

Offline psysc0rpi0nTopic starter

  • Frequent Contributor
  • **
  • Posts: 328
  • Country: ar
Re: Building an UPS
« Reply #4 on: January 25, 2023, 10:01:55 pm »
Hello.

I have a few 18650 Li-Ion batteries lying around and I'm thinking about building a simple UPS system, but tbh, I don't even know where to start.
First of all, I searched online for similar projects and all I see is backup batteries and nothing else.
What I want to do is a device were you connect your mains plug to feed an SBC (RockPro64) which runs 24/7 and also use the batteries to feed the SBC in case mains power outagges. So, some kind of detecting electronics and switching electronics are needed.

I found this article that seems to be the closest to what I want, but they use small input voltages, not the 240V in my case of mains voltage.
https://embeddedcomputing.com/technology/analog-and-power/batteries-power-supplies/how-to-build-an-uninterruptible-power-supply-for-home-devices

Does anyone knows any articles that shows how to uilt such device?

I have thought about building a lithium ion UPS in the past but never got to it. Was considering having a standard 18650 bases BMS charger running from a 5V switch mode supply to charge the batteries.
Batteries could power a small 5V regulator running a microcontroller which would monitor input and output voltage and current and control all the functions.

Then could have a bespoke switch mode output stage modulating a high frequency, e.g. 100KHz or something high-ish (for a smaller transformer than usually seen in a UPS) and a feedback would go to the output SMPS primary therefore allowing voltage regulation of the output to 240V/120V. This would then have to convert the output down to 50/60Hz sine wave somehow but never got that far into thinking about it.

Food for thought.

Do you have a block diagram for your description? I wanted to start thinking about this and see if I am capable of doing it or if this is too much for my knowledge.
I'm not sure I understood your description correctly. Some schematics could help, or a block diagram!
 

Offline shapirus

  • Super Contributor
  • ***
  • Posts: 1625
  • Country: ua
Re: Building an UPS
« Reply #5 on: January 27, 2023, 12:28:59 am »
I found this article that seems to be the closest to what I want, but they use small input voltages, not the 240V in my case of mains voltage.
I would suggest designing it for a low-voltage DC input that expects, for example, a regular sealed 19V laptop PSU, or any voltage between, say, 12V and 24V, or whatever, and use a buck (or a buck/boost) DC/DC converter module which are sold for next to nothing on AliExpress to produce whatever voltage you need to power your circuitry.

Designing for 240V AC input is one of those less pleasant affairs, especially considering all the safety issues, so why not solve this with an external readily available 3rd-party unit?

I designed and built a UPS for my WiFi router and some other stuff recently. It is powered by a 24V (really can be anything from 15V to ~30V that can provide the required output current) external PSU, which powers a DC/DC buck converter capable of CC/CV. CV is set to the battery buffer-mode voltage (13.5V for a 4s LiFePO4 battery, making it 3.375V per cell), CC is set to the desired battery charging current, but read below.

I did not bother to implement a circuit to switch between the sources: battery vs PSU (plus the DC/DC module). The battery-backed DC outputs are connected to the battery AND the DC/DC converter, aka the charger, at the same time (when external power is present, see below).
Converter's output current is shared between the battery and the load when charging. This essentially makes it an online UPS. There is zero switching time. However, the fact that the charging current is shared requires that the max load current does not exceed the max current set at the CC/CV DC/DC converter. The higher the load current, the less current is left for charging the battery. This is fine in my scenario, where the load current is relatively low (~0.5-0.8A @13.5V) compared to the max current provided by the DC/DC module (~3.5-4A, I fail to remember exact setting now).

I did not use an extra output voltage regulator, because all of my 12V load is happy to be powered with anywhere within the battery working voltage range (~11..13.5V). Most of these devices have switching DC/DC regulators inside anyway. YMMV though.

Now, another problem is that these DC/DC modules typically draw current flowing into their output terminals when the battery is connected to them and there is zero voltage at the input terminals. Mine draws ~14mA which is too much to leave it unattended.

The easy solution is to put a series (Schottky) diode at the output. The downside then is that the CV setting stops working as desired. The diode's voltage drop decreases as current decreases, so it becomes impossible to set a precise end-charge voltage.

Many will find this satisfactory. I did not, and added a relay to disconnect the charger from the battery when the external PSU does not supply voltage (a power loss situation). In this case, a diode is required at the charger's input to prevent the battery voltage backfeeding through the charger from output to input (yes it takes place) to the power-presence detecting circuit, essentially consisting of the relay coil. This is much less of a problem: due to the higher voltage at the input (considering a 24V PSU) the diode doesn't heat up as much and we don't care about the precise value of the voltage drop across it.

Pretty much the same switching logic can be used to switch between battery and external power, if an offline UPS scheme is preferred. In this case, however, I think, two DC/DC converters may be required: one to charge the battery, another to power the load, unless the PSU already outputs the voltage you want. I don't remember why I didn't use it. My design suffered a long evolution :).

Then, you need a cell voltage balancer for the battery. This can (and really should, trying to build it yourself is not usually worth the effort) be external and independent. Mine is external, it's one of those capacitor-based active balancers sold on AE. It has a "RUN" jumper which, being switched between shorted or open, can be used to turn it off when the battery discharges below the minimum allowed cell voltage to prevent further discharge. This jumper can be conveniently controlled by an open-collector optocoupler (first test for proper polarity on its terminals when open).

Then again, you also need a cell voltage monitoring system to prevent overdischarge (overcharge is less of a concern, since it's controlled by the combination of balancer and charger's CV setting, but is still nice to have). External inexpensive boards (BMS) are available on AliExpress as well.

EDA software that can do real-time interactive (accent being put on "interactive") simulation, such as Proteus, can be very helpful to verify and filter ideas, especially when it comes to relays and switches. Simply begin building something in it, and see new ideas come, test them and gain new knowledge.

Hope this helps.
« Last Edit: January 27, 2023, 12:33:59 am by shapirus »
 

Offline psysc0rpi0nTopic starter

  • Frequent Contributor
  • **
  • Posts: 328
  • Country: ar
Re: Building an UPS
« Reply #6 on: January 28, 2023, 08:36:44 pm »
I found this article that seems to be the closest to what I want, but they use small input voltages, not the 240V in my case of mains voltage.

I would suggest designing it for a low-voltage DC input that expects, for example, a regular sealed 19V laptop PSU, or any voltage between, say, 12V and 24V, or whatever, and use a buck (or a buck/boost) DC/DC converter module which are sold for next to nothing on AliExpress to produce whatever voltage you need to power your circuitry.

Designing for 240V AC input is one of those less pleasant affairs, especially considering all the safety issues, so why not solve this with an external readily available 3rd-party unit?

I designed and built a UPS for my WiFi router and some other stuff recently. It is powered by a 24V (really can be anything from 15V to ~30V that can provide the required output current) external PSU, which powers a DC/DC buck converter capable of CC/CV. CV is set to the battery buffer-mode voltage (13.5V for a 4s LiFePO4 battery, making it 3.375V per cell), CC is set to the desired battery charging current, but read below.

I did not bother to implement a circuit to switch between the sources: battery vs PSU (plus the DC/DC module). The battery-backed DC outputs are connected to the battery AND the DC/DC converter, aka the charger, at the same time (when external power is present, see below).
Converter's output current is shared between the battery and the load when charging. This essentially makes it an online UPS. There is zero switching time. However, the fact that the charging current is shared requires that the max load current does not exceed the max current set at the CC/CV DC/DC converter. The higher the load current, the less current is left for charging the battery. This is fine in my scenario, where the load current is relatively low (~0.5-0.8A @13.5V) compared to the max current provided by the DC/DC module (~3.5-4A, I fail to remember exact setting now).

I did not use an extra output voltage regulator, because all of my 12V load is happy to be powered with anywhere within the battery working voltage range (~11..13.5V). Most of these devices have switching DC/DC regulators inside anyway. YMMV though.

Now, another problem is that these DC/DC modules typically draw current flowing into their output terminals when the battery is connected to them and there is zero voltage at the input terminals. Mine draws ~14mA which is too much to leave it unattended.

The easy solution is to put a series (Schottky) diode at the output. The downside then is that the CV setting stops working as desired. The diode's voltage drop decreases as current decreases, so it becomes impossible to set a precise end-charge voltage.

Many will find this satisfactory. I did not, and added a relay to disconnect the charger from the battery when the external PSU does not supply voltage (a power loss situation). In this case, a diode is required at the charger's input to prevent the battery voltage backfeeding through the charger from output to input (yes it takes place) to the power-presence detecting circuit, essentially consisting of the relay coil. This is much less of a problem: due to the higher voltage at the input (considering a 24V PSU) the diode doesn't heat up as much and we don't care about the precise value of the voltage drop across it.

Pretty much the same switching logic can be used to switch between battery and external power, if an offline UPS scheme is preferred. In this case, however, I think, two DC/DC converters may be required: one to charge the battery, another to power the load, unless the PSU already outputs the voltage you want. I don't remember why I didn't use it. My design suffered a long evolution :).

Then, you need a cell voltage balancer for the battery. This can (and really should, trying to build it yourself is not usually worth the effort) be external and independent. Mine is external, it's one of those capacitor-based active balancers sold on AE. It has a "RUN" jumper which, being switched between shorted or open, can be used to turn it off when the battery discharges below the minimum allowed cell voltage to prevent further discharge. This jumper can be conveniently controlled by an open-collector optocoupler (first test for proper polarity on its terminals when open).

Then again, you also need a cell voltage monitoring system to prevent overdischarge (overcharge is less of a concern, since it's controlled by the combination of balancer and charger's CV setting, but is still nice to have). External inexpensive boards (BMS) are available on AliExpress as well.

EDA software that can do real-time interactive (accent being put on "interactive") simulation, such as Proteus, can be very helpful to verify and filter ideas, especially when it comes to relays and switches. Simply begin building something in it, and see new ideas come, test them and gain new knowledge.

Hope this helps.


Hi...
I just read the explanation and it is a bit overwhelming for me. A block diagram could be really handy here so that I could have a proper general concept of the circuitry needed.
I was thinking about buidling a small battery with the 18650 cells and a BMS. This is a part of the whole system.
Then, I have (also chinese) transformer feeding the board that can be regulared for several output voltages, starting at 12V up to 24V and capable of upt to 4.5A. If it is suitable, this can be the main input of power to both the board and the battery.. This way I take the mains power from the equation. If needed I can find a better power supply / transformer to be able to feed the board and charge the batteries!

But for now, I need to come up with a plan. Know exactly what I need, and step by step. Too many things at a time and I get lost! :|
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf