[Nut-upsuser] Protocol for an Arduino based UPS

Charles Lepple clepple at gmail.com
Mon Aug 20 02:55:59 BST 2018


On Aug 19, 2018, at 3:31 PM, Glenn Ramsey <gr at componic.co.nz> wrote:
> 
> Hi,
> 
> I'm building a DIY UPS for a Raspberry Pi using a 12V SLA battery, charger, and
> an off the shelf 5V regulator. To monitor the battery level I'd like to use an
> Arduino or similar type device. Since the Arduino can have a serial over USB
> connection with the Pi I'd like to implement a protocol that can be used with NUT.
> 
> Does anyone know if something like this has already been done? The only thing I
> could find was this [1], but it doesn't look like there is a NUT driver. Maybe
> I'm not searching with the right terms?

I'm at a loss for the right search terms, and I know we had someone considering building a USB/HID version of what you are talking about. If there was indeed another discussion, it would probably be on the nut-upsdev lists:

https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev

A related UPS project (but I think they ruled out Arduino-class processors early): https://gitlab.com/esr/upside/wikis/external-interface

> 
> If I were implement a UPS protocol what would be the easiest one to implement
> that is already supported by NUT?

The Megatec/Q* protocols are fairly ubiquitous, so that might be where I would start.

You mentioned serial-over-USB - does the Arduino show up as a /dev/ttyUSB* node or similar on the Pi? The following assumes that it does.

blazer_ser has some test strings:

https://github.com/networkupstools/nut/blob/v2.7.4/drivers/blazer_ser.c#L73

but development has been moved to nutdrv_qx, which is the preferred driver to test against (though it is a bit more comprehensive, and perhaps less clear at first glance).

Protocol documentation: https://networkupstools.org/protocols/megatec.html


More information about the Nut-upsuser mailing list