Serial Interfacing with a CyberPower UPS
By Jeff Mayes, October 2018
This all started when I decided we needed a UPS to integrate into our products and searched with the following criteria. Must be low cost, 300w, rack mounted, have batteries that load into the front and have a serial port. Of course APC and Tripp-lite were on top of the list but now they only have USB or dumb ports for connection plus cost was prohibitive. Now CyberPower comes into the picture, it fit all my requirements AND had a neat display to add to the WOW factor (more on the display later). Thinking I had found the perfect solution I ordered one and with great disappointment found it had a serial port that does NOT support serial data! CyberPower marketing their product as having a serial port was plain not accurate. In fact pins 2 & 3 (the data pins) of the port are not connected to anything!! The only functions available from that port are on/off hardwired signals for “Load on battery” and “Load on line”, it had one input to shut down the unit, not very functional at all. It did have a USB pot which DOES support data transfer but there is no published protocol and home-brew interfacing to USB is a major job which is why I ruled out the other UPS’s. However there was a port for a plug in optional network card which also could provide useful data but at a cost as much as the UPS which was not a cost efficient solution.
Needing to interface the UPS to our products I decided to reverse engineer the available ports. USB as mentioned earlier is very tricky and time consuming to make a driver for and would require a 3rd party microprocessor to convert it to serial so that is ruled out. The actual serial port is useless so that left only the network option port.
I ordered the network option board and joyfully found an internal simple 4 wire interface, gnd, v+, rx & tx which turned out to be good ole serial data in TTL form (and not even inverted). After some sniffing I easily found it communicated at 2400 baud and used plain English commands (mostly single keystrokes, wow!) If anyone has done interfacing to APC serial ports you will notice much similarity. I also found that since the rx/tx signals were positive polarity I could just wire them to a standard computer serial port without any drivers and get error free data communication (again WOW!).
Data I discovered included on/off line, line voltage, battery charge, load percentage, estimated battery life, frequency and MORE! Functions that could be sent include Battery quick test, Battery Deep test, UPS shutdown and UPS reboot (the latter will shut down the ups for a few moments and turn it back on, perfect to remote reboot the equipment)
Now that I found the interface I needed to make it easy to connect to the UPS, I need this solution for many installations so it became apparent that a slide in board that would fit just like the option board with a DB9 serial connector was the best solution. I needed to order a large quantity of boards to make them cost efficient so I have extras!!
As I said earlier I am running directly from the TTL port to a computer RS232 port, not 100% proper but works great for short runs. I decided for situations where there needs to be a long run of cable or if your just too geeky to get over putting TTL into a RS232 port I put a driver circuit on the board that can be optionally added. By adding a MAX2232 some caps, 5v lp reg and cutting 2 traces makes it a fully compliant RS232 interface.
I am making the boards available on Ebay and my website (jmayesdeals.com) for $29 complete with connector or $39 with the driver circuit added. Any CyberPower UPS that will accept a RMCARD202 or RMCARD205 network card should work. Want to roll your own? Read on for all the info you will need.
CyberPower UPS Network card internal serial protocol
Serial Setup: 2400 Baud, No Parity, 8 Bits, 1 Stop bit. (2400,N,8,1)
Commands sent to the UPS must end with x0D (CR)
Data responses start with “#” and end with x0D (CR)
Basic UPS Commands
|Command to UPS (Add CR,x0D)||Result|
|S(0x2E)1||turn off now|
|TL||Deep battery test|
|CT||Cancel deep battery test|
|S03R0003||Reboot in 3 (minutes)|
|S03||Shutdown in 3 minutes|
|C||Cancel reboot or shutdown|
|C7:1||Turn buzzer on|
|D||# I116.0 O116.0 L000 B100 F060.0 R100 S€%À€€ (Spaces added for readability)|
|Unrecognized cmds||#-3 (error)|
Everything above is pretty self evident the “(0x2E)” is the hex 2E char that needs to be inserted. The “D” command provides all the dynamic data from the UPS. The UPS will NOT push any data, you must poll the UPS (every 3 seconds works nicely) using the D command to receive the data. Next you must parse the received data watching for the identifiers which are again plain English I,O,L,B,F,R,S the last 5 bytes of data are the on/off flags that provide on/off online/offline, etc status. See the tables below.
“D” command breakdown
|#I116.0O116.0L000B100F060.0R100S€%À€€ (37 bytes total)|
|R||030||3||Run Time Minutes|
The 5 status bits of the “D” string indicate various on/off conditions of the UPS such as on-line, line failure, running, etc. Most of the bits stay static, the only meat I found was in the first two bytes and is detailed below. If anyone finds more information please email and I will update the page.
The normal running online state of the status bits (In Hex) are 0x80,0x84,0xC0,0x88,0x80
Status Bytes 1 & 2 Definitions
|s1-16||0||UPS Good = 0|
|s1-32||0||Line Fail = 1|
|s1-64||0||Batt Low = 1 (Immanent Fail)|
|s1-128||1||UPS Testing = 0|
|s2-4||1||UPS Running = 0|
There are additional commands to read out static info from the UPS such as Model, Serial#, Load rating, Etc. I did not need any of this info for my project so this is not a complete reference, again if anyone can add to this you are welcome to email me your results and I will update this page as needed.
Static Info Commands
|P2||#0500,0300,120,057,063||VA, W, V,min fq, max fq|
|P4||#OR500LCDRM1U,BF00701ICM1,000000000000,CyberPower||Model, Firmware, ?, Manf|
|P5||#120||? (3 responses)|
Net card connector (looking in the card box) (J2)
08642<–Pin #’s (0=10)
Net Card Connector To PC RS232 Connections
|J2 (UPS)||Description||J1 (to computer)|
|2||input (to ups)||–>DB9p3 (TX)|
|3||output (from ups)||–>DB9p2 (RX)|
|7||? Connected but not used|
|0||nc (display mod) 10k||–> DB9p7 (RTS)|
Available Plug in Interface Boards From Ebay and JmayesDeals.com
|Basic Interface with no Driver $29.00||Full Interface with RS232 Driver $39.00|
Finally “The Display”
There was another disappointment here in that the display would only come on during an “Event” or when you first plug it in, during regular operation is would be off and black. You are required you to hit a button to bring it on and check status by repeating the button push’s. Not so much WOW factor in that!!! I found no software work-around, no commands would tickle the display unless I kicked the ups into action which was out of the question for normal use. After much contemplation I came up with a Hardware hack where by adding one wire internal to the UPS and a 10k resistor on my board I could pulse the RTS pin of the serial interface and simulate a push of the front panel button thereby bringing on the display and changing modes to add action to the readout. Below are pictures of the Hack on a OR500L ups (other models may be slightly different). This is completely optional and you MUST be able to do internal soldering work and pulse the RPS pin with your software, I do it along with the “D” command every three seconds. It keeps the display on and cycling through the available screens so anyone looking at the setup sees some action.
|Wire to add for Display hack||Connect Wire to Pin 2 of the card connector|
|Connect wire to “Orange” wire of display connector|
Hope this helps someone out!
Jeff Mayes, Jmayes Engineering, Jmayes.com. JmayesDeals.com, email@example.com