Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I'm going to start developing a USB 1.1 device using a PIC microcontroller. I'm going to keep one of the USB ports of my PC connected to a bread board during this process. I don't want to destroy my PC's USB port by a short circuit or connecting \$\pm\$Data lines to each other or a power line accidentally.

How can I protect the USB ports? Does a standard USB port has built-in short circuit protection? Should I connect diodes, resistors, fuses on/through/across some pins?

enter image description here

share|improve this question
3  
Using a resettable fuse on the VCC would be a good start, assuming you've rated it correctly. I can't speak for how they'd work on a data line though. –  Polynomial Dec 22 '13 at 18:17
    
The data lines would need at least a TVS, or even better, optoisolation. –  Ignacio Vazquez-Abrams Dec 22 '13 at 19:12
    
I think modern mainboards are somewhat tolerant. When tinkering around with an AVR I accidentally connected GND to VCC and besides the device being disconnected by the system (i.e. windows played the "device disconnected" sound) nothing happened at all. It might be worth noting that it was no direct usb connection. VCC came through the ISP cable (which got it from USB) and GND came through an USB=>serial cable. –  ThiefMaster Dec 23 '13 at 0:14
    
@ThiefMaster "somewhat" - I still wouldn't trust it. I've fried a brand new board (disabling half the USB ports) in the process of plugging in a standard MicroUSB3 connector - must've accidentally shorted some pins somehow. Point is, it's still quite easy to damage. –  Bob Dec 23 '13 at 3:40
    
Most modern computers have protection against this. They deactivate all USB ports when any of them is using more than the max USB throughput. On my mac, it shows a notification when this happens. –  Santa Claus Dec 25 '13 at 12:33

7 Answers 7

up vote 60 down vote accepted

This is to expand on Leon's suggestion to use a hub.

The USB hubs are not all created equal. Unofficially, there are several "grades":

  1. Cheap hubs. These are cost optimized to the point where they don't adhere to the USB spec any more. Often, the +5V lines of the downstream ports are wired directly to the computer. No protection switches. Maybe a polyfuse, if lucky.
    edit: Here's a thread where the O.P. is complaninig that an improperly designed USB hub is back-feeding his PC.
  2. Decent hubs. The downstream +5V is connected through a switch with over-current protection. ESD protection is usually present.
  3. Industrial hubs. There's usually respectable overvoltage protection in the form of TVS and resettable fuses.
  4. Isolated hubs. There's actual galvanic isolation between upstream port and downstream ports. Isolation rating tends to be 2kV to 5kV. Isolated hubs are used when a really high voltage can come from a downstream port (e.g. mains AC, defibrillator, back EMF from a large motor). Isolated hubs are also used for breaking ground loops in vanilla conditions.

What to use depends on the type of threat you're expecting.

  • If you're concerned with shorts between power and data lines, you could use a decent hub. In the worst case, the hub controller will get sacrificed, but it will save the port on the laptop.
  • If you're concerned that a voltage higher than +5V can get to the PC, you can fortify the hub with overvoltage protection consisting of TVS & polyfuse. However, I'm still talking about relatively low voltages on the order of +24V.
  • If you're concerned with really high voltages, consider isolated hub, gas discharge tubes. Consider using a computer which you can afford to lose.
share|improve this answer
15  
s/descent/decent/i? –  ThiefMaster Dec 23 '13 at 0:11
6  
@ThiefMaster s/\(d\)escent/\1ecent/i. Otherwise you'd introduce a capitalisation error. ;) –  n.st Dec 24 '13 at 2:40

Use a hub. They are quite inexpensive, and your USB ports will be perfectly safe no matter what your device does.

share|improve this answer
9  
Well, not anything... those hubs are only rated for a couple of kV worth of isolation ;) –  Polynomial Dec 22 '13 at 18:25
3  
If the hub is a passive one the power pins would be directly connected to the PC power lines, or they still offer power isolation? –  alexan_e Dec 22 '13 at 18:28
2  
@Guido Bad story. That teacher of yours didn't know what he was doing. Lightning can jump across a civilian USB hub like no business. Proper lightning protection is done by shunting the bulk of the charge to ground (earth) through gas discharge tubes (GDT), and clamping the remaining charge with TVS Zeners. –  Nick Alexeev Dec 22 '13 at 21:01

As someone who does this for a living, any cheap hub in-line should give you 100% protection if your motherboard provides reasonable short-circuit protection. We use them all the time, even when doing ESD testing on our parts (15KV zaps are pretty entertaining), and have never blown one up or taken out a host port.

The Data lines from a cheap hub simply can't physically be connected to the PC - there must be a hub chip in between to separate the communications for the 4 or 7 ports that the hub provides. USB is not a bus like Ethernet - connecting multiple ports with wire simply doesn't work as too much of the signalling is based on DC levels. This hub chip will provide nearly foolproof protection between your device and the host port on the Data lines.

Power is a different issue. I had one motherboard that current limited the USB port with a fuse on the USB 5V line - not a resettable polyfuse but a melting wire fuse. An unintended short required major motherboard surgery. Power is the area that's most likely to cause problems. Buy a good powered hub (say, $25 worth), use the supplied adapter, and you're good to go.

If you're really paranoid, USB permits up to 4 hubs between the host and the device. Buy 4 different cheap powered hubs, hook them in line, and go for it.

Good Luck

share|improve this answer
1  
Stacking multiple hubs has another advantage. In the early days of USB it wasn't unusual to see devices that wouldn't work well or at all if more than one hub away from the host. Regularly testing with four should shake out lots of little latency assumptions. Don't forget to also test for correct operation with fewer hubs too, once you're confident of operational safety. –  RBerteig Dec 23 '13 at 19:24
1  
As someone who also connects prototype USB hardware to PCs, also be aware that flaky USB software can crash the host OS. We have issues with Windows disabling USB ports (requiring reboot). Also OSX will sometimes kernel panic due to bad USB data. –  David Poole Dec 23 '13 at 20:49

Analog devices makes a two chip solution for your problem, it provides full power and data isolation for the USB bus up to 12mbps, which should be fine for your needs:

http://www.ubasics.com/usb_isolator

Power - ADuM5000
Data - ADuM4160

enter image description here

There are a number of evaluation kits and breakout boards which make these easier to use for those not handy with a soldering iron.

share|improve this answer
3  
And how does he protect the USB when he builds this and tests it the first time ;-) –  Myforwik Dec 23 '13 at 5:55
4  
@Myforwik He'll use a hub! –  Ian Boyd Dec 23 '13 at 14:53

Use a wireless hub. I'd like to see someone create a USB device that can fry a motherboard through the wireless USB hub...

share|improve this answer
    
Would you like to try my 10 kV Tesla coil at an distance of a few centimeters? –  Elliott Frisch Dec 23 '13 at 16:55
7  
Of course he would like to see that, who wouldn't? :) –  Paul Becotte Dec 23 '13 at 18:01
    
@ElliottFrisch Yes please! –  BenjiWiebe Dec 23 '13 at 19:36
    
@PaulBecotte The underwriters from UL. ;) –  Elliott Frisch Dec 23 '13 at 19:38
1  
@BenjiWiebe Just let me hot-glue a usb cord to it first... –  Elliott Frisch Dec 23 '13 at 19:41

Using a (self-powered) hub is a good idea. Also, you could use a USB add-on card in your PC instead of your system's built-in USB ports, which would offer further protection.

share|improve this answer

If the device you are making runs of the power of the usb port a simple hub will do. If the device makes use of an external powersupply use isolation. I speak of this by experiance. One of my usb ports of my macbook pro is fried because of a groundloop with an externally powered arduino board. One of the other anwsers has a good solution for low cost usb isolation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.