Open source UPS design

Share here your ideas for new projects
Post Reply
User avatar
mctom
Posts: 2744
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 368 times
Been thanked: 481 times
Contact:

Open source UPS design

Post by mctom »

Ha, honestly, I was wondering what the hell were you doing on the forum on Sunday morning 7AM (oh, right, that's 8AM in Romania).

Well your anecdote was a pain to read, sorry to hear that. My high school buddy later in his professional career got electrocuted by a construction worker who flipped some switches elsewhere in the building. I don't know the details how exactly that happened. Fortunately enough he survived. And my work colleague's dad, working at the national grid, told us a few stories of deaths of his colleagues. Always ignorance...

And back when Poland converted from 220V to 230V, my dad, being an IT guy for a few businesses back then, dealt with a few legacy, concentric 10Mbps Ethernet networks completely fried, all network adapters were dead, but fortunately nothing else. Those were replaced free of charge by 3com's lifetime warranty.
Across the country there were hundreds of incidents of destroyed equipment back then. Some villages and small towns lost all the equipment due to technician's errors and tapping them to >300V by mistake.

Whether I get to keep Internet connection during outage became intriguing - maybe the ISP's clutter has UPS after all.
Once the blackout covered all the area visible from my window - the construction crew elsewhere damaged the underground cable with an excavator (not their fault - it was an error in documentation). I had solar powered Christmas lights on my balcony, and people on the streets pointed at me saying he has power somehow. :D

Alright, alright, I'll make a UPS for my server..
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

hominoid
Posts: 788
Joined: Tue Feb 28, 2017 3:55 am
languages_spoken: english
ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
Location: Lake Superior Basin, USA
Has thanked: 108 times
Been thanked: 354 times
Contact:

Re: mctom's M1 home server for everything

Post by hominoid »

mctom wrote:
Mon Mar 06, 2023 6:52 pm
Alright, alright, I'll make a UPS for my server..
Please consider sharing the direction your headed with your UPS design. I'm interested and I'm sure some others are too.

User avatar
mctom
Posts: 2744
Joined: Wed Nov 11, 2020 4:44 am
languages_spoken: english, polish
ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
Location: Gdansk, Poland
Has thanked: 368 times
Been thanked: 481 times
Contact:

Re: mctom's M1 home server for everything

Post by mctom »

With a few assumptions I think this could be done with a few parts that everyone has at home. Right? :D
This is not the usual way of using 18650s so there are no off the shelf modules that could do any of that.

Since the batteries will be charged very rarely, and merely kept in their nominal 3.7V state, they can be charged really slowly. Thus no need for multiple stage, "intelligent" charging algorithm or whatever. Just push 22.2V at them, but not faster than some 50-200mA. All that could be done with a classic LM317.

Slowly charged batteries could get away with extremely slow balancing circuit, which would be a ladder of equal resistances - I'm thinking about 10k each. The power loss will be negligible.
To avoid the risk of over-discharging, in case the power outage extends over a week, we could go bourgeois and slap in another classic, TL431, a 2.5V reference in series to each resistor. This will prevent self-discharge below 2.5V.
By the way, the cheapo balancers off Aliexpress will not work in this circuit - they do balancing only when charging to the usual 4.2V point, not 3.7V standby voltage.

PFET ideal diode might be necessary if PSU is equipped with output discharge circuitry. Also, the auxiliary load that does not need backup, could be connected before this diode. In my case, the audio amp and heater fan (central heating will not work either).

Finally, UVLO is a block that acts as a diode and cuts off the batteries when they reach depletion. I'm not quite sure about the implementation details yet, probably two PFETs back to back.

Additionally a few status LEDs and an open drain logic output ("universal"), so someone could program their load to shut down gracefully.

Okay, whoever thinks of a good name for this project will get a free board..

This design will land on a stack of other PCBs that I have designed so far and will be ordered with the rest, business as usual.
Attachments
PSU.png
PSU.png (1.16 MiB) Viewed 747 times
Punk ain't no religious cult, punk means thinking for yourself!

Maintainer of PiStackMon

hominoid
Posts: 788
Joined: Tue Feb 28, 2017 3:55 am
languages_spoken: english
ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
Location: Lake Superior Basin, USA
Has thanked: 108 times
Been thanked: 354 times
Contact:

Re: mctom's M1 home server for everything

Post by hominoid »

I have an affinity for designs sketched on repurposed used paper. :)

hominoid
Posts: 788
Joined: Tue Feb 28, 2017 3:55 am
languages_spoken: english
ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
Location: Lake Superior Basin, USA
Has thanked: 108 times
Been thanked: 354 times
Contact:

Re: mctom's M1 home server for everything

Post by hominoid »

I have been thinking about the ideal UPS for a SBC NAS/server and have come up with the following:

Multi SBC support H3, HC4, M1
Multi voltage output 5v,12v,15v,19v
SATA power ports
19v or 24v input power
Host system power, temperature and battery status reporting
Small and standalone or drive bay mount
Easy battery maintenance

I did some work for another project with a 18650 battery holder. It might provide a starting point for a conversation about a small UPS battery holder-PCB case.
    battery_holder.png
    battery_holder.png (42.58 KiB) Viewed 693 times
      I also have a simple battery pack design that probably can be expanded for 2 more cells.
        battery_pack.png
        battery_pack.png (26.93 KiB) Viewed 693 times

        User avatar
        rooted
        Posts: 10037
        Joined: Fri Dec 19, 2014 9:12 am
        languages_spoken: english
        Location: Gulf of Mexico, US
        Has thanked: 788 times
        Been thanked: 587 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by rooted »

        I would love a UPS with those capabilities, I would use 21700 batteries though.

        User avatar
        mctom
        Posts: 2744
        Joined: Wed Nov 11, 2020 4:44 am
        languages_spoken: english, polish
        ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
        Location: Gdansk, Poland
        Has thanked: 368 times
        Been thanked: 481 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by mctom »

        That's certainly not a simple PSU I sketched above. :D But okay, let's talk.

        With 5V, 12V and maybe 3.3V outputs, all SBCs would be supported I think.
        What 19V output could be used for? A laptop maybe? This one may call for 8 batteries instead, if that output is really useful enough to justify that.

        And you're asking essentially for SMBus communication, so that calls for a battery nanny chip. The question is availability, which should be better than 2 years ago, but still not guaranteed.

        One more thing to consider is an input voltage - I think most users don't have 24V sources, so might as well introduce a boost converter and make it work with 10-20V range.

        If you could design and produce a case for that, I'd say we could make it all work.
        I think the case would be centered around the PCB, which would hold batteries and screw terminals on top, and electronics along with other auxiliary connectors on the bottom. Just like a floppy drive, could have a few LEDs on the front, and all connectors on the back.
        One important thing to solve on a case side is battery contacts, but IIRC you have researched this topic in the past as well. Would be nice to have contacts soldered directly to PCB, like those:
        18650-3P.jpg
        18650-3P.jpg (32.41 KiB) Viewed 681 times
        If the batteries were properly spaced apart, the same case and PCB could support both 18650 and 21700 batteries, just different battery contacts mounted.. Maybe?
        @rooted, have you ever seen a solution that accepts both battery sizes?
        Punk ain't no religious cult, punk means thinking for yourself!

        Maintainer of PiStackMon

        User avatar
        rooted
        Posts: 10037
        Joined: Fri Dec 19, 2014 9:12 am
        languages_spoken: english
        Location: Gulf of Mexico, US
        Has thanked: 788 times
        Been thanked: 587 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by rooted »

        I haven't seen anything workable which accepts both but they make little adapters for 18650 batteries to go in 21700 devices.

        This is one such adapter, it's made of silicone and brass.ImageImage
        These users thanked the author rooted for the post:
        hominoid (Sun Mar 12, 2023 1:20 am)

        User avatar
        mctom
        Posts: 2744
        Joined: Wed Nov 11, 2020 4:44 am
        languages_spoken: english, polish
        ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
        Location: Gdansk, Poland
        Has thanked: 368 times
        Been thanked: 481 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by mctom »

        18650 batteries are far more popular and easier to obtain, so I guess forcing all the 18650 users to buy adapters doesn't make much sense.

        However, spacing out the batteries appropriately, and an option to mount the same type of battery holders, just 5mm further apart, could easily be achieved.
        That's true only if the 18mm diameter clip works with 21mm cells just as well, or I manage to find different models with the same footprint.

        By the way...
        hominoid wrote:
        Sat Mar 11, 2023 10:37 am
        Small and standalone or drive bay mount
        I assume you meant 3,5" drive bay. That's a great idea, this would fit into many preexisting NAS cases.
        Punk ain't no religious cult, punk means thinking for yourself!

        Maintainer of PiStackMon

        User avatar
        rooted
        Posts: 10037
        Joined: Fri Dec 19, 2014 9:12 am
        languages_spoken: english
        Location: Gulf of Mexico, US
        Has thanked: 788 times
        Been thanked: 587 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by rooted »

        21700 is common and easily obtained here in the states at least, my reasoning for using them is the superior capacity and they are less expensive per mAh. They also handle more amperage on average and have very low internal resistance, even inexpensive Lishen brand are good but I prefer Molicel, Samsung, LG, or Sony.

        I wouldn't use adapters, it's not a workable solution for a pack. Perhaps this discussion should be split into a new topic?

        User avatar
        mctom
        Posts: 2744
        Joined: Wed Nov 11, 2020 4:44 am
        languages_spoken: english, polish
        ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
        Location: Gdansk, Poland
        Has thanked: 368 times
        Been thanked: 481 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by mctom »

        Yeah maybe my perspective is somewhat different because I own a lot of 18650s salvaged from obsolete laptops. They're all in good condition generally, except of those who suffered catastrophic failure beforehand.
        Since it's just a UPS that doesn't cycle the batteries back and forth all the time they don't need to be brand new really.
        That's why I'm looking into the possibility of giving the end user a choice.

        I think the realistic target would be 40W output, that's about 2A discharge rate from the cells.

        Yes, our favorite moderator has already been asked to split this thread.
        Punk ain't no religious cult, punk means thinking for yourself!

        Maintainer of PiStackMon

        hominoid
        Posts: 788
        Joined: Tue Feb 28, 2017 3:55 am
        languages_spoken: english
        ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
        Location: Lake Superior Basin, USA
        Has thanked: 108 times
        Been thanked: 354 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by hominoid »

        mctom wrote:
        Sat Mar 11, 2023 8:59 pm
        With 5V, 12V and maybe 3.3V outputs, all SBCs would be supported I think.
        What 19V output could be used for? A laptop maybe? This one may call for 8 batteries instead, if that output is really useful enough to justify that.
        15v is needed for the HC4 and H3. HK also recommends using 19v with 2 3.5" HD while other SBC or laptops could benefit as well.
        mctom wrote:
        Sat Mar 11, 2023 8:59 pm
        And you're asking essentially for SMBus communication, so that calls for a battery nanny chip. The question is availability, which should be better than 2 years ago, but still not guaranteed.
        It could be left unpopulated for those who don't want or need it. A simple LED or two on the PCB could be included regardless. The smart reporting is more of a nice to have thing for me.
        mctom wrote:
        Sat Mar 11, 2023 8:59 pm
        One more thing to consider is an input voltage - I think most users don't have 24V sources, so might as well introduce a boost converter and make it work with 10-20V range.
        I agree, everyone has an old laptop brink that might work.
        mctom wrote:
        Sat Mar 11, 2023 8:59 pm
        If you could design and produce a case for that, I'd say we could make it all work.
        I think the case would be centered around the PCB, which would hold batteries and screw terminals on top, and electronics along with other auxiliary connectors on the bottom. Just like a floppy drive, could have a few LEDs on the front, and all connectors on the back.
        One important thing to solve on a case side is battery contacts, but IIRC you have researched this topic in the past as well. Would be nice to have contacts soldered directly to PCB, like those:
        I don't see any impediments at this point and having strong metal battery holders is the way to go IMO.

        User avatar
        mctom
        Posts: 2744
        Joined: Wed Nov 11, 2020 4:44 am
        languages_spoken: english, polish
        ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
        Location: Gdansk, Poland
        Has thanked: 368 times
        Been thanked: 481 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by mctom »

        Here's the idea as of today.

        So I guess the only way to do this reliably is to convert any incoming voltage into a battery voltage, and then convert it again into a few output voltages. This sucks because energy is converted twice, and losses add up.
        Would be nice to avoid that, but I can't find a way to do that with such broad spectrum of requirements.

        I'm guessing 5V and 12V outputs are a baseline solution to have that SATA and USB power outputs, and to meet demands of many SBCs. Perhaps the third power output could be adjustable to equal the input voltage, so it could be passed directly from the power source and backed up only if necessary. Yes that could reduce losses significantly.

        But anyway back to what I've sketched, I determined that 4x2 cells would be optimal for a few reasons (mainly converter design). Another options include 3x2 or 3x3, but it all depends on how many cells can we even fit into an old HDD. Honestly I don't know what's the typical length of a HDD bay, but I assumed that having 8 cells should be doable.

        Having 6 - 8 cells in series is also on a table, which could help simplify input converter (the discrete component monstrosity invented for this purpose), with float voltage always higher than any input voltage from allowable range.

        If @hominoid could determine how many cells can we fit into the enclosure, that'd be great. :)

        A single resistor could be used as an effective way of ensuring slow and steady cell charging. Value could be tweaked later on.
        Furthermore, there's a "diag" signal that allows easy device diagnostics. Positive voltages would indicate charging, with lower values as the battery gets closer to being fully charged. Negative values would always mean discharging. That's the input for basic signaling with LEDs or whatever.

        All diodes may be replaced with ideal diodes where feasible and necessary. That's another argument behind high voltage battery stack (many cells in series), as drops on diodes bear smaller significance when dealing with high voltages.
        Attachments
        signal-2023-03-12-212852_002.jpeg
        signal-2023-03-12-212852_002.jpeg (165.88 KiB) Viewed 560 times
        Punk ain't no religious cult, punk means thinking for yourself!

        Maintainer of PiStackMon

        User avatar
        rooted
        Posts: 10037
        Joined: Fri Dec 19, 2014 9:12 am
        languages_spoken: english
        Location: Gulf of Mexico, US
        Has thanked: 788 times
        Been thanked: 587 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by rooted »

        3.5" HDD = L 146.05mm x W 101.6mm x H 25.4mm or thereabouts.

        8 x 18650 may barely fit at 144mm but I don't think so, that's not much tolerance left over.

        hominoid
        Posts: 788
        Joined: Tue Feb 28, 2017 3:55 am
        languages_spoken: english
        ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
        Location: Lake Superior Basin, USA
        Has thanked: 108 times
        Been thanked: 354 times
        Contact:

        Re: mctom's M1 home server for everything

        Post by hominoid »

        There is room for drive connectors that can be used too. A typically connector is about 20mm plus space for a wire bend radius of 5mm, so 25mm or more. By changing the configuration it becomes easier for them to fit in a 3.5" drive space. This is with 6mm between cells. I believe it can be done, it's a matter of finding the right holders or designing one that fits.
          drive_battery_layout.png
          drive_battery_layout.png (16.32 KiB) Viewed 533 times

            User avatar
            mctom
            Posts: 2744
            Joined: Wed Nov 11, 2020 4:44 am
            languages_spoken: english, polish
            ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
            Location: Gdansk, Poland
            Has thanked: 368 times
            Been thanked: 481 times
            Contact:

            Re: mctom's M1 home server for everything

            Post by mctom »

            Right, but that leaves no room for connectors at the top or bottom. Unless both cell holders and all inputs/outputs could be surface mounted, which doesn't sound likely.

            I imagine there also must be some room on the sides for mounting holes, can't tell how much.

            Let's assume 6 cells would be enough, even crappy 2Ah 18650 cells would add up to 40+ Wh in this configuration.
            Punk ain't no religious cult, punk means thinking for yourself!

            Maintainer of PiStackMon

            hominoid
            Posts: 788
            Joined: Tue Feb 28, 2017 3:55 am
            languages_spoken: english
            ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
            Location: Lake Superior Basin, USA
            Has thanked: 108 times
            Been thanked: 354 times
            Contact:

            Re: Open source UPS design

            Post by hominoid »

            Ok, here is one approach with a 90mm x 145mm PCB. I don't know how much room is needed for discrete components but the PCB is on standoffs so the bottom could be used or the batteries could go on the bottom. I had one other thought too, what do you think about two 12v fan headers that maybe could also have a pot for manual speed adjustment. It's another thing that there never is enough of for server case cooling.
              ups.png
              ups.png (42.3 KiB) Viewed 460 times

              User avatar
              rooted
              Posts: 10037
              Joined: Fri Dec 19, 2014 9:12 am
              languages_spoken: english
              Location: Gulf of Mexico, US
              Has thanked: 788 times
              Been thanked: 587 times
              Contact:

              Re: Open source UPS design

              Post by rooted »

              That looks like something which would work.

              User avatar
              mctom
              Posts: 2744
              Joined: Wed Nov 11, 2020 4:44 am
              languages_spoken: english, polish
              ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
              Location: Gdansk, Poland
              Has thanked: 368 times
              Been thanked: 481 times
              Contact:

              Re: Open source UPS design

              Post by mctom »

              This, excellent! Will it fit 21700 cells as well?
              One thing to note, cells will be connected in series, so 3D-printed separators would make a lot of sense, especially for those metal contacts.

              The electronic components will be relatively flat except inductors - those can be flat too but at extra cost which would be nice to avoid if possible.
              Let's say wee need about 6mm clearance for bottom side components. The surface is abundant.
              I'll keep all SMD components on the bottom exclusively to make assembly easier - except the temperature sensor which will land somewhere between the cells.

              I'd say we need more space for outputs and controls:
              - Input (barrel jack)
              - 5V output
              - 12V output
              - Vin output whatever the input voltage is
              - Raw battery output (for user-provided voltage converter, or where voltage doesn't matter that much)

              - USB
              - SATA power
              - Fan outputs
              - LEDs
              - DIP switches for some basic configuration (if needed)

              Perhaps a daughter board with a second layer of connectors would make sense, with flat jacks on the bottom (USB, SATA, fans).
              Another problem is an access to screws in screw terminals once the UPS is mounted in place. Maybe screw terminals aren't the best option here.
              Whatever this thing is called.

              Image
              Punk ain't no religious cult, punk means thinking for yourself!

              Maintainer of PiStackMon

              User avatar
              rooted
              Posts: 10037
              Joined: Fri Dec 19, 2014 9:12 am
              languages_spoken: english
              Location: Gulf of Mexico, US
              Has thanked: 788 times
              Been thanked: 587 times
              Contact:

              Re: Open source UPS design

              Post by rooted »

              I like the daughterboard idea since this increases flexibility greatly, but wouldn't that add substantial (relative) cost?

              User avatar
              mctom
              Posts: 2744
              Joined: Wed Nov 11, 2020 4:44 am
              languages_spoken: english, polish
              ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
              Location: Gdansk, Poland
              Has thanked: 368 times
              Been thanked: 481 times
              Contact:

              Re: Open source UPS design

              Post by mctom »

              rooted wrote:
              Wed Mar 15, 2023 2:34 am
              I like the daughterboard idea since this increases flexibility greatly, but wouldn't that add substantial (relative) cost?
              Naaah... :) Nothing compared to the components on them.


              And now please allow me to drop a rubber duck post, let's see if everything is in check.

              So we have 12-24V output. This is because everyone has 12V supply, and I have 24V PSU. :)
              In fact, it may even work with 5V input too, but what.. who.. why..

              The fortunate fact about 6 cell stack is that 4V float voltage per cell should be OK - that means the battery charging circuit will be reduced to a boost converter (TBD).
              However, there must be some sort of overvoltage protection - probably a PFET switch, the same as with undervoltage protection of the battery itself.

              3V is a typical voltage of a depleted cell - that adds up to 18V. This renders the 5V and 12V outputs business easy - Buck converter for each of them.
              5V converter should probably be 4A to support Odroid XU4 - a 5A-capable AP64501?

              12V converter, I say 3A, so N2+ / N2L will work well and should spin up that SATA drive as well. I have no first hand data on HDD spin-up and the Internets are again not conclusive. AP63300 that is. Or the 5A options listed above, doubling the price.

              And then, the "configurable" output. The idea is to have one output that nominally should be sourced straight from the input. If input fails, should be backed up by the battery. The challenges are:
              - How to determine the nominal output voltage (pot? switches? "intelligent" auto-discovery?)
              - ORing without ridiculous diode losses (PFET contraption, dedicated ORing driver <- expensive, or maybe just.. diodes? )
              - Is 18V max (actually 17ish V) good enough? This will only happen when the battery is near depletion though. Most of the time 19V should be present.
              This output should be 3A max. Yeah I guess H3+ could use more current than that, but the cells won't like such rate of depletion (2A would be more dignified TBH)

              Fans, I don't know.. Another converter for each doesn't make sense (passives will be more expensive than the controllers). Either a 34063 hack, or 555 driven PWM contraption, or a linear regulator with a single transistor.. Depends whether the target current is 100mA or 1A.

              Battery UVLO: a PFET driven by a comparator. There's no immediate danger if it engages a few hundred milliseconds too early or too late.

              Input protection: Protection against overvoltage (very bad), but also reverse current if the external PSU doesn't like being supplied when it's off (Smart Power 3 :roll: ). And also, reverse input polarity.
              A diode would be nice, but can we afford a 0.3V drop? I guess we can, that's a 2.5% loss at 12V input after all, and even less with higher input voltage.
              The overvoltage protection might work just like the battery UVLO, except it should impose a little delay. This way it will not turn on when the input voltage rises slowly and above the allowed input voltage level.
              After the input Boost converter is selected, this might serve as a protective measure to some extent.
              Diode: SBRT10U50SP5
              Punk ain't no religious cult, punk means thinking for yourself!

              Maintainer of PiStackMon

              User avatar
              rooted
              Posts: 10037
              Joined: Fri Dec 19, 2014 9:12 am
              languages_spoken: english
              Location: Gulf of Mexico, US
              Has thanked: 788 times
              Been thanked: 587 times
              Contact:

              Re: Open source UPS design

              Post by rooted »

              That's all greek to me, not familiar with electrical components unfortunately.

              User avatar
              odroid
              Site Admin
              Posts: 40816
              Joined: Fri Feb 22, 2013 11:14 pm
              languages_spoken: English, Korean
              ODROIDs: ODROID
              Has thanked: 3098 times
              Been thanked: 1709 times
              Contact:

              Re: Open source UPS design

              Post by odroid »

              Interesting idea and discussion.

              I wonder how the SBC will monitor the AC input status and battery state of charge and energy level.
              Will it be equipped with an MCU with a built-in USB interface something like this?
              https://wiki.odroid.com/odroid-xu4/appl ... _minidcups

              hominoid
              Posts: 788
              Joined: Tue Feb 28, 2017 3:55 am
              languages_spoken: english
              ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
              Location: Lake Superior Basin, USA
              Has thanked: 108 times
              Been thanked: 354 times
              Contact:

              Re: Open source UPS design

              Post by hominoid »

              So here are two different PCB layouts, one that leans towards drive bay mounting and the other that might be better for a standalone unit making the USB and LEDs available in the front for easier access and the SATA at the rear.
                ups_layouts.png
                ups_layouts.png (77.12 KiB) Viewed 401 times
                  I did more investigation into using the 21700. The 18650 circular clips work from 16mm-19mm and the 21700 clips work for 20mm-21mm and they have different foot prints. Both thru-hole and smt clips are available for the 18650 but only smt clips for the 21700 right now. Bottom line is one clip will not work for both cell sizes.

                  With that said, more investigation is needed to see if the 21700 will fit on the current PCB. They definitely have considerable more power for 5mm more in length and 3mm more in diameter.

                  18650 - 1P Battery: 2.0Ah–3.0Ah (36 Wh–54 Wh)
                  3.14(9 x 9)(65) = 16,532 cubic mm

                  21700 - 1P Battery: 3.0Ah–4.0Ah (54 Wh–72Wh)
                  3.14(10.5 x 10.5)(70) = 24,233 cubic mm

                  I think keeping it to one PCB board is the best solution unless there is a compelling reason, it’s looking doable, and we’ll see if the 21700 cells will work.
                  Regarding those removable terminals, I would recommend staying away from them for this application. I and many others have had bad experiences with them.

                  At the beginning of the REPRAP days the RAMPS board used them and after a few fires they changed to the fixed type. For the first couple years mine were ok but eventually had a melt down. After replacing them and having the same thing happen a couple more years later I replaced all of them with the fixed style too. One of the problems is that thicker wires put a lot of stress on the plug and pins if they are moved and they can easily become damaged overtime.

                  The pig tail is easily connected before installation and I personally don’t see needing access to them once installed and in some applications they will be accessible anyway. It might be a minor inconvenience for some but if there is a better solution I’m open to it.

                  I will see what if anything can be done with the 21700 next. At the end, I think having a case design for drive bay use and one for standalone application is needed too.

                  @odroid, no AC is being used, input power is 12-24 DC. I had host system reporting on my wish list but I think we are headed towards keeping it as simple as possible. We'll have safe guards of course, but we'll see what @mctom has to say and how the project evolves.

                  User avatar
                  odroid
                  Site Admin
                  Posts: 40816
                  Joined: Fri Feb 22, 2013 11:14 pm
                  languages_spoken: English, Korean
                  ODROIDs: ODROID
                  Has thanked: 3098 times
                  Been thanked: 1709 times
                  Contact:

                  Re: Open source UPS design

                  Post by odroid »

                  hominoid wrote:
                  Wed Mar 15, 2023 12:39 pm
                  @odroid, no AC is being used, input power is 12-24 DC. I had host system reporting on my wish list but I think we are headed towards keeping it as simple as possible. We'll have safe guards of course, but we'll see what @mctom has to say and how the project evolves.
                  My question was how to check the existence of the input DC power. It is equivalent to an AC blackout :)

                  hominoid
                  Posts: 788
                  Joined: Tue Feb 28, 2017 3:55 am
                  languages_spoken: english
                  ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
                  Location: Lake Superior Basin, USA
                  Has thanked: 108 times
                  Been thanked: 354 times
                  Contact:

                  Re: Open source UPS design

                  Post by hominoid »

                  Yeah, I'm going with...it's late here and past my bed time. :P

                  User avatar
                  mctom
                  Posts: 2744
                  Joined: Wed Nov 11, 2020 4:44 am
                  languages_spoken: english, polish
                  ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                  Location: Gdansk, Poland
                  Has thanked: 368 times
                  Been thanked: 481 times
                  Contact:

                  Re: Open source UPS design

                  Post by mctom »

                  Thank you guys for all your input and comments. :)
                  My post was also published past my bedtime, so there is one major issue with this train of thought: The battery has no serious protective measures, against thermal and internal failures.
                  There are also no reasons not to use the actual battery charging circuit at this point, if I find anything suitable for this use case.

                  @odroid I plan to include a few status LEDs and a pin header with the same signals (open collector -> universal across all logic levels). That's actually another reason to include a serious battery charging circuit instead, that could report battery charge and so on, via I2C / SMBus. In that case, I think Qwiic connector would be the most accessible approach.
                  One thing that worries me about the charger ICs is that they often require a host computer to inject configuration to them on startup - I'd rather avoid that.
                  But to answer the question directly, AC blackout will be detected, one of the reasons being an ideal diode on one of voltage outputs. The signal will be provided to the user, this way or another, so they could initialize automatic shutdown.

                  @hominoid thank you very much for researching the topic. There is one good reason for using 21700 cells instead, as @rooted pointed out, which is lower resistance and higher output current which would make a difference with H-series and applications with many HDDs in general. Then we could source more amps from it with clear conscience.
                  Perhaps one way worth looking into is staggered battery layout, so they could be closer together without risk of contact between neighboring cell clips.

                  I was hoping all inputs and outputs could be placed on the front and back of the device - I assume the top won't be accessible once it's installed in a drive bay. Some flat SMD connectors, such as fans, SMBus, SATA, maybe even USB, could be placed on the bottom side of the PCB, letting us fit more connectors.
                  In the end I might as well ditch the USB output, as it wasn't really requested by anyone. :)

                  And of course your experience with removable screw terminals is enough for me to use fixed blocks instead. Perhaps I could find and use a smaller raster (~3.5mm) to save space, if the current rating is OK.
                  These users thanked the author mctom for the post:
                  odroid (Wed Mar 15, 2023 7:06 pm)
                  Punk ain't no religious cult, punk means thinking for yourself!

                  Maintainer of PiStackMon

                  User avatar
                  rooted
                  Posts: 10037
                  Joined: Fri Dec 19, 2014 9:12 am
                  languages_spoken: english
                  Location: Gulf of Mexico, US
                  Has thanked: 788 times
                  Been thanked: 587 times
                  Contact:

                  Re: Open source UPS design

                  Post by rooted »

                  What BMS do you think they are using here @mctom?

                  *edited*
                  Last edited by rooted on Wed Mar 15, 2023 5:32 pm, edited 1 time in total.

                  User avatar
                  mctom
                  Posts: 2744
                  Joined: Wed Nov 11, 2020 4:44 am
                  languages_spoken: english, polish
                  ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                  Location: Gdansk, Poland
                  Has thanked: 368 times
                  Been thanked: 481 times
                  Contact:

                  Re: Open source UPS design

                  Post by mctom »

                  Can't tell, but probably something from an undisclosed vendor. :)
                  Whatever BMS they used, I think I'd rather find a reputable counterpart, no offense..

                  Yes, whatever I'll design makes no economic sense and I can't possibly compete with mass produced Chinese products with no certifications. Again, no offense intended, that's how things are.
                  Who knows, maybe with built in converters and logic, and no profit on my side, perhaps the end price will be somewhat comparable to the functionally equivalent bucket of ebay modules.

                  I think the point of this endeavor is to make a UPS specifically tailored to the needs of SBC community - you know, with typical output voltages, communication, logic, and all that in a 3,5" format that fits many server oriented cases.
                  Punk ain't no religious cult, punk means thinking for yourself!

                  Maintainer of PiStackMon

                  User avatar
                  rooted
                  Posts: 10037
                  Joined: Fri Dec 19, 2014 9:12 am
                  languages_spoken: english
                  Location: Gulf of Mexico, US
                  Has thanked: 788 times
                  Been thanked: 587 times
                  Contact:

                  Re: Open source UPS design

                  Post by rooted »

                  Oh yeah I'm not going to use this thing, I was just curious about the battery management it was using. I value safety over anything when it comes to charging lithium ion batteries.

                  Matter fact I'm removing the links so no one else does.

                  User avatar
                  mctom
                  Posts: 2744
                  Joined: Wed Nov 11, 2020 4:44 am
                  languages_spoken: english, polish
                  ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                  Location: Gdansk, Poland
                  Has thanked: 368 times
                  Been thanked: 481 times
                  Contact:

                  Re: Open source UPS design

                  Post by mctom »

                  Here's another idea to investigate:
                  domih wrote:
                  Tue Mar 14, 2023 7:38 am
                  Note: They bravely survived a massive power outage of 20+ hours (storms in California this winter) with the UPS miserably failing right away (dead UPS battery which I since replaced) so I did not have time to shut them down properly.
                  When the batteries are constantly kept charged up, there's no way of telling whether they still have reasonable capacity or degraded silently over time.
                  Perhaps there could be a manual test mode of some sort - force work off the batteries, and go back to DC input when the batteries are depleted. Batteries will do the full cycle and so their capacity may be calculated again.
                  These users thanked the author mctom for the post:
                  domih (Thu Mar 16, 2023 12:22 am)
                  Punk ain't no religious cult, punk means thinking for yourself!

                  Maintainer of PiStackMon

                  User avatar
                  domih
                  Posts: 652
                  Joined: Mon Feb 11, 2019 4:48 pm
                  languages_spoken: English, French
                  ODROIDs: UX4, HC2, N2, N2+, H2, H2+, C4, HC4, M1, H3, H3+ - 1GbE, 2.5GbE, 10GbE, 45+ GbE
                  Location: San Francisco Bay Area
                  Has thanked: 237 times
                  Been thanked: 206 times
                  Contact:

                  Re: Open source UPS design

                  Post by domih »

                  mctom wrote:
                  Wed Mar 15, 2023 10:58 pm
                  Here's another idea to investigate:
                  domih wrote:
                  Tue Mar 14, 2023 7:38 am
                  Note: They bravely survived a massive power outage of 20+ hours (storms in California this winter) with the UPS miserably failing right away (dead UPS battery which I since replaced) so I did not have time to shut them down properly.
                  When the batteries are constantly kept charged up, there's no way of telling whether they still have reasonable capacity or degraded silently over time.
                  Perhaps there could be a manual test mode of some sort - force work off the batteries, and go back to DC input when the batteries are depleted. Batteries will do the full cycle and so their capacity may be calculated again.
                  Yes, if you use one UPS for one machine you can use 'apcupsd' or other daemon coming with the model to test the battery on a regular basis. However, I have a bunch of machines behind the same UPS, plus it's not a data center, plus I'm lazy, plus I just let the batteries die before replacing them. A "good" battery can last several years. In data centers, they replace the batteries way before they could fail.

                  User avatar
                  mad_ady
                  Posts: 11322
                  Joined: Wed Jul 15, 2015 5:00 pm
                  languages_spoken: english
                  ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
                  Location: Bucharest, Romania
                  Has thanked: 647 times
                  Been thanked: 1081 times
                  Contact:

                  Re: Open source UPS design

                  Post by mad_ady »

                  In data centers, they replace the batteries way before they could fail.
                  /me looks at our 15 year old dead rack ups'es and sobs - why can't we have nice things?
                  These users thanked the author mad_ady for the post:
                  domih (Mon Mar 20, 2023 5:38 am)

                  hominoid
                  Posts: 788
                  Joined: Tue Feb 28, 2017 3:55 am
                  languages_spoken: english
                  ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
                  Location: Lake Superior Basin, USA
                  Has thanked: 108 times
                  Been thanked: 354 times
                  Contact:

                  Re: Open source UPS design

                  Post by hominoid »

                  The 21700 cells worked out with a little messaging. The PCB increased by 4mm width to 94 x 145 with a 10mm height leaving 8mm clearance under the PCB. Two I2C connectors were added to the front. One for the host system and one user sensor.
                    open_ups_virtual_prototype-3.gif
                    open_ups_virtual_prototype-3.gif (3.8 MiB) Viewed 309 times
                      Almost everything is at the rear on the bottom of the PCB except the USB, FAN2, LED and 2 I2C ports, which are in the front. It looks like there is enough room to use a thru-hole mount for the rear terminal blocks. There is 3mm between cells currently and the cells still need to be stagger which will force the USB to the other side of the board. It is possible to put the USB on the bottom, any thoughts anyone? The power plug may be able to go on the bottom as well. I need to check clearances. Of all of the connectors, the power plug seems to make the most sense to keep on top, if any. The case opens to the bottom for unfettered access to the terminal block screws now solving that problem. At 35mm height, this may be as thin as it can be using 21700's but well worth it imo.
                      More to do but getting closer.
                        ups_bottom.png
                        ups_bottom.png (29.47 KiB) Viewed 309 times
                          These users thanked the author hominoid for the post (total 3):
                          odroid (Thu Mar 16, 2023 2:27 pm) • mctom (Thu Mar 16, 2023 5:21 pm) • domih (Mon Mar 20, 2023 5:39 am)

                          User avatar
                          mctom
                          Posts: 2744
                          Joined: Wed Nov 11, 2020 4:44 am
                          languages_spoken: english, polish
                          ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                          Location: Gdansk, Poland
                          Has thanked: 368 times
                          Been thanked: 481 times
                          Contact:

                          Re: Open source UPS design

                          Post by mctom »

                          The animated model clearly works and attracts a lot of attention, I was flocked by the colleagues at work asking what that is. :)

                          I say let's focus on 21700 design for now, and introduce 18650 compatibility later, if there is still demand for it.
                          It should be said this solution is clearly taller than typical 3,5" drives, with 21700 cells we won't be able to fit into a canonical HDD shape. The question is, how tall is still acceptable, more of a philosophical question really. Personally I don't use any case with dedicated 3,5" bays.
                          I feel that the bottom side PCB clearance is too large - if that's only because of a bottom side screw terminals I'll see if we could arrange something else. PCB may contain cutouts to make room for side mounts at no additional cost. The 5-6mm clearance should be enough for electronic components.

                          Excellent idea putting all the connectors on the bottom, will leave much more space to the cells, and make the labeling very clear.

                          The USB in theory should not be flipped upside down, because the standard says how the USB port should be oriented (so receptacles fit with the USB logo facing up). See, another reason to get rid of that USB port. :)

                          Remember about the fan pots. :) What's the maximum current a fan output should support?

                          EDIT: I selected 3.8mm high inductors for the preliminary design, and that should be the tallest electronic component we'll use.
                          Punk ain't no religious cult, punk means thinking for yourself!

                          Maintainer of PiStackMon

                          User avatar
                          mctom
                          Posts: 2744
                          Joined: Wed Nov 11, 2020 4:44 am
                          languages_spoken: english, polish
                          ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                          Location: Gdansk, Poland
                          Has thanked: 368 times
                          Been thanked: 481 times
                          Contact:

                          Re: Open source UPS design

                          Post by mctom »

                          I designed 5V and 12V converters, with 5A and 3A capabilities respectively.
                          The good thing about these converters is that they include UVLO functionality within themselves, so they will shut down when battery voltage drops below 18V. It's almost certain they will not shout down at exactly the same time due to tolerances, but that's not a problem.

                          As I said before, I picked flat inductors with 3.8mm height (and 10x10mm footprint).

                          Now I set off to find some battery protection and balancers. So far I identified two options:
                          - BQ76942 series, which balance cells, monitors voltage, current and temperature, protects by cutting them off if necessary, reports through I2C or SPI, and can work autonomously after one time programming. Sounds great, but as most BQ series chips, it gets extremely complicated to deploy this in action. Datasheet is 76 pages long, and a separate Technical Reference document is another 200 pages, so unless someone is willing to dig through that mess, this is not happening.

                          - BQ77207 series, provides overvoltage, undervoltage and thermal protection to the stack of cells by cutting them off. A simple 12-pin chip (in ridiculous 3x2mm package but what can we do).
                          This will require additional balancers, but at least the battery pack will get a trustworthy protection to begin with.

                          I've got some more ideas but instead of describing them here I'll run some simulations first.
                          Punk ain't no religious cult, punk means thinking for yourself!

                          Maintainer of PiStackMon

                          hominoid
                          Posts: 788
                          Joined: Tue Feb 28, 2017 3:55 am
                          languages_spoken: english
                          ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
                          Location: Lake Superior Basin, USA
                          Has thanked: 108 times
                          Been thanked: 354 times
                          Contact:

                          Re: Open source UPS design

                          Post by hominoid »

                          After examining the BQ76942 and BQ77207 data sheets, I can appreciate your choice and for this application I thing the BQ77207 is the better choice. Looking online and at the hoard of 12v fans I have they generally use less then .2 amps. The newer ones use 100ma or less but some older fans I have use 140ma-160ma. I was also researching fan control IC’s and found one that might be interesting, the EMC2101-ACZL-TR.

                          The problem with lowering the PCB more isn’t the clearance under it but the interference it causes with mounting. I’m not sure there is another way for the drive bay mount but it will be possible with the stand alone case. More on this in a minute.

                          The cells have been staggered and some other components rearranged in this latest progression. Rheostats have been added and a lower profile barrel jack is now used which goes a long way in cleaning up and streamlining the rear layout.
                            open_ups_virtual_prototype-4.gif
                            open_ups_virtual_prototype-4.gif (4.31 MiB) Viewed 190 times
                              Along with the terminal blocks, the power jack and rheostats can be thru hole mounted. The JST-PH connectors may still need to be surface mounted, I can’t tell with this model. Most the components in this model are ubiquitous but there are a couple areas I had to try and make a reasonable choice regarding form and fit, mainly the power plug (PJ-063AH) and potentiometers.

                              Thumb-wheels at 200 rotation duty cycle didn’t make sense and there are a lot of rheostats to choose from. These 9mm pots have a 5000 rotation duty cycle, seemed to be reasonable quality for the price and are available in a wide range of values from CTS Electrocomponents and Bourns. But, there is lots of room on the PCB if something else is needed.

                              Spent some time to understand how the current height of the UPS would impact the Cloudshell4 cases. Since the Cloudshell4 has generous drive spacing it actually works replacing the lower drive in all CS4 series. The drive bay mounted UPS holder is the same tray design used for the 2.5” holder and the bottom of every CS4 case. This means there is a second mounting location as a replacement for the bottom of the case
                                Cloudshell4_hc4_ups.gif
                                Cloudshell4_hc4_ups.gif (84.14 KiB) Viewed 190 times
                                  It’s great that it will work for the CS4 series but that won’t be the situation for all NAS/Server cases. This is the importance of having a standalone case as well imo. I also think it opens up another use category for the benchtop or desktop. This is the basis of wanting to further discuss keeping USB power at the front of the UPS. I think it would be great to have a device on my bench that can literally power any SBC and includes UPS, SATA and FAN support.

                                  The cost is the price of the USB-C component and can be left bare for those who won’t use it for their use case. A switch could also be added to make a fixed +5v or +12v selection available even though they are a few dollars, but left empty it cost nothing. In light of the current USB-C PD situation with the most recent new SBC that use it, having a fixed +5v and +12v USB-C supply seems prudent for benchtop or desktop use cases but I can appreciate if this is too much project creep or simply falls outside the scope.

                                  User avatar
                                  mctom
                                  Posts: 2744
                                  Joined: Wed Nov 11, 2020 4:44 am
                                  languages_spoken: english, polish
                                  ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                                  Location: Gdansk, Poland
                                  Has thanked: 368 times
                                  Been thanked: 481 times
                                  Contact:

                                  Re: Open source UPS design

                                  Post by mctom »

                                  So my cat has discovered a keyboard shortcut for quitting Firefox mid-post!

                                  @hominoid, thanks for everything you've done in past few days. I know exactly how much work it takes to research the market and find a suitable part for a given application.

                                  Regarding a fan, that is an interesting fan driver. I was wondering myself whether such parts exist. But I don't think it will fit our application - it will work only with fans supporting PWM input (4-wire), or 5V fans in LDO mode. IT also takes orders via I2C only, which will require a host side daemon, or at least a microcontroller. If we assume uC, then we might as well implement PWM control of our own at lower cost and complexity. That's probably the reason why dedicated fan control chips aren't that popular.
                                  I think the fan control pots could in fact be smaller, cheaper components that require a screwdriver to set the desired output. I see it as a feature that would be only configured once during deployment.

                                  Which brings me to a reason why there must be room for a third pot. :)

                                  My current idea for voltage outputs is this: 5V, 12V and user-adjustable output in 12-19V range.
                                  If input voltage matches any output voltage within some 5% margin, it will be used directly. Otherwise, buck-converted from the battery. This implies a few features:
                                  - The UPS functionality will be assured by this behavior
                                  - This device may be used as a step-up converter, such as H3+ powered from 12V PSU
                                  - UPS will take over if the transient load current will exceed capabilities of the PSU
                                  - The input PSU must provide mean output power, not peak output power.

                                  Now speaking of the USB output, that's a great idea to save space with USB-C variant. However I cannot agree to a selectable output voltage - this is far from a compliant behavior and is way too risky to offer this functionality to end user. I'd rather do it properly and consider two options instead:
                                  - Fixed 5V output with 3A fuse
                                  - Do it properly with an IC such as IP6518 that supports myriad of fast charge protocols. A "more reputable" counterpart would be more welcome but I failed to find one with this many protocols and with a built-in Buck converter.
                                  By the way, I don't see a bright future for SBCs powered off USB-C. How is one supposed to deploy it in the field, or in the industrial setting? With a phone charger? :lol:

                                  And a note on case form factor - I think you must have missed my comment, that the PCB shape may deviate from a rectangle, and we could make cutouts for mounts. But that doesn't matter, because with 21700 cells there's no way to fit all that into a standard 3.5" bay anyway.
                                  What could be considered is to assume this device fits into two neighboring 3.5" bays in a typical sheet metal case - that would only require slits along the side walls, so the UPS could still slide into two bays. I'm not sure how feasible is this, or how probable of a use case scenario - who needs this UPS in a off-the-shelf server case?

                                  One final note - please also provide static screenshots of front and back - it's hard to inspect your renders in detail when the thing is spinning all the time :roll:
                                  Punk ain't no religious cult, punk means thinking for yourself!

                                  Maintainer of PiStackMon

                                  hominoid
                                  Posts: 788
                                  Joined: Tue Feb 28, 2017 3:55 am
                                  languages_spoken: english
                                  ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
                                  Location: Lake Superior Basin, USA
                                  Has thanked: 108 times
                                  Been thanked: 354 times
                                  Contact:

                                  Re: Open source UPS design

                                  Post by hominoid »

                                  I would rather have a discrete component based fan circuit, I was just tossing around ideas and looking at alternatives. The third pot is new so I understand them needing to be smaller. As far as use cases go, I would point out that some using manual variable speed control for case cooling would need to adjust it inter seasonally which is why I chose larger pots, that use a knob and are easier to adjust without tools. So more often then just at the initial deployment for some use cases. With that point and a plastic tweaker in hand, I’m OK with any choice you make.

                                  Regarding the USB-C, safety comes first and there is no availability I could see for the IP6518 at DigiKey or Mouser, so fixed +5v with a fuse sounds like a good choice.
                                  mctom wrote:
                                  Mon Mar 20, 2023 6:15 am
                                  And a note on case form factor - I think you must have missed my comment, that the PCB shape may deviate from a rectangle, and we could make cutouts for mounts. But that doesn't matter, because with 21700 cells there's no way to fit all that into a standard 3.5" bay anyway.
                                  Even with slots cut into the PCB in order to lower it, we are only gaining 2mm and it didn’t seem worth the trouble since it still left us far from 25mm. The only way to get to 25mm is with everything on the top of the PCB (cells=21 + PCB=2mm + case bottom=2mm) without a case top.
                                  mctom wrote:
                                  Mon Mar 20, 2023 6:15 am
                                  What could be considered is to assume this device fits into two neighboring 3.5" bays in a typical sheet metal case - that would only require slits along the side walls, so the UPS could still slide into two bays. I'm not sure how feasible is this, or how probable of a use case scenario - who needs this UPS in a off-the-shelf server case?
                                  I don’t understand, as it’s designed now, the ups in the holder should fit in any standard 3.5” drive bay other then 9.75 height, and because most sheet metal cases are open between bays, I don’t see a fitment problem. Could you elaborate more about what the potential issue is that your eluding to. Maybe you could do an animated spinning model. :D
                                    ups_4.png
                                    ups_4.png (87.59 KiB) Viewed 147 times
                                    These users thanked the author hominoid for the post:
                                    odroid (Mon Mar 20, 2023 9:55 am)

                                    User avatar
                                    rooted
                                    Posts: 10037
                                    Joined: Fri Dec 19, 2014 9:12 am
                                    languages_spoken: english
                                    Location: Gulf of Mexico, US
                                    Has thanked: 788 times
                                    Been thanked: 587 times
                                    Contact:

                                    Re: Open source UPS design

                                    Post by rooted »

                                    What about Type C which allows voltage set via button press and defaults to 5v? I have one of these little boards using this IC ( STUSB4500 I believe ) and it's great, unfortunately it does require a microcontroller so probably not an option.

                                    *edit*
                                    Nevermind, I wasn't thinking clearly as this is just the output and would need a more complex input side.

                                    User avatar
                                    mctom
                                    Posts: 2744
                                    Joined: Wed Nov 11, 2020 4:44 am
                                    languages_spoken: english, polish
                                    ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                                    Location: Gdansk, Poland
                                    Has thanked: 368 times
                                    Been thanked: 481 times
                                    Contact:

                                    Re: Open source UPS design

                                    Post by mctom »

                                    hominoid wrote:
                                    Mon Mar 20, 2023 9:50 am
                                    Maybe you could do an animated spinning model. :D
                                    I did my best :lol:
                                    3dgifmaker81318.gif
                                    3dgifmaker81318.gif (396.89 KiB) Viewed 127 times
                                    2023-03-20-180009_1009x930_scrot.png
                                    2023-03-20-180009_1009x930_scrot.png (38.16 KiB) Viewed 127 times
                                    Anyway, I was talking about these little shelf stubs that were present in computer cases, at least 20 years ago... Made it easier to hold a drive before screwing it in place.
                                    I browsed through some modern HDD racks online and they don't seem to have this feature anymore. That means there's no problem to solve. :)
                                    hominoid wrote:
                                    Mon Mar 20, 2023 9:50 am
                                    I would rather have a discrete component based fan circuit, I was just tossing around ideas and looking at alternatives. The third pot is new so I understand them needing to be smaller. As far as use cases go, I would point out that some using manual variable speed control for case cooling would need to adjust it inter seasonally which is why I chose larger pots, that use a knob and are easier to adjust without tools. So more often then just at the initial deployment for some use cases. With that point and a plastic tweaker in hand, I’m OK with any choice you make.
                                    Then I guess it would make more sense to place a microcontroller that PWMs the fans and stores user preferred settings in non-volatile memory. A trivial Bash script could upload PWM settings as two bytes sent via I2C. Heck, a daemon could control the fans in real time just as well.
                                    https://github.com/tomek-szczesny/gpio-fan-controller

                                    OR...
                                    Make it a separate module, that is a full featured fan controller. Perhaps more than two fans. Maybe temperature sensors and programmable target temperatures instead of fixed PWM. Reporting back monitored temperatures. Hardware wise it's all the same, just a microcontroller and a bunch of sockets around it.
                                    And then, saved space on UPS board edge could be turned into extra voltage outputs.
                                    I don't mean to nuke your idea if you think fan outputs on UPS is a way to go. It just occurred to me that the only thing fans have in common with UPS is 12V rail, which could be supplied externally.
                                    If you like the idea, we could design the fan controller separately. Better yet, that's a perfect newbie KiCAD + AVR project for someone who's interested in learning things with us.

                                    And speaking of the third pot, I was considering a microcontroller to manage the configurable voltage output with it.
                                    It would be intentionally volatile, though. We don't want to risk someone repurposing UPS configured at 19V with N2+.
                                    The micro would "learn" the input voltage and repeat it on a configurable output, until the battery is dead and everything shuts down.
                                    It's more complicated to make a Buck converter controlled by a microcontroller, but will be much more convenient for a user. No physical configuration required at all. Also AtTiny costs less than a decent pot, lol

                                    With all that in place, no pots would be required at all. Well, maybe a RESET tact switch somewhere.
                                    hominoid wrote:
                                    Mon Mar 20, 2023 9:50 am
                                    Regarding the USB-C, safety comes first and there is no availability I could see for the IP6518 at DigiKey or Mouser, so fixed +5v with a fuse sounds like a good choice.
                                    Let's leave it at that unless someone points out a similar chip or a better approach.
                                    Punk ain't no religious cult, punk means thinking for yourself!

                                    Maintainer of PiStackMon

                                    hominoid
                                    Posts: 788
                                    Joined: Tue Feb 28, 2017 3:55 am
                                    languages_spoken: english
                                    ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
                                    Location: Lake Superior Basin, USA
                                    Has thanked: 108 times
                                    Been thanked: 354 times
                                    Contact:

                                    Re: Open source UPS design

                                    Post by hominoid »

                                    lol, I had a good laugh when I saw your animation, thanks for that. :) I’m glad we have a similar sense of humor, though I’ll PM you about your animation skills… :D

                                    Ahh yes, the little holder tabs, I remember them now. Well, I’m sure there are a host of other ‘things’ that will present a challenge for some cases. Even more the reason to have a good standalone option too.

                                    I wasn’t keen on the idea of manual user configuration for the output voltage and like the auto sensing approach much better. I think it’s the right way to go and may solve the fan control issue too. I don’t think more then two fans are needed in the typical SBC NAS case so imo, a separate fan controller module seems like too much.

                                    Since most SBC have their own cooling fan, it could be reduced to only one fan for the case. Or, do away with both of them for an additional voltage at the rear for increased UPS function, I like that too. Like you said, there is power to do anything a user would want and there are small fan controllers already available.

                                    Let me think on that a little, one fan or dropping both. It would be nice to hear some other opinions. What additional voltage would be added?

                                    User avatar
                                    mctom
                                    Posts: 2744
                                    Joined: Wed Nov 11, 2020 4:44 am
                                    languages_spoken: english, polish
                                    ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                                    Location: Gdansk, Poland
                                    Has thanked: 368 times
                                    Been thanked: 481 times
                                    Contact:

                                    Re: Open source UPS design

                                    Post by mctom »

                                    I'll share some reasoning now, so get your rubber ducks ready.

                                    Yesterday I've been working on a boost converter which will act as a battery charger. Previous architectures assumed that Boost converter would be of substantial power, in order to charge the battery and handle the nominal load. I didn't like that right from the beginning due to losses over two unnecessary voltage conversions.
                                    And after the market research yesterday I concluded there are no boost converter chips that work with full input voltage range AND fulfill our power demands, and not cost way too much.
                                    After a failed attempt at making 34063 work like we want it to, now I'm looking into a possibility of using attiny204 (or equivalent), as a controller of the whole operation, including a boost converter. I've done some of that already in the past.

                                    It sounds like a reasonable solution, because we will end up with a microcontroller onboard anyway - somehow we wish to monitor the AC, control fans, probe the internal voltages and drive output buck accordingly, and many other things that could be done easily with a microcontroller.

                                    By the way, without a manual output voltage setting we lost the ability to boost input voltage, but nobody wanted it in the first place.

                                    So for now I foresee the following list of outputs. I wanted to add more, but then again I can't imagine anyone using them except of me.
                                    - 5V 5A
                                    - 12V 3A
                                    - Input voltage mirror, 3A

                                    Some secondary outputs, leeching from the primary oiutputs:
                                    - 2x SATA power, no protection
                                    - USB-C, 5V, with ESD protection and some 500-1000mA current limit (is this enough?)
                                    - Fan or fans, controlled via I2C, 12V 0.3A each, no protection

                                    And:
                                    - DC input with reverse polarity protection,
                                    - 2x I2C (connected in parallel for passthrough)
                                    - 2-pin header with alarm signal - so SBC won't have to poll for the alarm condition

                                    LEDs:
                                    - DC input
                                    - Alarm
                                    - Battery full

                                    Hm, I wonder if 12V 3A is enough for two SATA power outputs. Should I upgrade it to 5A?

                                    Right, I think this architecture requires a new drawing this evening.
                                    Punk ain't no religious cult, punk means thinking for yourself!

                                    Maintainer of PiStackMon

                                    hominoid
                                    Posts: 788
                                    Joined: Tue Feb 28, 2017 3:55 am
                                    languages_spoken: english
                                    ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
                                    Location: Lake Superior Basin, USA
                                    Has thanked: 108 times
                                    Been thanked: 354 times
                                    Contact:

                                    Re: Open source UPS design

                                    Post by hominoid »

                                    Looking at 3.5” SATA HDD data sheets, the WD Red Pro series is the only one I found so far to list peak power. they use 1.9A @ 12V peak according to the data sheet and they don’t list any 5V usage. The rest only list average watts and don’t differentiate between 5v and 12v. So it looks like 12V @ 5A is going to be needed for the SATA power.

                                    https://www.westerndigital.com/products ... #WD221KFGX

                                    IMO the USB-C should be able to run a typical +5V SBC from it which would require a higher current. It looks like the USB-C PD standard supports at least 5V @ 3A, examining the USB-C PD adapter I have on hand.

                                    I’m also wondering about the input voltage mirroring being limited to 3A. What happens when a 19V 7A supply is used for a H3+ with 2 HDD? Or, when someone tries to run more then one SBC using different voltages simultaneously.

                                    After some thought about the fans and the points that were made, I think we should go down to one fan or eliminate both of them, your choice. There are many options already to implement this function and it's hard to justify duplication just for convenience.

                                    Looking forward to seeing your new design approach.

                                    User avatar
                                    mctom
                                    Posts: 2744
                                    Joined: Wed Nov 11, 2020 4:44 am
                                    languages_spoken: english, polish
                                    ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                                    Location: Gdansk, Poland
                                    Has thanked: 368 times
                                    Been thanked: 481 times
                                    Contact:

                                    Re: Open source UPS design

                                    Post by mctom »

                                    Well then I guess it's time to address the output power topic.

                                    The industry's rule of thumb is that converter's power is proportional to its volume, at fixed cost. Now let's look at that 133W brick from HK..

                                    With every output power increase we envision here I'm getting increasingly worried about heat dissipation. Even at 90% efficiency, that 10% of 100W is a lot of heat that will accumulate inside the case.
                                    This is why I'm changing internal structure all the time, to increase efficiency, and decrease heat losses.

                                    Sigh... I guess we'll have to call my old nemesis to help us out.
                                    https://www.vishay.com/docs/75921/sic437.pdf

                                    This is a godsend buck converter that can do all that. Comes in 8A, 12A and 24A variants. With efficiency well beyond 90% (and 97% doable), we could just do all the outputs 8A and all go home.

                                    So what's the problem? Fig. 3 in the docs.

                                    I have a 8A Buck converter prototype here on my cork board, that I developed for a commercial PSU project, that ended up being cancelled. I never got this to work because I wasn't able to mount this chip. Everything was placed too close together (short traces and so on), I messed up the prototype and never even bothered testing it after I learned it was all pointless anyway.
                                    Well, I could dust it off and see how it works next weekend. If I get this to work, then I'll see how it looks cost wise. The converter itself is not much more expensive than that 5A part I selected earlier, but requires a lot of sophisticated passives. My prototype here has 20 ceramic capacitors, for example.
                                    And above all, I'll assess feasibility of using this chip in a hobby project.

                                    Regarding USB-C, 3A output sounds fine. Personally I'd even make it non-fused altogether. I guess that USB and 5V output should be viewed as the same output with two connectivity options (because that's what it is). So the global 5A limit will still apply.
                                    By the way, it's also a high time to question the current ratings of connectors that you've picked so far. From my experience, 40A connectors are hard to find, but we should be good with just 10A. :D

                                    Let's leave 1 fan output then, PWM configurable via I2C. A "standard" 4-pin fan header would be nice for completeness. If there are enough uC resources we may count and report revs as well.
                                    Punk ain't no religious cult, punk means thinking for yourself!

                                    Maintainer of PiStackMon

                                    hominoid
                                    Posts: 788
                                    Joined: Tue Feb 28, 2017 3:55 am
                                    languages_spoken: english
                                    ODROIDs: C2, C4, XU4, MC1, N1, N2, N2L, N2+, HC4, M1, H2, H3+
                                    Location: Lake Superior Basin, USA
                                    Has thanked: 108 times
                                    Been thanked: 354 times
                                    Contact:

                                    Re: Open source UPS design

                                    Post by hominoid »

                                    That is a really nice DC converter, especially for the price, and it’s available. We will see how your revival and evaluation goes, it does solve a lot of problems so I hope it works out. I think this is going to be a challenging build in the end regardless.

                                    The terminal blocks already support 10A, it’s why I chose them. The barrel Jack was rated for 8A and I found a similar one rated at 10A, JACK-C-PC-10A-RA. It is larger and more expensive but fits. Using a standard fan connector will protrude out the back at it’s current mounting location but I don’t see that as a problem necessarily. I still haven’t found a right angle shrouded version, if one is available. It could also be located were the FAN1 pot was prior, set back above the barrel jack.

                                    We will see were the design is after this weekend but I think thermals might only be a possible issue for some use cases in the end. This design covers a lot of possible configurations and multiple uses so I would expect some variability in the thermals. The stand alone version shouldn’t be a problem. Someone running dual 3.5” HDD will most likely require case cooling and the UPS will benefit. Smaller case configurations using 2.5” HDD won’t be using nearly as much power and things should run cooler anyway. Now I’m not saying there won’t be possible thermal issues, they just might for specific uses, but we will see were the power and efficiency of the design ends up. Just having proper passive ventilation might be all that is required.
                                      open_ups_virtual_prototype-5.png
                                      open_ups_virtual_prototype-5.png (89.59 KiB) Viewed 62 times

                                      User avatar
                                      mctom
                                      Posts: 2744
                                      Joined: Wed Nov 11, 2020 4:44 am
                                      languages_spoken: english, polish
                                      ODROIDs: OGA, XU4, C2, M1, H3+, SP3, Vu8M
                                      Location: Gdansk, Poland
                                      Has thanked: 368 times
                                      Been thanked: 481 times
                                      Contact:

                                      Re: Open source UPS design

                                      Post by mctom »

                                      Since those sic bucks support soft start and configurable current limits I'd limit their respective output currents if the preliminary tests show any signs of thermal issues.

                                      There will be problems anyway, common to all high efficiency Buck converters: Output voltage will not go above 0.9xVin, or more generally, will never reach Vin.
                                      I have spent surprising amount of time considering all operation modes, and to make the conclusion short, we still may need that 5A buck at the input mirror output or whatever we call it. And I think this is way more than enough for intended use, especially if the HDDs will be connected to UPS as well.

                                      Speaking of temperature concerns, the hottest parts of Buck converters are the switches, which in our case are integrated in Buck controllers. All of them have thermal protection, albeit at high levels such as 125 or 150C. The sole fact they are isolated from the batteries with flame retardant PCB should be adequate.

                                      I think 8A jack would have been sufficient, those ratings already assume some margin.

                                      Yes, I think the spot where pot once was is a great place for a fan connector. I'd avoid parts sticking out from the overall box shape if possible. If it makes things easier, a 3-pin connector will do just fine, with extra space for unused fourth pin. Fan plugs are backwards compatible with them. We won't be using the fourth pin for maximum compatibility.


                                      I think I'll create a project on hackaday.io, because I need a place where I can dump all the boring details for future reference. I deleted half of this post to make it somewhat bearable...
                                      Punk ain't no religious cult, punk means thinking for yourself!

                                      Maintainer of PiStackMon

                                      Post Reply

                                      Return to “The Ideas”

                                      Who is online

                                      Users browsing this forum: No registered users and 1 guest