I have a device that gets its power from a db9 connection but am missing the power cord. I would like to rig something up using a spare serial cable and 12v power supply. Given the attached image showing the pin-out, how would I make this happen? Is it as simple as connecting pins 4,5 to the +12v lead on the transformer and pins 8,9 to the -12v?
Almost correct. You need a DB-9 connector, first of all. You need something like this. You want those solder cups and you want some solid core wire you can insert into the cups and solder down. The other end you would connect to the cord from a 12 volt power brick of some sort - those are a dime a dozen, USB hubs use em, cable modems use em, etc. Lots of ways to get one - at worst, buy another online. Make sure it is 3 amp capacity or higher.
You actually connect the +12 of the brick to the pins 4 and 5 (you solder the 3 wires together, then take the 2 wires you soldered on and solder to those pins) and the GROUND - NOT -12 - to 8,9. ± 12 would actually be a 24 volt supply and that is a totally different setup.
The way you figure this out is with a multimeter set to voltage. Plug in the power brick and place the leads of the multimeter on the stripped wires coming out. If it reads +12 (or 12V), the RED multimeter lead is the +12 and that is what goes to 4,5. If it reads -12, the BLACK multimeter lead is the +12 and that goes to 4,5. The OTHER goes to 8,9.
Note that “ground” means return to an isolated supply - it’s not actual ground and should not be in common with earth ground.
For a neat job, you need to use solder flux from a flux pen and heatshrink is nice. Also heat the wire, not the solder, when soldering and let the hot wire heat the solder. Also helpful to have clips to hold the wires together prior to soldering, but you can make do by twisting.
<pedant>It is a DE-9, not a DB-9. Somebody saw that a DB-25 had 25 pins and decided the connector with 9 pins had to be a DB-9, and the misnomer stuck.</pedant>
A novice mistake to watch out for is wiring the pins backwards due to looking at the face of the mating connector, where the pin numbers run in the other order. That is more common with separately-inserted pins as opposed to the solder cup type.
With the permanently-installed solder cup type, you have to be careful not to heat the pin too long - the material it is sitting in is plastic and will eventually melt.
You’ll want to get a compatible housing, both to protect the non-mating face of the connector from electrical shorts as well as providing a mechanical strain relief on the cable itself. Most housings (“shells”) have both strain-relief hardware and screws for holding the shell+connector onto the mating connector, but there are various permutations.
Last, if you haven’t soldered before, something involving power (even 12V) and dimensions this small is probably not the best place to start. Before anybody takes me to task for an uninformed comment, I soldered this by hand without a magnifier (the picture was taken with a magnifier).
:dubious:Wait…What? To me it looks like the device in the picture IS the power supply. Looks like the box would be plugged into mains via another connection (not shown in the pic), and the box would supply DC 12V out of the DB-9 connector to power something else.
Are you trying to power the device shown in the pic, or another device not seen?
But there is a consistent standard on which pin is considered pin 1 - like this. So the diagram posted by the OP shows a view of the female connector, which should be the one on the power supply side.
Um, what kind of “transformer”?? A transformer, by definition, outputs AC.
If you mean an AC->DC power supply - if it has +12V and -12V output terminals, then you’ll end up applying 24V on the device, which is incorrect. You need to connect pins 8,9 to neutral or ground, and pins 4,5 to +12V.
When I soldered any connector I always made sure to mark pin 1 on the wire side with some type of permanent marker. Saved trying to read the tiny numbers stamped or molded into the plug or whatever else they used to mark it.
I just did something similar to a DE-9, chopped it open and hardwired to screw connectors. It’s important to note that the colors of the wires aren’t standardized, but you can use a multimeter and the continuity function to test which wire goes to which pin
For the record: male pins 1-9 went brown, red, orange, yellow, green, blue, purple, gray, and black on the one I did. The uninsulated wire goes to the shroud.