DIY Arduino-powered 12V UPS suggestions | HELP NEEDED!

Thread Starter


Joined Jan 8, 2021
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 and I think this is going to be a piece of the past very soon... I'm also sorry for two things regarding this thread: I'm not a fluent English speaker. 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.

Anyway, here is the idea: In the area I live we have very frequent power outages. Inside my in-house electronics lab I want to have a server running 24/7 where backups are stored and a website (including various front-ends for Arduino projects I have in this room like for example a weather station) are served. Also a 24/7 DC power source comes always very handy aswell! Now, since inverters are neither cheap (I think it's better to have pure sine wave rather than these chinese pieces of crap) nor efficient, I decided why not convert my server's power input (a normal pc) from AC to DC. And it was all of the aforementioned that led me into one idea: Why not make a COMPLETE smart UPS solution with advanced monitoring features? That was the only way to keep my OCD from triggering because whenever I do something Arduino-like I tend to overcomplicate the design even though I'm not used to asking such questions on forums. And after all that, I came up with this (this is what I want your precious help and advice for): For power supply: 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.

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 connector (not the generator itself) and I have also modified the generator's kill-switch in order to be able to shut it down using a standard Arduino board and a MOSFET. 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. 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. The reason I didn't decide to go with a typical:


Is because: 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).

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. Also what about temperature sensors? I want to be as accurate and detailed as possible... 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... Now let's not forget the PC part. The PC will receive unregulated 12V @ MAX current I can provide and then: With another ATtiny, regulate 12V into 3 separate channels (12V, 5V & 3V3) Report the final result (voltages) to an ATmega328P-U which is (probably) going to also get some temperature samples from around there and finally handle the communication with the Mega using UART as always (I don't know if it's bad but I'm used to it and I admit that) so we don't overwhelm the ATtiny that is doing a mission-critical IMO job (read on stackexchange that this is actually a good practice to do but I'm not convinced yet). The ATmega will also play with the power-good signal and listen to the motherboard's green wire (PSU_On)

The PC is also going to be connected with USB to the Mega for 2 things: Soft-shutdown More data so it gets processed using python and becomes part of the webpage that this computer serves.

And before we even come to an end, I want to add the idea of creating another Arduino-based frontend or maybe have the Mega drive an LCD by itself. My budget is approximately 100EUR without everything I have now (generator, DC-DC, Arduinos e.t.c.) so I can and I'm willing to spend. To me it's more of a project than a necessity.

EDIT: To make the question more clear... It's not only one question and certainly I'm not trying to tell anyone I've managed to design something. For now I can't do anything since I haven't got any answer. However, here is what I'm asking for in a more "neat and organized" way: What component selections should I make and why? Are there any obvious mistakes in the concept or implementation that you could spot? Could it be done better, simpler or more efficiently (price doesn't matter as long as it is <=100EUR, however I don't want to loose the smart functions of the system)? Is the smart aspect of the project really "smart"? What do you guys think overall?

Again, to everyone still reading, my apologies for this monstrous amount of text. If anybody is interested I can provide a very very crude schematic though I haven't written any code yet. I've decided that this is going to be my project now so 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. I've got 3 years of experience with programming (C#, C++ and web) so don't worry about having to explain anything in layman's terms. Again thanks for your patience and see you hopefully soon!

Kind regards,
Lefteris Garyfalakis


Joined Jun 8, 2013
A product already exists that will do everything you require. APC sells smart UPS's that will interface (serial/USB/network) with your PC. Perhaps you could explore writing code to manipulate the UPS.