[Nut-upsdev] UPS serial protocol

Rob Groner rgroner at RTD.com
Mon Nov 9 16:47:20 UTC 2015

> -----Original Message-----
> From: Charles Lepple [mailto:clepple at gmail.com]
> Sent: Saturday, November 07, 2015 12:39 PM
> To: Rob Groner <rgroner at RTD.com>
> Cc: nut-upsdev at lists.alioth.debian.org
> Subject: Re: [Nut-upsdev] UPS serial protocol
> On Nov 5, 2015, at 11:33 AM, Rob Groner <rgroner at RTD.com> wrote:
> >
> > Having dealt with the USB portion of our UPS, I’m now reviewing our serial
> port communication.  I’ve looked over some of the drivers in NUT to see how
> they handle it so I can get an idea of what the “standard” is for how to
> accomplish it.  I’d like to do something simple and human readable.
> The de facto standard is some variant of the Megatec protocol:
> The Phoenixtec (SOLA) protocol is similar:
> These two protocols (plus their spin-offs) are currently handled by the
> nutdrv_qx driver (and previously by blazer_ser). It auto-detects the protocol
> variants, so this is probably your best bet to get something supported out-of-
> the-box (although I realize you are planning to ship a NUT driver for the USB
> side).

Ya, I hadn't planned on supporting serial NUT as well as USB, but I now have time to devote to it.

> They are basically ASCII, but not self-describing. I guess it depends on your
> motivation for the human-readable part. There are a few more ASCII-based
> protocols where the command names are more verbose, but then you're
> hitching your wagon to a less-often-used driver.

I have an advantage, which is that I can sort of do both.  The hardware engineer on the project basically came up with his own means of talking to the UPS through serial, so I have to preserve that in some manner.  By adapting it some, it becomes a more readable and intuitive protocol ("!bv?" gets you battery voltage, etc).  But I don't see why I can't support that as well as a more concise protocol like the qx.  It seems pretty simple and straight-forward. 

> Until you get to the binary protocols like BCM/XCP, the serial port speeds
> tend to be slow (2400-9600). This is a cheap way to get noise resistance.
> Faster speeds go hand-in-hand with checksums.

Good point.  I'm going to change our default from 115200 to 2400.  I have commands in place that they can change the port settings if they need to.

> The nutdrv_qx/blazer_ser drivers implement the necessary status/command
> features for safely shutting down a system, plus some basic monitoring
> features and test commands. If your customers' desired feature list matches
> that, you should be all set.

The original requirements and customer feature list was handled a long time ago....it wasn't much.  I'm trying now to fill out everything else before we offer the UPS on our website to the "general public".  

Thanks for the help, that was good guidance.  I may need some more help when it comes to getting NUT to talk to the UPS via serial, as I haven't tried that before.  I know it should be straight-forward.

Rob Groner
Senior Software Engineer

RTD Embedded Technologies, Inc.
ISO 9001 and AS9100 Certified

More information about the Nut-upsdev mailing list