[Nut-upsuser] Supporting a DIY UPS with minimal effort but maximum gain

Bill Gee bgee at campercaver.net
Thu May 16 12:13:03 BST 2024


Hi Kelly -

As an Arduino nerd, I am interested in this!  I am sure others on the 
list would be interested.  If nothing else, it would be nice to have 
some documentation in the archives.

I assume you set it up as an online system rather than a standby system. 
  Right?  If true, then the choice of inverter is fairly critical.  It 
has to be bomb-proof reliable.

What did you choose for battery voltage?  What is the power capacity of 
the inverter?

Which Arduino did you use?  All of my Arduino projects use the Pro Mini, 
though it would be quite easy to get some other model for this.

Thanks -
===============
Bill Gee

On 5/15/24 20:11, Kelly Byrd wrote:
> I put together my own DIY UPS,  it's a RV charger/converter, an 
> inverter, and some batteries. I use an Arduino and the HIDPowerDevice 
> library (https://github.com/abratchik/HIDPowerDevice 
> <https://github.com/abratchik/HIDPowerDevice>) to get it to talk to NUT. 
> Been working great for months!
> 
> The Arduino is connected to two modules:
> * AC detection circuit to measure mains power on/off
> * Voltage divider and an external ADC to get a reasonably good DC 
> voltage level for the battery which I turn into the a charge percentage.
> 
> This uses the USBHID driver in NUT and "just works" as long as you're 
> using NUT 2.8.2 or later. I used the example code in the HIDPowerDevice 
> library as a starting point for running on my Arduino.
> 
> I can share more specifics about the Arduino side of things off list if 
> you want, the NUT side of things is pretty boring and normal.
> 
> On Wed, May 15, 2024 at 3:27 PM Kiril Zyapkov via Nut-upsuser 
> <nut-upsuser at alioth-lists.debian.net 
> <mailto:nut-upsuser at alioth-lists.debian.net>> wrote:
> 
>     Hello,
> 
>     I found out about NUT just days ago while searching for a solution
>     for my home setup. After some digging through the interwebs, I come
>     to you with questions.
> 
>     I'm putting together a DIY 12V UPS, very similar to what this guy did:
> 
>     [1]
>     https://baldpenguin.blogspot.com/2015/10/diy-12v-ups-for-home-network-equipment.html <https://baldpenguin.blogspot.com/2015/10/diy-12v-ups-for-home-network-equipment.html>
> 
>     The objective is to keep a bunch of mini PCs and network gear online
>     for as long as the battery lasts and then provide a mechanism for a
>     graceful shutdown of my NAS and other appliances for which cutting
>     power would not be healthy. The project above is missing the
>     "connected" part. I want to get mine to play with NUT nicely. Other
>     prior art is this project:
> 
>     [2] https://github.com/xm381/Raspberry-Pi-UPS
>     <https://github.com/xm381/Raspberry-Pi-UPS>
> 
>     Mentioned in a previous thread here:
> 
>     [3]
>     https://alioth-lists.debian.net/pipermail/nut-upsuser/2018-August/011198.html <https://alioth-lists.debian.net/pipermail/nut-upsuser/2018-August/011198.html>
> 
>     A valid approach -- emulates an existing protocol on an arduino.
> 
>     Are there other similar projects that you know of? I found plenty of
>     "DIY UPS" projects, but none were "smart".
> 
>     I am able to put together firmware for some micro which will take
>     care of measuring voltages, currents, possibly also turn on/off
>     loads, serial or USB or IP are options. Not sure yet what hardware
>     features I'll put together, but this depends somewhat on the
>     approach for getting this thing integrated with NUT. PSUs and
>     batteries are already on the way, and my junk drawers have most
>     other parts I may need.
> 
>     So, options found so far:
> 
>     * Use genericups. Least favorite option, very limited features
> 
>     * Use the same approach as [2]. If I were to go that route -- which
>     is the best protocol to pick for emulation? I'm looking for
>     something simple, extensible/flexible and well-documented.
> 
>     But what I really wish was possible was the ability to describe my
>     device in some format, feed it to a generic driver in NUT and
>     profit. I see some efforts have been made in this direction, most
>     notably:
> 
>     [4]
>     https://github.com/networkupstools/nut/wiki/Data-Mapping-File-(DMF)
>     <https://github.com/networkupstools/nut/wiki/Data-Mapping-File-(DMF)>
> 
>     What is the state there? Is it usable for USB HID? Or, how hard
>     would it be to make it usable? Even a modbus description will do --
>     implementing the modbus server (yes, server, I'm being
>     politically-correct) over serial or even TCP is easy, if only there
>     was a way to dump a CSV with register descriptions in some magical
>     driver...
> 
>     And yet another approach which comes to mind is to implement my
>     driver as an external executable. This may be completely unfeasible
>     and stupid, and please let me know if it is. But, from what I
>     gather, drivers run in their own process and talk to the daemon via
>     a UNIX socket. Why not make it possible for the driver to be just
>     any executable, built/deployed outside of the NUT codebase? The
>     socket protocol seems simple enough, and this will allow for ...
>     creativity. It could be implemented in any language (including
>     scripting languages) and need not depend on anything NUT-specific,
>     other than maybe some common CLI interface and/or configuration.
> 
>     I'm hoping the NUT masters will have some insight. Thanks for
>     working on this!
> 
>     Cheers,
>     Kiril
>     _______________________________________________
>     Nut-upsuser mailing list
>     Nut-upsuser at alioth-lists.debian.net
>     <mailto:Nut-upsuser at alioth-lists.debian.net>
>     https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>     <https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser>
> 
> 
> _______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser



More information about the Nut-upsuser mailing list