USB Power - Page 1
Forum section: electronics / beginners

author: paulca
author_rank: Super Contributor
timestamp: December 04, 2017, 03:20:01 pm
content: I've been experimenting with USB power. Mostly providing power to items that include charger circuits such as USB power banks, phones, electronic cigarette batteries.At first I found I could use the little breadboard power supply gadget as it has a handy USB port for powering a raspberry PI. I was able to charge my eCig battery and it pulled about 650mA initially and feel fairly rapidly to about 350mA. I discovered the voltage regulators on the power supply where extremely hot and when blown air over them to cool the amps through the device would rise again. The little device claims to be capable of 1A current, which I expect it might be able to do in Siberia.So I figured that wouldn't give me enough to power to really see how many mA a proper USB charged device uses as I highly expect the little voltage regulators are thermal throttling.I used a cheapo USB power analyser to test a few chargers from my PC USB port which provided about 490mA to the mobile phone charger which provided about 1A. Interestingly this charger will go higher, but only when the phone is connected directly to it, so I can't monitor it. The "Time remaining to fully charged" drops considerably connected directly and the phone reports "Turbo" charge mode.However I bought a standard USB A socket and wired it to a breadboard and powered it direct from my Tenma bench supply. I started at 5V but noticed the USB analyser reported only 4.85V when on the wall wart charger it indicated 5.00V steady. So I wound the voltage up to 5.20V on the PSU and got 5.00V on the analyser.This is when things were weird. The mobile phone didn't like this input, it was highly suspicious of it. The current would rise to about 200mA and promptly drop out again for a second and then come back up and it fluctuated about almost randomly like the phone was testing and sensing the 'charger' voltage and rejecting it. Phone just didn't like it, although it didn't report anything other than "Charging off AC". It thought it was an AC adapter as the D-/D+ where disconnected. Other things worked fine on it.So, I found an 7805 5V regulator and wired it up on the breadboard with 100nF and 330nF caps across it as per the datasheet and fed it 7.5V. Checked I had 5V and found 4.980V which was fair enough. The phone now liked this input and settled in at about 360mA charge rate.This is very low however. To double check this I connected it to a wall wart and the current went up to 700mA.I discovered the 7805 was getting hot, so I bolted it to an oversized heatsink and tried again, but, still the phone would only take 360mA from it. Double checking it pulls twice that from the wall wart.What is going on here and why does my phone not like the bench supply or the 7805 regulated supply? How would I convince it to pull more current?Note the phone was only 20% charged during these tests, ending up about 45% charged. So it should have been in the prime max current charge phase of the Li* battery.As to Turbo charge mode, I think the phone and charger need to know each other, the D+/D- pins may be connected and the phone can detect a charger it deems safe to pull "Turbo charge" from. I haven't been able to supply it with over 1A from anything else.

author: jc101
author_rank: Frequent Contributor
timestamp: December 04, 2017, 04:26:23 pm
content: Yep, USB charging is a mess of various 'standards' and some companies just doing their own thing. Remember that is the end device that has to determine what the supply is capable of, then it will try and draw current as it needs. So if you present a port that says it can do high current when it really can't, and the device tries to draw that, things can get messy. If device thinks the supply can only do 500ma, then that is all it will try and draw.The insertion loss of a USB connector is also quite high as the current goes up, as you saw with the voltage drop, unless you have USB cables with at least a 20 AWG power pair you will get quite a voltage drop even on a short cable that also can cause issues.Take a look here for the Battery Charging specs...http://www.usb.org/developers/docs/devclass_docs/

author: paulca
author_rank: Super Contributor
timestamp: December 04, 2017, 04:43:26 pm
content: Quote from: jc101 on December 04, 2017, 04:26:23 pmYea, interesting your say that. I tried the USB power analyser on the OEM wall charger and it peaked at 460mA, but when I swapped the cable to the OEM charge cable it jumped to 1.7A. So even the cable (cheap 4 inch cable that came with a power bank that has a tendency to get hot) freaked the phone out. I will probably bin that cable, as it get's hot at 1A, so probably tiny, cheap conductors in it.However using the OEM cable on my 7805 still only pulls about 360mA.I wonder if a bigger cap on the output would stabilise the voltage a little more and encourage it to think the charger is more capable.

author: mariush
author_rank: Super Contributor
timestamp: December 04, 2017, 04:53:04 pm
content: USB 2.0 is intended to be 5v +/- 0.25v at up to 0.5A (500mA) so a total of 2.5 watts.USB 3.0 raises that limit to 0.9A for a maximum of 4.5 watts.Normally, a computer motherboard or a USB hub is supposed to limit the output to those values but to make things cheaper there's no circuit to limit the output current, or on most motherboards, there's just a basic resettable fuse for a group of 2-4 usb ports, configured for 2A limit (so through any of the 4 usb ports, a device could take up to 2A)Wires have resistance. If you move a lot of current through wires, there's going to be some voltage drop on the cable.Typical usb cables have AWG24 wires, which have a resistance of 85 mOhm per meter. For simplicity let's round it up to 100 mOhm or 0.1 ohm.Now, imagine you have a 1m long cable between your phone charger and the actual usb port on your device... this means there's 2 meters of cable completing the circuit.So you have the basic formula Voltage = Current x Resistance.At 100mA (0.1A) of current the voltage drop on the 1m usb cable will be Voltage = 0.1A x (2x0.1 ohm) = 0.02v , so if your phone charger outputs 5v, you get 4.98v at the end of the 1 meter cable.At 500mA (0.5A) of current, the voltage drop would be Voltage = 0.5A x 2 x 0.1 ohm = 0.1v so your charger output 5v but at the end of the cable you get 4.9vNote that there is also some resistance where the connector on the cable and the connector on the device mate (make the connection) but that resistance is usually below 10mOhm (0.01 ohm) so it's usually ignored.By default, a phone would normally take up to 0.5A from a USB 2.0 port, as the specification says. That's why the phone charges slowly when you try to charge it from a computer port, because that's a genuine USB port.The phone chargers (adapters) resort to some tricks to tell the phone that they are capable of giving more than 0.5A to the phone.Basically, they know the data wires in the usb cables will never be used to transmit data while the phone is charged, so they use these wires to send a couple of voltages to the phone, and depending on the combination of two voltages, the phone can determine if it can take more than 0.5A. If there's no voltage on those wires, then it sticks to 0.5A.Also you should know that more modern phones support QuickSync, which basically works by having a chip inside the phone charger. The phone can then talk to the phone charger and tell that chip that it may change the voltage from 5v to 9v or 12v in order to charge the battery faster. If the charger doesn't support QuickSync or there's no chip at the end of the cable (as would be the case when you plug the usb cable in a computer), the phone would stick to only 0.5Aedit:Have a look at this, scroll down to see various ways of indicating maximum charge current :http://lygte-info.dk/info/USBinfo%20UK.htmlQuoteAs I explained above, your wires were probably already too thin, to have the voltage drop from 5v down to 4.85v with just 200mA. The breadboard contacts probably added more resistance, lowering the voltage more.The phone probably saw that voltage 4.85v and that is within 5v +/- 0.25v and then when it tried to take up to 500mA, due to resistance of the wire and the breadboard the voltage probably dropped outside 4.75v .. 5.25v range, which made the phone stop charging.You should measure the voltage with a fast multimeter or an oscilloscope and see the voltage exactly when the phone charges.The 100nF and the 330nF are the minimum required for the regulator to work. The datasheet assumes you have the power supply near the regulator, not a meter or so away on the desk.It would help to add an electrolytic capacitor on the input (let's say 10uF or more, any value would be good but above let's say 470uF it wouldn't make any difference) and an electrolytic capacitor on the output (let's say up to 100uF) or at least 1uF ceramic capacitor.A linear regulator produces 5v by dissipating the difference as heat. So, you have 7.5v in, 5v out and 0.36A ... that means (7.5v - 5v ) x 0.36A = 0.9w produced at heat. If you look in the datasheet, you will see some values like 30c/w over ambient... this would translate in "for every watt dissipated, the temperature of the chip will increase by 30c above the room temperature" and another value in the datasheet will tell you what's the maximum temperature the chip can handle (usually 105c or 125c or somewhere around that value) ... basically if your temperature is above 80-90c you're supposed to add a heatsink.The low current could be caused by lack of capacitance on the input and output, and fluctuations on the input voltage caused by the thin wires you used. Some capacitors on input and output would help a bit. Thicker wires would also help.Also note that as a battery charges, there's less current being used to charge. So at 20% the phone may charge with 700mA but at 40%, the battery may take in only 500mA or less.

author: jc101
author_rank: Frequent Contributor
timestamp: December 04, 2017, 04:56:07 pm
content: Quote from: paulca on December 04, 2017, 04:43:26 pmJust having a beefy power pair isn't enough, you need to also have the right signals on the D+/D- lines so the device can determine what type of supply it is. This can be a simple voltage divider, pull them high, or in some cases they do a kind of challenge response to see if the supply is really the right one (no crypto, just playing with the voltages on the lines).Not sure what your analyser is but ones like these will also show you the voltages on the data pins which helps.https://www.alibaba.com/product-detail/USB-3-0-Power-Monitor-Red_60379368034.html

author: paulca
author_rank: Super Contributor
timestamp: December 04, 2017, 06:48:14 pm
content: Yes. My power supply wasn't the best probably. It's was mish-mash of junctions. So I redone it.I now have fairly chunky banana leads going to binding posts into which I clamp relatively chunky leads with 2 x 3 headerpins on the other end.I tuned the PSU to get exactly 7.50V on the breadboard supply. I then checked the 7805 output. 5.00V perfect. Until I put it under load. With 0.5A load I get about 4.5V at the regulator itself. I added 100uF bipass caps on the breadboard supply rail and the regulator output but it didn't do anything to help the voltage drop.I tried ramping up it's supply voltage to 15V and it didn't help the output voltage. It did make the heatsink into a nice winter hand warmer though.Maybe I need a better regulator.Thanks for the info on "smart" charger stuff. I'm fairly sure the OEM wall wart signals the phone. I forgot to check if it switched voltage or not though.

author: kalel
author_rank: Frequent Contributor
timestamp: December 04, 2017, 07:50:39 pm
content: BigClive discussed a bit about how USB charging works:

author: w2aew
author_rank: Super Contributor
timestamp: December 04, 2017, 09:19:17 pm
content: Quote from: paulca on December 04, 2017, 06:48:14 pmProblem is likely the fact that you're putting 0.5A through breadboard connections - don't to that. They're not designed for that, and probably getting some voltage drop at each of those high-current connections.

author: mariush
author_rank: Super Contributor
timestamp: December 04, 2017, 10:55:23 pm
content: I didn't notice you were still using the breadboard.Paul, my advice would be to buy some prototyping boards and experiment on those.Here's a good eBay link, for packs of 5 vero style prototyping boards of a size you pick (3 sizes) :https://www.ebay.com/itm/Strip-Board-Printed-Circuit-PCB-Vero-Prototyping-Track-Packs-of-5/261199157440Here's a potentially cheaper link (packs of 2 boards and free shipping) :https://www.ebay.com/itm/2-x-Prototyping-PCB-Circuit-Board-Stripboard-94x53mm-C/260848705026The ones in the link above are continuous vertical strips and the beauty of that is you can either strengthen the trace by adding solder and covering holes with solder or you can cut the trace with a sharp blade or by using a drill bit to enlarge a hole slightly until the trace breaks at that hole. Being more copper on a trace also means less resistance compared to the more basic one pad per hole proto boards.You can also cut pieces of these prototyping boards easily with a saw blade or even some bigger scissors or hedge clippers or guillotines.You may also like this pattern, very easy to solder a 3pin regulator and other components :https://www.ebay.com/itm/1PCS-DIY-Prototype-PCB-Matrix-Circuit-Board-Stripboard-Universal-8-5-20cm/253234159272

author: paulca
author_rank: Super Contributor
timestamp: December 05, 2017, 07:54:47 am
content: Thanks. I have been considering my options "beyond the breadboard" as I have at least one project at the moment that needs to go in an enclosure.I ordered 10 of the last link, after I refound that type on the UK ebay. Cost me £5 for 10.When I did the dummy load the main current only passed into the breadboard for the sense return to ground, the rest when by decent wire gauge external to the BB.I like the layout as it's very similar to a breadboard and should reduce the number of tracks I need to cut to fit components. For links can I just use the solid core breadboard hook up wire stuff? I suppose it would depend on the current? If I'm running less than 1A the link up wires might be fine, but if I'm trying to run >1A I might need to use better wire links and double up tracks etc?How easy are the links to scratch off with say an exacto knife? I don't have a dremel as my brother burnt the clutch out on mine and I binned it (was more expensive to find and buy a new clutch as they were sold with the whole shaft and motor!). Using the main cordless drill with cutting and sanding bits is an option but it's a big heavy drill. I gather a counter sinking bit would be ideal to cut away a track at a hole.

author: mariush
author_rank: Super Contributor
timestamp: December 05, 2017, 08:13:57 am
content: I stopped bothering with blades. Just got a regularcheap black and decker cordless drilland from the copper side, i just use a drill bit slightly larger than the hole. It's so little copper by the edges of the holes that expanding the hole a bit will break the trace on both sides.For links, i usually save the legs from diodes and resistors and capacitors.If I'm too lazy, I cut a chunk of ethernet cable from a spool I have under my desk and strip the insulation of the copper wires, there's 8 solid core wires inside the ethernet cable and they're AWG24 so reasonably thick for some links on a prototyping board.Though you have to be careful with ethernet cable because the cheap cables are usually CCA (copper clad aluminum), aluminum wire coated with a layer of copper.. so if you bend the wire it can break easily and it has higher resistance than pure copper wire.

author: paulca
author_rank: Super Contributor
timestamp: December 05, 2017, 09:39:09 am
content: For heavier current links can you put the link on the backside and use it to wick solder across the contacts and create a solder track?Anyway, I've just reminded myself that for a 1cm or 2cm link, even at 24 gauge the voltage drop and thus wattage through the link will be minimal.(I also remembered my dummy load does not actually transfer any of the highside through the breadboard, the sense return is just the voltage going to the high impedence op amp inputs, so ~0 current.) All the power goes through 12AWG wire through the mosfet and sense resistor on the heatsink.

author: paulca
author_rank: Super Contributor
timestamp: December 05, 2017, 10:09:02 pm
content: So I had a quick test tonight. With the data pins shorted (or not connected) the phone thinks it's a random wall charger and pulls ~300mA. If I ground both pins it thinks it's charging over USB and draws 450mA.I can find the resistors required for older Motorola chargers here:http://pinoutguide.com/ChargersAdapters/razrv3_charger_pinout.shtmlNot sure how reliable that is or if I want to trust it with my £250 phone! I'll keep digging or I'll tear down the actual charger and poke about.I mean this is completely pointless exercise, I have plenty of chargers and I don't really care if my phone only charges at 450mA on USB, but it's fun.

author: Awesome14
author_rank: Regular Contributor
timestamp: December 06, 2017, 01:16:35 am
content: OK, USB charging originated by the fact that the USB standard calls for power supply, and computers are everywhere. But USB controllers also communicate the maximum power that can be drawn. If you just connect power directly to a USB connector, the device being charged will settle for some default value of the current it can draw--because, of course, the connector itself communicates nothing--which would be something any USB connection can deliver.I don't believe wire gauge matters to a great degree, because 28GA will carry 800mA.

author: paulca
author_rank: Super Contributor
timestamp: December 06, 2017, 08:04:22 am
content: This might be of interest.http://composter.com.ua/documents/BC1.2_FINAL.pdf