How to best regulate power off USB? - Page 1
Forum section: electronics / beginners

author: bit 9
author_rank: Newbie
timestamp: April 21, 2015, 12:29:06 pm
content: Hay folks,I have need of a DC power regulator that fulfills the following criteria:Take 5V via USBOutput a regulated 5VOutput -19VCharge a LiPo battery capable of running the circuit when off USBTruth is, the rechargeable battery is something of a pipe-dream, but I'd love it were it possible.I'm replacing/updating/stronger/better/faster/etc. an existing power regulator for an older handheld device that has very little public documentation. The one document I have found has some errors/discrepancies with my particular model, but it's helped me fill in the gaps while I did a reverse-engineering of it myself.Here is the existing circuit as I understand it, boiled down to the parts that matter:Clickif you want to see the entire thing.I've taken the power from USB and wired it directly to the battery terminals. Everything ran properly, even though the circuit was expecting 6V. I've measured -19.02V and +5.000V (under load), corroborating the documentation I was able to find. One of the major goals of this project is to have a rock-solid 5V supply to the device's CPU, the -19V going to the screen is somewhat less of a priority, but I don't want it producing noise that will mess with the 5V. I understand the -19V is controlling the LCD's contrast, but I can only guess as to the actual mechanism at work.I'm basing much of the detail of the power regulation PCB off one preexisting schematic. The transformer is unlike anything I've found on mouser/digikey/etc, both physically and functionally, so I'm really guessing with it (it's 10mm diameter, and 5mm tall in a plastic housing). I don't have the knowledge to poke around at the NPNs, so I'm not positive that's even what they are. Also, this portion of the circuit was the last of the parts I drafted - I wanted to move on, so now I half-suspect there are errors in it - but I haven't found any upon later checks.Other info:The circuit at large can be edited as needed; it's going to be on an all-new board when I get done.The new circuit needs to fit in the old housing (keep things small).If necessary, I'd prefer to take the quality over economic route with this (so long as things don't cost a fortune).On a scale of 1 to 10, my knowledge of electronics is maybe a 2.Generally speaking though, what I do know is an inch wide and a mile deep.Also, also: Hi! (first post)have mercy

author: bit 9
author_rank: Newbie
timestamp: April 25, 2015, 08:09:27 pm
content: Bump. (On 5th page after 3 days; no replies; only 60 views)Would this be a question better suited for another board?

author: mariush
author_rank: Super Contributor
timestamp: April 25, 2015, 08:57:27 pm
content: USB is messy, depending on the power supply of the computer, the voltage could be as high as 5.5-5.8v but it could also be much lower than 5v, like 4.8v...There are switching regulator chips which can lower a voltage (buck regulators) , raise the voltage (boost) or do both (SEPIC mode, for example). SEPIC is a bit more complex, with more components, so it's probably less desirable for simple circuits.Some people resort to a simple trick to simplify their designs... they use a linear regulator with very low voltage drop to make sure the voltage doesn't go above 5v. For example, a regulator likeMCP1824can output up to 300mA with a maximum voltage drop of 0.2v, and much lower voltage drop at lower currents, something like 50mV at 100mA.So if the usb voltage is 5.3v for example, the regulator will output 5v. If the usb voltage is below 5v, the regulator will output basically the same voltage, minus a few mV, which wouldn't normally be a problem because a lot of microcontrollers can work with 4.7-5v, they don't really have to be exactly 5v.However, if you really want exactly 5v, this makes it easier to use a simpler boost regulator only to raise the 4.xx - 5v to something like 5-5.1v, therefore all would be good in the world. See chips like LT1307 or LT1308 and there's other chips that are much cheaper which can do the same thing.. i only mention the above because I used them. You could use even jellybean chips like MC34063 to boost voltage, but such cheap ICs are really inefficient and require large sized inductors to work.As for battery charging, there are very cheap and easy to use lipo battery charging chips, like the microchip MCP73812 for example :http://www.microchip.com/wwwproducts/Devices.aspx?product=MCP73812It can take up to 7v from usb port, and outputs regulated 4.2v to the battery and constantly checks it to make sure it isn't overcharged and so on, read the datasheet.You can use power switching ICs to switch power of your circuit between usb and battery, or you can make your own circuits using diodes or mosfets. A good example of some switching chip is LTC4412 :http://www.linear.com/product/LTC4412(but again Linear Technology chips are expensive, there are others from cheaper manufacturers)It's possible to use something as simple as two schottky diodes to switch between sources ... whatever voltage is higher wins and goes further into the circuit, so with usb cable unplugged you only have 4.2v or something from battery but when you plug the usb cable the 5v is above 4.2v so that takes over. Power selector chips are just more efficient than diodes, as it's explained in that Linear chip's page.As for the -19v, again, there are switching regulator chips that can be configured in inverting mode... the cheap MC34063 can do it for example.

author: mariush
author_rank: Super Contributor
timestamp: April 26, 2015, 11:50:15 am
content: Quote from: blueskull on April 26, 2015, 05:49:30 amYes, the ATX standards say a computer power supply shouldn't output more than 5v +/- 5% but the reality is different. Plenty of low quality power supplies will do more than 5.5v spikes when you turn on the power supply. Some group regulated power supplies will behave weird when the load is primarily on 12v as is the case with modern computers, so in that case the 5v rail may oscillate or be outside regulation.Outside computer power supplies, a lot of cheap usb chargers can have very simple feedback circuits, or very slow ones, relying on things like 5.6v zener diodes to clamp the voltage before the feedback can actually do its job, or they have so high ripple that voltage will often go above 5.5v. They can also be so poorly designed that above a particular current load, the voltage will drop below 5v -5% .For example, about 2-3 years ago i've played around with such a cheap charger and made a video about it here :(if you can tolerate my voice which was bad due to some flu i had around that time and see the measurements you can see what i mean)And if this charger looks bad, have a look at this usb charger Mike opened up and tested:

author: GoneTomorrow
author_rank: Regular Contributor
timestamp: April 27, 2015, 05:22:49 am
content: Quote from: blueskull on April 26, 2015, 05:49:30 am5V +/- 5% is 4.75-5.25V. 5.5V would be a 10% tolerance

author: Jeroen3
author_rank: Super Contributor
timestamp: April 27, 2015, 03:43:06 pm
content: USB 3.0 is actually is bit more different5.00 +0.25/?0.55. So you can have 4.45 to 5.25 Volts.I'm not sure if the 100mA load maximum on non-enumerated ports was changed. Shouldn't be, thats would be counter-backward-compatible.