diy solar

diy solar

DIY UPS v1 done...How can it be better?


Solar Enthusiast
Nov 2, 2019
SF Bay Area, CA
Sorry for the long post, I think the background is important.

In July, I put together an over spec'd DIY UPS for my home network rack in the garage.


This setup is what's called a "double conversion UPS". It's running the inverter all the time. There is no transfer time when the power goes out. I had the inverter already (600W IAMS pure sine wave, on the right). So I bought the 12V AGM deep cycle batteries and an RV converter charger (a PowerMax 55A). The idea is that the converter/charger does AC/DC all the time, it will charge the batteries and the float them at about 13.5V while providing enough current for the inverter to run the load. My load is no more than about 250W, but ends up being about 120W most of the time and 60W if turn off the NAS.

One feature I lost by moving from a consumer UPS to this is the "notify gear to shut down via USB". So I dug into that recently and put together an Arduino with an AC detection board. The Arduino acts like a USB HID Power Device to a computer, reporting AC avail/unavailable. My NAS can then read that like it could from my consumer UPS and I've got it setup to shut down 5min after the AC power goes away on the UPS input. I stuffed the Arduino inside the case of the converter/charger on the left.

The reason for this post:
My Arduino right now only AC present/missing detection. But I could wire up and write code to handle voltage and current monitoring, LVC, etc. I've been thinking what I'd really like is a single "box" that is the converter/charger + inverter + the arduino for UPS monitoring via USB, but could also to LVC and other things. Maybe there's an SBC inside and it provides stats over wifi? Thinking about the components, what I have is essentially an AC->DC PSU that is ok running 100% duty cycle, an SLA charger (ideally configurable charge profiles to make it flexible enough for SLA and various lithium batteries) and a DC->AC inverter that is ok running 100% duty cycle.

I'm very comfortable with the microcontroller and software side and with putting together components, wiring, and designing building an enclosure. But I don't think I want to tackle designing my own PSU, charger, and inverter from scratch. My questions for this group is are there "modules" like an open frame PSU, charger, and inverter? Things built assuming they don't need a user interface and that I would be responsible for cooling, protection, etc, but each of them would be smaller and (ideally) more configurable because the assumption is these aren't meant for end-users by themselves. I know MeanWell has PSUs like this, not sure about an inverter or charger or even where to look for such a thing.

What I'm toying around with is sort of a DIY "head unit" for a UPS that is very configurable. I don't think it's a commercial product, but a thing I want for myself and maybe I make the design and BOM, and software available to others. To keep things easier, maybe a max of 500W? My own needs are maybe 300W.

One other thing that may make things simpler/harder: I've been assuming a double conversion UPS architecture because IMO it's overall simpler, there's no transfer switch, and it also filters the incoming AC, but maybe I'm wrong about that?

In any case, I'm looking for opinions, help, whatever. Maybe I should just find a lower power inverter/charger that I can add the arduino USB hack into?


  • DIY UPS.png
    DIY UPS.png
    2.3 MB · Views: 14
What’s the budget?

Just to point out:
Any ‘off-grid’ all in one inverter/charger will have the inverter/charger in one box.

Many will also have an internal transfer switch. I have not found the switchover objectionable in my ‘regular consumer’ use, ie my computers/internet radio/router/tv etc have not dropped out during transfer. Alas, it is not ‘double conversion’. There are a couple of ways to make it double conversion, though. The cheapest is simply to rectify your grid/mains ac and feed it to the mppt solar controller. I have done this and it is apparently fine! No issues so far. Yes the rectifier is technically an external component but it could be a fairly tiny one, small enough to mount ON the inverter itself. The other, bulkier way is to continue to use a separate charger as you already have.

Now, double conversion vs transfer switch aside, many of these all in one units will have ‘dry contacts’ which are a configurable switched output ostensibly to start a generator, but could be used for anything that falls under their current limit. The way this could be useful is that you can set these contacts to trigger any time the battery voltage falls below ‘float’ voltage. So for example your rv charger might float your batteries at 13.5 but if the grid power fails they’ll fairly quickly fall to 13.1 or 13.2, something like that. So you could use the dry contacts in such a way as to indirectly detect power failure by setting them to trigger somewhere between ‘charging’ and ‘resting’ voltages.

So i can see an all in one being more self contained and giving you a built in ‘trigger’ for your ‘shut down’ command. It also gives the option of a transfer switch OR double conversion (with a little extra work).
Re budget: dunno. I have something working now, I'd like to explore a project to make it more integrated. If I want an all-in-one solution already done, and money didn't matter, I'd buy an inverter charger from Victron.

What got me posting was I wondering how hard it would be to piece together my own thing with parts/modules, with an MCU or SBC running code I wrote to make it flexible. Assuming I have the right pieces in place, I could do my own display for amp-hours used/charge, time remaining, voltage, current load, etc. The key "extra" feature (which I have working now) that I must have is that "looks like a real UPS over USB. If I'm building a more generic solution, that's a standard that will be expected,

Your point about the dry contacts, relays, etc is interesting. If I find the right interter/charger, I could use the closed contacts a signal for various events.

Thinking about this more, I think I could frame it this way.
Option 1
I get an all in one unit like an inverter/charger, I open it up, then tap various locations in order to get current, voltage, accessible to an MCU which can provide my needed USB and maybe a network interface over wifi. I won't have total control over the inverter/charger via the MCU, but I will have monitoring.

Option 2
Find an MCU controllable CC/CV charger thing, then write the charge logic in the MCU. Then either get a fast-enough transfer switch or an inverter module I can fit in box with everything else, and use the MCU to control the transfer switch or at least a relay to control switch the inverter on/off (I'd use this for low-voltage cutoff). If I'm not using a transfer switch The CC/CV charger thing needs to be capable of running 100% duty cycle delivering about 300-500W.

Option 1 is easier, but I haven't seen "low" power inverter chargers. Things like in the 500VA range. Victron has a Multiplus in this range, but I think it is 240VAC input only and I'm in the US on 120VAC.
Following up with what I ended up doing:
I stayed with the existing gear in my OP (separate converter/charger, inverter, Arduino inside the converter/charger). I really wanted voltage monitoring to give a rough estimate of remaining battery, so I added some more modules to sense the DC power from the DC out terminals inside the converter/charger. Here's the Arduino and AC detector board as I originally installed them:

Arduino and AC Sensor 1.pngArduino and AC Sensor 2.png

To do DC voltage detection with the accuracy I wanted (1% change in remaining capacity can be as low at 10mV of difference), I ended up with an external ADC (ADS1115) and ensuring the Arduino GND was the same GND as the batteries I am measuring. I probably didn't *need* all of that, but it was a fun dive down a rabbit hole of Arduino things I haven't done before. This is the ADC, voltage divider and the DC buck regulator that powers the Arduino from the batteries.
Arduno power and  DC sensing.png

I mounted them on a quickly designed printed part so I could use dual-lock on the whole thing and mount it on the inside of the converter/charger cover.

I could definitely save some space by using individual components and either getting a PCB printed or mounting it on a prototyping PCB, but the modules were cheap and easy to use for prototyping and I just kept using them.
Here is project for you if you need something to do.

Use a current shunt an Arduino and contactor

Have the Arduino monitor the voltage drop across a shunt and if the current is higher or lower than the programmed value close the relay on the contactor.

Would need to have a way to zero the shunt or program the shunt resistance value so it would be accurate.

Here is a contactor to play with - but any contactor is basically just a relay with a normally open contact.

The idea being a way to have an independent monitor to be put inline with a battery string and have it disconnect if there is a short or the current exceeds a threshold.

There are things out there called shunt trips that do similar but they are not open source or cheap.