Network UPS Tools (NUT)

The APC Back-UPS line of uninterruptable power supplies uses simple signaling to communicate  
when the unit is "on line" or "on battery". It also accepts an input signal to shut down.  
Both of these lines are standard RS-232 values. Additionally, the unit provides an open  
collector output that closes (pulls to ground) upon a "low battery" condition.  
Although it may be possible to use this output as-is, the "low battery" output  
will not conform to RS-232 voltage specification standards.Thus, I developed the following circuit to provide an RS-232 level output for the "low battery" signal.  
This has been tested only on my APC Back-UPS 400, but should work on other Back-UPS units.  
As can be expected, I accept no responsibility for what you do with this information  
or any results of using (or abusing) this information. It comes with absolutely no warranty,  
not even the implied warranty of fitness for a purpose.
PC pin assignments                                         UPS pin assignments25 pin  9pin                                                             9 pin8       1 CD -------------------------------------------- line fail output 220      4 DTR ----+---------------+-----------------+
                  |               |                 |
5       8 CTS ----)---------------)--------+        |
                  |               |        |        |
                  |               |        |        |
              [22k ohm]       |\  |        |        |
                  |           | \ |        |        |
                  |          3|  \|7       |        |
                  +-----------|+  \        |        |
                  |           |    \       |        |
                  |           |     \      |        |
                  |           |LM308N\-----+    [47k ohm]
                  |           |OP-AMP/6             |
                  |           |     /               |
              [22k ohm]       |    /                |
                  |       +---|-  /                 |
                  |       |  2|  /|4                |
                  |       |   | / |                 |
                  |       |   |/  |                 |
                  |       |       |                 |
                  |       |       |                 |        normally open
                  |       +-------)-----------------+--------- low battery 5
                  |               |                                 signal
                  |               |
7       5 SG -----+---------------)----------------------- ground (common) 4
                                 _|_
                                 \ / diode
                                 ---
                                  |
4       7 RTS --------------------+------------------------- shut down pin 1
The way this works is as follows:The op-amp is powered by the DTR and RTS lines from the PC. The DTR line provides the positive supply  
(approx. +10v) and the RTS provides the negative supply (approx. -10v). The two 22k ohm resistors  
create a voltage divider. This voltage (approx +5v) is hooked to the non-inverting input  
of the op-amp to about +10v. The 47k ohm resistor is used to pull up both the open collector  
output of the UPS and the inverting input of the op-amp. Since the inverting input  
will normally be at a higher potential than the non inverting input, the output of the  
op-amp will be held at the voltage of the negative supply, RTS (approx. -10v).  
When the UPS pulls pin 5 to ground, however, the inverting input of the op-amp will be at 0v,  
but the non-inverting input will still be at 5v. Thus, the output will swing to the other (positive) supply, DTR.Here is the cable signalling info that I used in the genericups.h file from the Network UPS Tools package:
        { "APC",
          "Back-UPS",
          "APC Back-UPS (Custom cable)",
          TIOCM_DTR,                            /* cable power: DTR             */
          TIOCM_CD, 0,                          /* online: CD off               */
          TIOCM_CTS, TIOCM_CTS,                 /* low battery: CTS on          */
          TIOCM_RTS             /* shutdown: RTS                */
        },