I heard that the current limit for a USB port is 100mA. However, I also heard that some devices can get up to 1.8A from a port. How do you get past the 100mA limit?
I think I can attempt to clear this up.
USB by default will deliver 100mA of current (it is 500mW power because we know it is 5v, right?) to a device. This is the most you can pull from a USB hub that does not have its own power supply, as they never offer more than 4 ports and keep a greedy 100mA for themselves.
Some computers that are cheaply built will use an bus-powered hub(all of your USB connections share the same 500mA source and the electronics acting as a hub use that source also) internally to increase the number of USB ports and to save a small amount of money. This can be frustrating, but you can always be guaranteed 100mA.
When a device is connected it goes through enumeration. This is not a trivial process and can be seen in detail on Jan Axelson's site. As you can see this is a long process, but a chip from a company like FTDI will handle the hard part for you. They discuss enumeration in one of their app notes.
Near the end of enumeration you setup device parameters. Very specifically the configuration descriptors. If you look on this website they will show you all of the different pieces that can be set. It shows that you can get right up to 500mA of power requested. This is what you can expect from a computer. You can get FTDI chips to handle this for you, which is nice, as you only have to treat the chip as a serial line.
This is where things get interesting. You can purchase a charger that does outlet to USB at the store. This is a USB charging port. your computer does not supply these, and your device must be able to recognize it.
First, to get the best information about USB, you sometimes have to bite the bullet and go to the people whom write the spec. I found great information about the USB charging spec here. The link on the page that is useful is the link for battery charging. This link seems to be tied to revision number, so I have linked both in case the revision is updated people can still access the information.
Now, what does this mean. if you open up the batt_charging PDF and jump to chapter three they go into charging ports. Specifically 3.2.1 explains how this is gone about. Now they keep it very technical, but the key point is simple. A usb charging port places a termination resistance between D+ and D-. I would like to copy out the chapter that explains it, but it is a secured PDF and I cannot copy it out without retyping it.
Summing it up
You may pull 100mA from a computer port. You may pull 500mA after enumeration and setting the correct configuration. Computers vary their enforcement, as many others have said, but most I have had experience with will try to stop you. If you violate this, you may also damage a poorly design computer (Davr is spot on there, this is poor practice). You may pull up to 1.8A from a charging port, but this is a rare case where the port tells you something. You have to check for this and when it is verified you may do it. This is the same as buying a wall adapter, but you get to use a USB cable and USB port.
Why use the charging spec? So that when my phone dies, my charger charges it quickly, but if I do not have my charger I may pull power from a computer, while using the same hardware port to communicate files and information with my computer.
Please let me know if there is anything I can add.
You can negotiate for 500mA with one of the FTDI USB chips, here's a forum post that talks about it. If you use some other chip, you still need something that can speak the USB protocol and tell the PC that it wants 500mA. Please don't violate the USB spec, your device might work fine for some people, but then it wont work for others, and you risk causing damage to poorly designed PC's.
The theoretical current limit on a bus-powered USB port (the kind in your computer) is 100mA, negotiable up to 500mA. In practice, you probably won't get as much from the ports on your computer. If you use a self-powered USB hub however, you should be able to get 500mA from every port on the HUB. So if your HUB has 4 ports, you can get 4 * 500mA = 2A.
Beware: make sure your HUB comes with a decent power adapter. Some hubs come with a 1A adapter, because manufacturers think it's an unrealistic scenario for users to draw 500mA from EVERY port.
Check out this wiki article: http://en.wikipedia.org/wiki/USB_hub#Power
I that it differs from motherboard supplier how good the power supply for the USB is. Some cheap B-brand manufacturers may just link the +5V of the power supply down to the USB port. Some better ones may actually include the whole package for overcurrent protection etc.
I got a sweex 4-port (el-cheapo, costed me like 10 euro's) USB hub so I don't have to get under the desk all the time for an USB connection. This sweex port clearly doesn't have any protection. I have smoked shorted MOSFET with it once, which its rated current was 3A.
Anyway, my point I want to make is that no matter what your project is, you probably will not want to get over 500mA of current drawn from a USB port. As a one off, maybe.. if you want to risk blowing it up on your own behalf. Certainly not for anyone else.
I'd like to think that the power provided by USB is mainly to make it possible to have communication with the real device. You might feature an isolation circuit to give better protection for USB hosts. I'd certainly not take USB as a universal 5V power supply, because adapters can do that much better (and in the long-term probably cheaper).
Adding to the excellent advice from Kortuk:
You should really use a powered hub or a "USB charger" for debugging since you do not want to fry your computer by accidentally shorting something.
All computers I had pleasure with do not bother with limiting current draw below 500mA. (with or without enumeration)
As far as I know, no one actually bothers to include current limiting in the USB host, so devices are really on the honor system not to draw more than they are allowed. I've seen a lot of devices that claim one power but actually draw a lot more, and I've never seen them shut down or anything. On a desktop, at least, I assume the ports are capable of more than 500 mA.
So if you're making a product that will be used by others, read the USB spec and learn how to negotiate with the computer to draw up to 500 mA. If you're just doing a one-off and you know for some reason that the port is capable of 1.8A, then just draw it.
In reality, many electronics manufacturers still do not strictly adhere to the USB 2.0 specification by not implementing these current limits in the USB ports that they provide. Some (read: most) USB ports allow 100mA regardless of enumeration and continued activity; some ports even offer 500mA irrespective of the required power negotiation. - Maxim
My Samsung phone requests a MaxPower of 2 mA, but then draws ~250 mA no matter what it's plugged into.
The most voted up answer contains misleading information, and better be corrected (due to high traffic).
Any normal USB HOST port must be capable to supply 500 mA of current, See Section 7.2.1 of USB 2.0 specs, or Section 11.4.1 of USB 3.1 specs.
The USB 2.0 specs says, page 171:
"Systems that obtain operating power externally, either AC or DC, must supply at least five unit loads to each port. Such ports are called high-power ports."
Note the language, "at least". So any non-USB gadgets can use 500 mA (or 900 mA on USB 3.0) without much hesitation.
The 100 mA non-enumerated limit must be obeyed by USB DEVICES, so the limit is not applicable outside USB framework. The rare exceptions form 500 mA limit are small battery-powered USB hosts, who can limit themselves to 100 mA per port.
The above 100 mA current upto 500 mA can be negotiated by the device driver. However some devices may not get configured properly at boot time if your BIOS has an option titled: "Enable legacy storage" under USB settings. If this setting is off - you may find yourself re-plugging the device after booting up, in case if it does not work properly. Only with this setting on, if present, the BIOS will provide a current greater than some minimum value, I think 100 mA.
A brute force method may be to get a two male USB to one female USB cable for extra power. CAUTION: may have electrical / power draw safety issues.
Mr 404notFound, Sorry to say you cannot increase the limit in a USB device. It is limited by design.
Some early hubs were limited to 100mA, now all hubs are 500mA and with USB3 ports 900mA is available.
Good news is you can find out what your ports are rated for. If older than 5 yrs some may be 100mA, but newer than that, I doubt it.
If running Windows... go to >Device Manager > hardware > USB Hub (pick any) > property (rt mouse)> power
I hope this helps!! sorry about the fuzzy image.. this is a Mac .. you can see 500mA per port and the device connected = 0mA It has a built in current meter, what it doesn't do is make it easy for you to identify which physical hub and port it is referring to. I found moving a mouse to each port the easiest way to identify, but my learned colleagues may know a faster way.
BTW All the USB hubs are protected by automatic resettable polyfuses from short circuits. But I have seen at least one motherboard with blown electrolytic caps near the USB ports due to current surges, detected with the traditional popcorn bulging lid.