How to make a USB cable for APC Smart-UPS SC450RMI1U
Note: Updated on 2021-04-19 to fix the wrong naming. It’s not DB9, it’s apparently DE-9. Oops. So beware, because the incorrect DB9M is rather widespread (and I also fell victim to it).
In this post I’m going to look at the task of making a USB cable for monitoring of APC Smart-UPS SC 450 RMI 1U using apcupsd.
Because I have recently bought one of these UPSes without realizing that my relatively dated Supermicro 1U server doesn’t have a COM port. So the shiny APC 940-0024E cable they ship with the UPS is as useful as a fur coat in summer1.
Before I unveil the ultimate solution, let me tell you an overly detailed recount of how I got to it. Or just skip it. ;)
I was coming into this adventure poorly prepared without even knowing it.
The last time I touched any RS232 hardware2 was when tweaking something on Ubiquiti ERLite-3, and my RS232-fu was basically non-existent.
But I thought I had this reasonably in the bag because:
- I have several “Cisco Rollover Cables”, which is a USB-to-RJ45 adapter made from FTDI (or PL2303RA) chip (and optionally a logic level shifter), pictured way below in the Final solution section
- I have all the gear for RJ45 (Cat5e), including some keystones
- I have a few sacrificial lambs with DE-9 (male) connectors
Hacked up prototype: keystone and DE-9 male from a “donor”.
The final pinout etc is described below.
Having a cable, I proceeded to test the cable on the UPS, thinking that all
I need is a
2400 8N1 terminal4 settings on the
I expected (according to the “APC’s smart protocol” page above5) that
I’ll just type
b and get a response back.
No dice. Silence.
So it was checking and re-checking time. I even pulled up an oscilloscope to check what the hell’s up. It should have been working… and didn’t.
Out of desperation, since the waveform looked OK, I also shorted pins 1 and 2, and it was correctly feeding me back the data when typing in the terminal. So it should have been working. There was nothing wrong.
What the hell?
Well, it took one look into apcupsd’s source6.
Turns out, Smart UPS will be by default using a “dumb” protocol. I don’t even want to know what that exactly is. Who cares.
The most important thing is the one teeny tiny insignificant detail… that’s burried in the middle of “The Smart Protocol” section of the reference web page:
You have to first send
Y to the UPS, to have it start responding correctly
to the other commands.
In other words, the guides all over the ’Net gloss over this detail (or rather bury it in the middle of the table). Sad.
Now you, gentle reader, also know. You’re welcome.
So anyway, prototype works (worked from the start), but it’s ugly. Let’s tidy it up.
For final solution I combined two things:
First, the “Cisco Rollover Cable” (search “cisco console usb cable” and I’ll be damned if you don’t find it on AliEx or Amazon). Basically, any USB-serial to RJ45 cable looking like so:
USB serial to RJ45 male, also known as Cisco console USB cable.
Second, an RJ45-to-DE9M (male) adapter. These also sell on AliExpress, or you can get the GC98MF from StarTech7:
GC98MF from StarTech.com, a RJ45 (female) to DE-9 (male)
In case you’re not sure how to wire it, it’s essentially as follows:
- Short RJ45 pins 1-8 and 2-78
- Route RJ45 pin 4 (or 5) to DE-9M pin 9
- Route RJ45 pin 3 (RxD) to DE-9M pin 2 (TxD)
- Route RJ45 pin 6 (TxD) to DE-9M pin 1 (RxD)
There’s exactly one way to mess this up: by swapping TxD and RxD. If you want to check the resulting cable, you can plug the converter to USB and measure with a voltmeter DE-9M pin 9 (GND) against DE-9M pin 1. You should get some voltage across it (typically anywhere from -6V to -9V). Similarly, pin 9 against pin 2 should have near-zero voltage.9
After that, you can connect your UPS, set your terminal to
Y and then converse with your UPS using the APC’s Smart
protocol until your
Or you can configure apcupsd. :)
For me the (minimal) apcupsd configuration is:
## apcupsd.conf v1.1 ## UPSCABLE smart UPSTYPE apcsmart DEVICE /dev/ttyUSB0 LOCKFILE /var/lock UPSCLASS standalone UPSMODE disable ## ## You definitely want more directives here. ## This just describes the protocol setup. ##
Hope this was useful. If you struggle, shoot me an email, I’ll be happy to help.
To be fair, there’s also a possibility to get a DE-9 (male) to USB serial cable and using it with the 940-0024E (because it won’t work without it!). But have you seen these dongles? They’re huge, ugly, and definitely not a “tidy Rack” material. I’ll pass. ↩
And I really mean RS232 proper, not the TTL stuff you use to normally flash ESP32 and the like. ↩
Page 5-5, table 5-2 in the PDF. ↩
minitermbut I’ve seen people use screen and whatnot. ↩
Funnily enough, this website is also linked from apcupsd’s manual and bunch of other places all over the ’Net. And if not linked, then at least the exact same material is shallow copied over, word for word. ↩
Let’s be more specific,
Sells through Amazon and other retailers, e.g. our local Digitec.ch. ↩
You DO have a soldering iron, yes?! If not, get creative? :-) You could also skip this shorting step completely, if you turn off flow control (it will work with
apcupsd, but I still think it’s a bad form). ↩
The reason is left as an exercise to the reader. ↩