<div dir="ltr">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 (<a href="https://github.com/abratchik/HIDPowerDevice">https://github.com/abratchik/HIDPowerDevice</a>) to get it to talk to NUT. Been working great for months!<br><br>The Arduino is connected to two modules:<br>* AC detection circuit to measure mains power on/off<br>* 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. <br><br>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. <br><br>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. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 15, 2024 at 3:27 PM Kiril Zyapkov via Nut-upsuser <<a href="mailto:nut-upsuser@alioth-lists.debian.net" target="_blank">nut-upsuser@alioth-lists.debian.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<br><br>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.<br><br>I'm putting together a DIY 12V UPS, very similar to what this guy did:<br><br>[1] <a href="https://baldpenguin.blogspot.com/2015/10/diy-12v-ups-for-home-network-equipment.html" target="_blank">https://baldpenguin.blogspot.com/2015/10/diy-12v-ups-for-home-network-equipment.html</a><br><br>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:<br><br>[2] <a href="https://github.com/xm381/Raspberry-Pi-UPS" target="_blank">https://github.com/xm381/Raspberry-Pi-UPS</a><br><br>Mentioned in a previous thread here:<br><br>[3] <a href="https://alioth-lists.debian.net/pipermail/nut-upsuser/2018-August/011198.html" target="_blank">https://alioth-lists.debian.net/pipermail/nut-upsuser/2018-August/011198.html</a><br><br>A valid approach -- emulates an existing protocol on an arduino.<br><br>Are there other similar projects that you know of? I found plenty of "DIY UPS" projects, but none were "smart".<br><br>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.<br><br>So, options found so far:<br><br>* Use genericups. Least favorite option, very limited features<br><br>* 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.<br><br>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:<br><br>[4] <a href="https://github.com/networkupstools/nut/wiki/Data-Mapping-File-(DMF)" target="_blank">https://github.com/networkupstools/nut/wiki/Data-Mapping-File-(DMF)</a><br><br>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...<br><br>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.<br><br>I'm hoping the NUT masters will have some insight. Thanks for working on this!<br><br>Cheers,<br>Kiril</div>
_______________________________________________<br>
Nut-upsuser mailing list<br>
<a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank">Nut-upsuser@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
</blockquote></div>