Introduction: On/Off Switch for a USB-Powered Device

Picture of 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.

Wire strippers
Solder iron and solder
Helping hands
xacto knife

Step 2: Prepping the USB Cable

Picture of 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

Picture of 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

Picture of 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.


FrancisL29 (author)2016-08-30

Would that work with a 20A 14vdc on/off switch ? Or do I need a 5A 12vdc switch to make it work ?

David LG (author)2016-05-24

Thanks, it worked for me.

LukeN7 (author)2016-05-10

I'm attempting to make a living room media centre with a raspberry pi and wanted to install a simple switch instead of unplugging it every time.

This is exactly the set of instructions I've been scrawling through the net looking for. I thought the process would be easy enough with the toggle switch I already have, this confirms it. Bonza.

Thank you for taking the time to make this post.

VonG4 (author)2016-03-09

That is a pretty sloppy looking job. It's like you killed Mr. Bill and turned his body into a switch casing. Process: B- Aesthetic: F-

NEIN (author)VonG42016-03-16

Well, luckily the whole thing is hidden behind a panel. That was two years ago and it's still working. But hey, thanks for taking the time to post a negative comment!

akpuggy (author)2014-09-14

1) Why didn't you reunite the white and green wires, are they irrelevant?

2) How can I do this but with a LED next tot he switch so I know when its on?

Edit: for the second questions, looks like all i need to do is attach any LED to to the red and black wired after the switch end:

WaqarA4 (author)akpuggy2015-03-28

The switch is purely controlling power, keeping the white and green not on the switch as they are for data transfers, so they are irrelevant as data is not what prevents it from turning on and off, it is the power source.

jbrown120 (author)2014-02-05

I've done similar with a push button on/off toggle

NEIN (author)jbrown1202014-02-06

If you wanted to get really crazy, you could use a knife switch!