Introduction: On/Off Switch for a USB-Powered Device
This is a very simple little instructable about installing a toggle switch in a MicroUSB cable. This was made for a specific project where I needed to kill the power without having access to the components that were connected. If the cable was left connected, it would drain a battery. This will probably be the most use to people that are building a project that will ultimately live inside a case.
One other critical thing to note is that I also didn't bother reconnecting the data wires (though it would be easy to do with the right toggle switch). This cable is only used to draw power or charge a device.
Step 1: Parts and Tools
MicroUSB cable: $3.00 from an inaccurately named Dollar Store. Similar to this, but cheaper. This will work on any type of USB cable.
Single Pole Single Throw toggle switch: $1.75 Lee's Electronics
Sugru: 8 mini packs for $18.95. I used one full mini pack.
1/8th Inch shrink tube: $6.99 for an assorted pack
a couple of inchs of thin (maybe 18 or 20 guage) brass wire. Probably any type of wire will work, but brass is so easy to work with. I had a bunch lying around, but it shouldn't cost more then a couple of bucks.
Solder iron and solder
Step 2: Prepping the USB Cable
Apologies for the messy desk! I cleaned it halfway through.
Cut the USB cable. This is your chance to shorten it by cutting a section out of it. Once the cable has been cut, peel back the outer sheath (the black covering) with either a large set of wire strippers, or by carefully scoring the outside with an xacto knife, then pulling the sheath off. When you do this, you will probably find a braided wire wrapping. This is shielding. You can unbraid it, peel it back, and clip it off as close to the sheathing as possible. Do this on both ends.
At this point, you should see four wires, red, black, green, and white.
Step 3: Soldering
Prep the wires
Strip the red and black wires on both sections of cable
Tin the red and black wires. To tin them, twist the strands together a couple of times, then heat them up with the solder iron. Once they're hot, touch the solder to the wire. It should melt and distribute to all the strands. This is done so that the wire can be easily solder to other components or wires.
Clamp the switch in the helping hands to hold it in place.
Solder the red wires to the switch
There are three poles on a SPST switch, a centre pole and two end poles. One red wire will get soldered to the centre pole, and the other goes to one of the ends. It doesn't matter which end. Put a little solder on the two poles where the wires will attach. Then solder on the tinned red wires.
Solder the black wires together
Cut a 1/2" section of heat shrink and place it over the black wire. Slide it down so it doesn't interfere with the soldering. Also make sure it's far enough out of the way that the heat from the solder won't cause it to shrink before it's in place.
Solder the black wires together. Since both ends of the wire are tinned, the way I attach two wires is to put the two ends together, so they are coming from opposite directions. Align them so the tinned ends overlap completely, then heat one of the wires. The solder on the wires will melt the two together and form a strong connection. I used to twist the wires together, then tin them as one, but I've been told that this creates a weak point where the wires come out of the sheathing, so I switched to the above method, and it's worked great. It also makes a cleaner joint which is easier to cover with shrink tube.
Move the heat shrink over the exposed wires and heat GENTLY with a lighter or the solder iron.
Trim the white and green wires
Make sure there is no chance of them coming into contact with each other.
Step 4: Add Some Structure
At this point, the cable and switch will work, but since it's only held together by a few very thin wires, you can tell it's not going to last long. We can fix this by embedding the whole thing in Sugru. This will make it a lot more robust. The downside is that if it needs repair, there will be a bit of work involved and you'll probably need more Sugru to put it back together, but if it's done right, the cable should last quite a while.
Give the Sugru something to grip by wrapping the brass wire around the sheathing for a couple of wraps. End where you started, then twist the beginning and the end together. Clip the twisted ends to a reasonable length. Do this to the other end as well.
Time to get out the Sugru! The flavour of the day is yellow! Take it out of the package and form it into a ball. Then form it over the back of the switch and the sheathing. Make sure you cover the brass wire, as this will give it something to bite to. In my case, the whole thing is going into a box with only the toggle sticking out, so it's not exactly a thing of beauty, but if it's going to be visible, do something creative. Form the Sugru into the shape of a dinosaur or something.
Give the Sugru 24 hours to cure.
And there you have it! A switch that toggles the power to a microUSB device.