Step 1: What is needed:
Power adapter via a barrel connector that outputs 5 volts DC with enough current as your Raspberry Pi requires.. (I used the one from my Nslu2 ( 2 amp output) for testing. (Do not use any other boltage (i.e. 12 volts) or you will damage your equipment.
Micro (not mini) usb cable.
Female power plug that will hold the male end of the power supply
We will use the packaging for the female power plug as a temporary case.
Tools:
Wire strippers/cutters
Soldering iron
Solder
Tape.
Step 2: Dissecting.
You will want to separate the usb cable while not connected to anything. Do not discard the non-microusb end as you may need to use it to check which wires are which.Once you have cut the cable, strip back the main outer covering.
Strip the red and the black wire so they can be soldered to the barrel connector.
If you do not have the standard color coding, you will have to test the cable manually. Be carefully not to touch any bare wires while doing this, as you could be electrocuted. If you are unsure, get a professional to help.
Step 3: Solder it.
Assuming you know how to solder… If not get a professional to help.
Solder the +5 wire (maybe red) to the tab that goes to the inner tube.
Solder the ground wire (maybe black) to the tab for the outer tube.
Let cool.
Step 4: Wrap it up.
Step 5: Bonus: Gpio adapter.
You can use an old “AT” RS232 to motherboard adapter cable for the Raspberry pi. You may want to cut off the RS232 db25 end so you can tine the wire ends to use in some other adapter board. Actually I needed the DB25 end for a PC project, So, I killed two birds with one stone. One less thing in the storage box.
For more detail: Raspberry Pi power cable adapter.