# How do I create a USB cable with a capacitor in-line?

I have a USB powered device powered from a car lighter socket to USB adapter. When starting the car the power turns off briefly, I need to maintain power to a USB powered device over this time.

I want to make a USB cable (or circuit board) with a built in bypass / power holdup capacitor in order to maintain power.

How can I do this?

• @Andyaka Valid question. Answer (with another question...): electronics.stackexchange.com/questions/279559/… Commented Jan 10, 2017 at 21:45
• Don't you mean "with parallel bypass capacitor"? Commented Jan 10, 2017 at 22:59
• @AliChen Yes? I have no idea what I'm doing, so there's a good chance I used the wrong terminology. Commented Jan 10, 2017 at 23:15
• @AliChen they're almost always switchers, 12V->5V at one amp linear would get so hot it could double as a cigarette lighter. Commented Jan 11, 2017 at 11:07

Trying to hold up the regulated 5 V line with a capacitor is the wrong way to address this problem. The USB power will sag somewhat, and a very large capacitor will be needed to not let it sag too much.

Do the math. USB devices can draw up to 500 mA. Let's say you don't want the power voltage to sag more than 500 mV, and that you want to be able to ride out at least a 2 second cranking event.

(500 mA)(2 s)/(500 mV) = 2 F

Note that the power voltage will always sag, and that the 500 mV spec was arbitrary since we don't know how close to the valid USB power voltage lower limit you are already at.

A better answer is to hold up the input voltage. Put a Schottky diode in series with the 12 V, then a capacitor to ground before the USB power supply input. These small USB power supplies are switchers, and will work with lower input voltage. You don't know how low, but that is something you can measure while loading the output with whatever current your device needs.

Using the same parameters as above, you want to ride out a 2 s interruption in 12 V input while drawing 500 mA from the USB. That comes out to 5 J of energy output with no corresponding input. Let's say the power supply is 85% efficient, so you need to feed it 5.9 J. For sake of example, let's say the power supply still produces 5 V out with 8 V in. Doing the math yields 150 mF.

That's also a large capacitor. Either way the capacitor has to store enough energy to run the load during the time the 12 V power is off. However, the advantage is that the USB power voltage never sags at all. The device is guaranteed to continue running.

This also points out why batteries are usually used for devices that plug into car power but need to keep running during starting. It's just too much energy for a reasonable capacitor to store. Note that the examples above used only 2 seconds for the 12 V off time. That's probably good enough for most cases, but sometimes it will take longer, and your device will get powered off.

Tom's answer tells you how to do what you asked but I'm not sure if that is what you need. Going by your comments this is for holding the power up while cranking a car engine. A capacitor may not work for what you want depending on the exact situation. You haven't said how much power the device needs or how long you need it to keep running for.
If it's just a few ms on a low power device then a capacitor will probably do. If it's longer or a higher power device then it may not.

Personally I'd say go with the cheating off the shelf solution. Get the smallest USB battery pack you can find, low capacity ones are cheap, I've even seen them given away in promotions. Charge the battery pack from the car and plug your device into the battery pack.

It's complete overkill, it'll keep your USB device running for minutes or even hours rather than a few seconds and it's bigger. But it's a lot less hassle and avoids having to start cutting up cables.

• Yeah, one second is a long time for capacitors to power a device unless you're prepared for them to be very bulky. Power packs can be about \$5 e.g. dx.com/p/… (doubles as car air freshener) Commented Jan 11, 2017 at 10:55

The tidiest way of doing it would be to solder a capacitor onto whatever circuit you are connecting the USB cable to. The reason for suggesting this is that you don't have to then modify the cable, and are not limited to using the specific cable you have modified. Additionally there is less risk of shorting something out in the cable and damaging your USB port.

If you do wish to insert a capacitor into the cable, I would do it as follows:

1. Carefully remove a small section of the outer insulation using a knife. Roll the cable against the knife gently so as to make a cut about half of the circumference of the cable. Repeat a second time about 2cm apart. Then cut lengthways along the cable to join up the two cuts removing a section of the insulation. Make sure you don't cut into any internal cables.

The purpose of not cutting all the way around the cable (only removing insulation from one side) is that the remaining insulation helps to maintain the structure of the cable by providing mechanical support and strain relief.

1b. If you have a shielded cable, you will also need to then remove the shield from the same section using either a knife or wire snips.

2. With the now exposed inner cables, identify the power and ground pins - usually red and black. If there are not red and black cables, bin the cable and buy one from a reputable source.

Either cut these wires and strip about 1mm of the cut ends, or preferably cut away the insulation over a short length (about 2mm) without cutting the copper inside. When you make the cuts or remove the insulation, don't do both wires at the same place, stagger them about 1cm apart. This helps to ensure that the exposed copper of each wire can't short out against the other.

3. Tin with solder either the cut ends or the exposed copper region of the cable. This make it easier to solder to the cables. If you cut the cables, at this point also solder the two ends back together.

4. Solder on your capacitor between the two solder joints. It is at this point you will thank me that you didn't cut the wires as it will be easier to solder the capacitor on if you are not at the same time trying to keep the two cut ends from desoldering and falling apart.

5. Finally, tidy up with some heatshrink tubing if possible - should be easy enough on a USB Mini or Micro cable as you can push the tubing over the connector to get it on the cable, then shrink over the point where the capacitor is connected. You could do this with electrical tape, but heatshrink will be much neater.

Furthermore, because the joints were staggered in step (2), you don't need to put heatshrink on the individual wires because the cannot short together due to the separation of the exposed copper. Only an external covering is required to protect everything.

Make sure you verify that there are no shorts between power and ground. You can do this with a DMM in continuity mode, probing the USB A connector - the outer two pins on the connector are power and ground.

• Awesome, thanks! To clarify, should I solder both the power and ground wires to the capacitor? Also, in a related question that I asked, someone suggested adding a diode. How would I do this? Commented Jan 10, 2017 at 23:23
• Yes you should connect one end of the capacitor to power, and one end to ground (it wouldn't do anything if only one end was connected). You can add a diode is series with the power cable, in which case you would have to cut the red cable. Anode would go to the host side of the cable (e.g. computer), cathode would go to the device side, and the capacitor would also connect to the cathode. Commented Jan 11, 2017 at 10:02

If you already have a 12V to 5V converter I would suggest you to open it and add capacitor directly inside. For sure the converter will have one or more output capacitor in parallel from 5V line to GND, close to the output. Try to add some other capacitor in parallel there to increase the overall output capacitance.

Add capacitors till you avoid the short switch when the car starts, but do not add too much capacitance, otherwise you risk to blow up the converter at the startup, because of the high output current needed to load the capacitors. Increase it with small steps (~30%).

Considering you need to place the circuit inside your car, I would use 12V sealed lead acid battery instead. LiPo will be dangerous if it gets too hot.

V1 is the voltage from your ciggy plug and it comes with a built in 1A fuse. You would not want to add big capacitor as the high surge current will burn the fuse.

R1 10 ohm (5W maybe) is being use to charge your Bat1, you don't need an additional charger because your alternator can do it. D1 and D2 are schottky diode with a 0.2V forward voltage; trying to reduce power lose.

When V1 supply cut off, Bat1 will supply to your DC-DC to ensure your 5V is still there.

simulate this circuit – Schematic created using CircuitLab