DIY Arduino-powered 12V UPS suggestions | HELP! GOT TOO COMPLICATED!

Hi everyone!
Firstly my wishes to whoever reading this piece of text, have a nice year and I hope that everyone is doing fine in this current pandemic. I overcomplicated the design and I think it's too much for me to handle (because I'm 15 years old by the way) so I'm sharing with you everything I know about this project right now.

The idea:
Inside my electronics lab I want to have a linux server running 24/7 (and a 12VDC power source is quite handy aswell). Now, since quality inverters are neither cheap nor efficient, I decided to convert my server's ATX PSU from AC to DC. And with this out of the way, all that was left to do was the UPS itself that will provide the PC with power.

What I came up with:
And after all that, I came up with this (this is what I want your precious help and advice for):
I need those sources of power to be available:

  • 12V @ 20A AC -> DC LED power supply with fan.
  • 12V @ 100A DC diesel generator (hooked in parallel to the power supply above)
  • 12V @ 70Ah car battery (SLA?)

NOTE: I already have everything mentioned above except the power supply which costs around 19 euros here.

And since something like this:

----------------------
| AC/DC Power supply |----------|        
----------------------      ----|------               --------
                            | Battery |-------------- | LOAD |
-------------               ----|------               --------
| Generator |-------------------|
-------------

Can end up damaging the battery in the event of an extended power failure I came up with another idea for which I really want your help on how to implement (because I'm not sure if my implementation is correct).
Also another 2 reasons I have found are:

  • I need to somehow boost the voltage in order for the battery to charge properly.
  • The boost converter (DIY or not) can't handle that much current (20A, and yes my load is going to be around there).

So this is how I'm going to wire everything up:
The main (220VAC) power supply will be connected in parallel to the DC generator. This line consisting of the two power supplies, will be connected to
a) A P-Channel MOSFET (I'm not sure but to avoid devices getting power from ground if I use a N-Channel?) and
b) A DIY attiny-based step-up converter with voltage reference to the battery and controlled by the main board, an Arduino Mega 2560 R3.

Why use a diy step-up converter?
This step-up converter is what I think is the solution to charging the battery and the reason I think it should be controlled is because I've read that a Lead-acid battery in a UPS application like this needs float charging (so I set the boost converter conviniently using the Mega to 13.8V or so) and once per let's say two weeks I set it to 14.5V because I'm unsure of that but... helps extend battery's life?

Anyways... So we end up with this. Now the battery has another P-Channel MOSFET whose output is in parallel to the other P-Channel MOSFET's one. Now this is so I can use relayless switching from the AC/DC converter | Generator to battery and vice-versa.
Moving on, the P-Channel (probably power) MOSFETS are going to be controlled by the Arduino Mega I mentioned above, which itself is going to be powered by the battery via a buck converter. I needed a direct connection because this is what controls the load (via the MOSFETS) and by the way I forgot something:
Only one MOSFET will be turned on at a time or none (if there is a power outage and the battery level is too low).
In my opinion, there has to be an auxiliary power supply (probably a 5V @ 800mA phone charger I have) that would help in an event of a power outage the Arduino (always referring to the Mega here...) distinguish between the generator and the power supply so it knows where it is connected to. The MOSFET that controls the power supplies should not be on at the same time with the battery's 'cause otherwise the boost-converter will become a toaster, literally. I need a way for the Arduino to tell which one to open... I'm really unsure of this. Maybe pulse between the two untill you find some voltage at the output? I think this could be the most difficult part. I also don't know how many voltage dividers I will need and which are the critical spots to place them. One voltage divider should go to the battery for sure so the MCU can pulse the boost converter and get samples from the battery to know the actual voltage. Or we don't need that? This is where all of my confusion begins and well... it won't come to an end!

EDIT: To make the question more clear and remove those big chunks of text as others have very correctly suggested:
I'm asking you the following:

  • What component selections should I make and why?
  • Is the "switching between power supplies and battery" and battery (boost converter) charging circuit a good idea?
  • Are there any obvious mistakes in the concept or implementation that you could spot?
  • Could it be done better, simpler or more efficiently?
  • What do you guys think overall?

Again, to everyone still reading, my apologies for this monstrous amount of text. I'm waiting for your ideas, advices, suggestions and the like. I'm not going to begin yet as this is the purpose of writing here because I still don't know a lot of stuff.
Kind regards,
Lefteris Garyfalakis

Are you sure you are 15 years old?

1 Like

@hzrnbgy Haha! I would be lying if I said no... :slight_smile:
Anyways, thanks for your support!

1 Like

lefterisgaryfalakis:
Now, since inverters are neither cheap (I think it's better to have pure sine wave rather than these chinese pieces of crap)

And you think that high-end APC UPS units aren't made in China?

If you are powering something with a switching power supply, like a PC, then a stepped sine wave is perfectly fine. Also, don't connect anything that doesn't have to be powered to the UPS. If you have a power fail, you want your servers to keep running, but do you really need a monitor sapping power from the UPS?

I've given you karma because (I guess like a lot on this forum) you remind nme of myself when I was young and enthusiastic.

Can I suggest you read the "how to use this forum", and also (plug for my tutorial)

how to make a schematic you can post

A picture is worth 1000 words. Your post is just too wordy and few will read it all.

So if you can simplify the problem, and deal with one issue at a time that would be more realistic.

This is an interesting project - possibly risky for a beginner, but it will teach you a lot of power techniques.

Luckily, you’re probably going to be switching DC, so you don’t need to worry about phase sync etc, but equally, high-current DC can do a lot of damage.

There are some shortcuts you’ll become aware of, but I’d be getting some rated isolators or fuses in critical parts of the design, so you can protect yourself and the equipment while your getting it all together.

Good luck!

SteveMann:
And you think that high-end APC UPS units aren't made in China?

If you are powering something with a switching power supply, like a PC, then a stepped sine wave is perfectly fine. Also, don't connect anything that doesn't have to be powered to the UPS. If you have a power fail, you want your servers to keep running, but do you really need a monitor sapping power from the UPS?

Actually I didn't even think about that though I take it for granted most of the times! ;D

Yeah but you are still dropping the efficiency this way. This is going to be running 24/7 so I don't think the electric power company would like this hehe! Also, I'm more focusing on the power management side of things (how to charge the battery and swap between it and the other power sources). And no! I'm not going to do such a crime of connecting an LCD monitor to this UPS! I just meant a standard Arduino compatible 16x2 LCD. Nothing more...

johnerrington:
I've given you karma because (I guess like a lot on this forum) you remind nme of myself when I was young and enthusiastic.

Can I suggest you read the "how to use this forum", and also (plug for my tutorial)

how to make a schematic you can post

A picture is worth 1000 words. Your post is just too wordy and few will read it all.

So if you can simplify the problem, and deal with one issue at a time that would be more realistic.

Thanks so much John!
I've read your very easy to understand tutorial and I've edited my post accordingly.
A hand drawn schematic is available, and the reason I haven't drawn anything on Diagram Designer yet is because this project is still in infancy. I simplified the problem and again edited my post to drastically reduce the amount of text. The new question should be about the power management and power source switching side of things (custom boost converter, the 2 p-channel mosfets, the power supplies & voltage dividers) at the upper left (for the most part) side of the provided schematic.
Thanks so much!
Lefteris

lastchancename:
This is an interesting project - possibly risky for a beginner, but it will teach you a lot of power techniques.

Luckily, you’re probably going to be switching DC, so you don’t need to worry about phase sync etc, but equally, high-current DC can do a lot of damage.

There are some shortcuts you’ll become aware of, but I’d be getting some rated isolators or fuses in critical parts of the design, so you can protect yourself and the equipment while your getting it all together.

Good luck!

Thank you so much for your kind suggestions! Yeah I thought about DC because it's simpler to work with. About the high current you mentioned, I'm aware that it can be dangerous, but don't the power supplies usually come with enough protections to make us, users not care about that?
Wouldn't connecting everything together first and then powering the thing up be a good idea? If so, why?

The question that jumps into my mind is why do you need a generator?

How long do you expect a mains outage to last?

Why not just have a large lead-acid battery to provide power during mains outages?

Why not host the website on a cloud-based service and leave it to them to worry about power outages?

...R

Robin2:
The question that jumps into my mind is why do you need a generator?

How long do you expect a mains outage to last?

Why not just have a large lead-acid battery to provide power during mains outages?

Why not host the website on a cloud-based service and leave it to them to worry about power outages?

...R

Hi Robin!
Your questions all seem reasonable to me! Let me explain:

  • I don't expect the power outage to last long but since the generator is sadly sitting all year long doing nothing, I decided to put it to good use by just creating a connector for it and not intending to use it constantly. So in a potential let's say "apocalyptic" scenario this would be very useful (when you live in a tourist destination and the grid is overloaded every summer you quickly realize how much dependent you are on electricity).
  • Yes, I plan to go for a car battery (despite what the schematic indicates).
  • It's because of a bunch of reasons: a) I don't really like to be dependent on cloud (low internet speed here to upload my files, I like to see how everything works under the hood and learn a thing or two by designing this, and as always my fear of an "apocalyptic" scenario! :o)b) I removed it from the initial post since it all got too big but I also want to connect another Arduinos to this server for things like a weather station and I also want to have a 12VDC power source no matter what (for maybe no reason?).

Anyway Robin thanks so much for your time and attention!!! I really appreciate that!
Cheers,
Lefteris

lefterisgaryfalakis:
I don't expect the power outage to last long but since the generator is sadly sitting all year long doing nothing, I decided to put it to good use

That's a very poor reason to over complicate something. It would not be a good use of the generator. Including it will make a lot of work for you without adding any benefit.

Yes, I plan to go for a car battery (despite what the schematic indicates)

A starter battery is not suitable - other than for testing if you get it cheap. You need a deep cycle lead acid battery.

...R

Robin2:
That's a very poor reason to over complicate something. It would not be a good use of the generator. Including it will make a lot of work for you without adding any benefit.
A starter battery is not suitable - other than for testing if you get it cheap. You need a deep cycle lead acid battery.

...R

That's alright. I might remove the generator part but that doesn't really change the circuit because it was in parallel with the power supply. The battery, I'm getting it for free so I'm going to use it for testing and thanks for suggesting me a deep cycle one as I didn't consider it to be a good fit!
Now we still need to deal with:

  • Charging the battery
  • Switching between it and the power supply
  • Prevent discharging, overcharging etc...

My solution is to use 2 P-Channel MOSFETS but I have yet to see what anybody thinks about it. Is it a good / viable approach? And voltage dividers (for sensing) in key areas?

Thanks!
Lefteris

My first preference for a simple UPS would be to run the PC from the battery (perhaps via an inverter) all the time and also have a suitable charger that keeps the battery topped up all the time. Then if the mains power fails nothing needs to be switched.

It would probably be a good idea to have a means to monitor the charge voltage so it it would be known when the mains power failed. That way in the unlikely event of a very prolonged outage there could be an orderly shut down of the server.

...R

Don’t take my word for DC protection & isolation...

(Don’t actually do this, but look for stories about a steel wrench across a car battery’s output... the results are horrifying... molten metal, flames, eye damage etc

I’m not suggesting that’s what your planning, but electrical accidents are rarely planned.

Just take care.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.