Patriot UPS to Linux configuration

 
I rescued a Patriot UPS from the dumpster. The only problem was a dead battery. I found a
battery that was the same size and rating. After the battery was replaced the UPS started working. This UPS has a "dumb" serial interface. It uses the
control lines on the interface to indicate power loss and low battery.
  Linux has a utility called powstatd which monitors the serial port an initiates shutdown when a power fail occurs. Since I am running Ubuntu I use apt-get to install the UPS monitor.

Patriot model SPS450VA B
Patriot UPS

Here is the cable pin out

UPS interface DB9 connector pin PC serial port DB9 connector pin
1 shutdown the UPS when this pin is held high for 5 seconds 4 DTR - Held high to shut down the UPS when the computer shuts down
3 normally open switch connects to GND when power fails 8 CTS - When low issues an AC power loss warning
4 UPS GND 5 GND
5 normally open switch connects to GND when UPS battery is low 1 DCD - When low initiates computer shut-down
The PC serial port signal RTS (pin 7) is held high. I used this pin to pull-up CTS (pin 8). Connect a 10K ohm resistor from PC serial port RTS ( pin 7) to CTS ( pin 8). This will pull CTS  high until the UPS closes the power-fail switches. I bought the 10K resistors and DB9 connectors, male for the UPS and female for the PC at RadioShack. The resistors are connected to the PC DB9 connector. These signal levels do not meet the RS232 design guidelines. It works on my PC, your mileage may vary

Schematic of the UPS cable


linux cable schematic

Linux software configuration

install powerd
I installed powstatd by the command apt-get  install powstatd.

Connect the UPS to the PC using the cable you built
Connect a lamp to the UPS as a test load -not your PC-
Follow the man page directions for detecting your UPS signals and setting powstatd.conf
This is what I get with the Patriot UPS on /dev/ttyS0
powstatd -t


ssmith@ubuntu:~/powerd-2.0.2$ powstatd -t
powstatd: online (standalone), watching /dev/ttyS0.
CTS DSR DCD RNG   DTR RTS   STATUS
 1   0   1   0     0   1    OK
 1   0   1   0     0   1    OK
 1   0   1   0     0   1    OK
 1   0   1   0     0   1    OK
 1   0   1   0     0   1    OK
Here is my /etc/powstatd.conf
# Watch /dev/ttyS0
watch ttyS0

# CTS goes low when mains fail.
fail cts 0
# DCD goes low when battery is too low.
low dcd 0

# RTS must be set high at initialization.
init rts 1

# DTR is initially set low; pulling it high causes UPS to turn off if main
# power is gone.
init dtr 0
kill dtr 1

Return to homepage