How to use USB-B to power 5 V microcontroller and peripherals
I built a small breakout board of for an ATmega328p microcontroller. It included an AMS1117 5 V regulator and a CP2102 USB-UART bridge for programming and serial communication. On the board I use a USB-B receptacle to provide power, and for communication purposes. Both the microcontroller and the bridge run on 5 V.
The simplified schematic without other peripherals looks like this.
I have learned that my AMS1117 5 V regulator is a bad idea, because the dropout voltage is around 1 V, leaving at best 4 V for my microcontroller and bridge.
What is the correct approach to use here? I need 5 V for the bridge and micro. Should I just feed the unregulated USB Vbus into both ICs? Should there be a mechanism to limit inrush current? I have heard about polyfuses / resettable fuses - are they useful here?
2 answers
The first thing to do is to check the valid supply voltage range of the chips you want to use. Compare those to the min/max USB voltage you are guaranteed at the end of the worst case cable. If I remember right (your job to check), that is something like 4.2 V to a little over 5 V.
It would be very strange if a chip intended to interface with USB can't be powered directly from the USB. If not, get one that can be.
There are many microcontrollers available that are fine with the full range of USB power voltage. Unless you have an unusual niche application or need a lot of compute power, finding a micro that can be powered directly from USB and that can do the job you want shouldn't be hard.
You might even consider a micro with a built-in USB peripheral. I usually use a PIC 18F for that. There are definitely versions available that can run directly from USB power. I've done that.
As for startup glitches, the limits are in the USB spec. If I remember right (again your job to check), you are allowed up to 10 µF directly on the USB power. With a small number of ICs, distributing the max allowed capacitance among the bypass caps should be no problem.
If you really need 5 V within a tight tolerance for some unavoidable reason, then you will need a buck/boost switcher or a boost switcher followed by an LDO. Keep in mind that you are only allowed 100 mA (I think) before enumeration. During enumeration you can request up to 500 mA. Although the host is not obligated to grant you 500 mA, in practice you will get that unless you are running from a USB-powered hub or in a few other special cases.
0 comment threads
The USB chip will obviously be fine, and so will that MCU at most speeds. In practice the USB VDD coming out of a computer will be pretty well regulated at low frequencies.
One concern is when using a dedicated USB transceiver chip with a 5V MCU, is that the transeiver's Rx/Tx is compatible with the voltage range of the MCU. The transceiver typically (including yours) makes its own 3.3V from which it powers its serial port circuitry, or at least show it being hooked up like that in the datasheet reference circuit. The concern is then the 3.3V output of the transceiver V_OH_min (here V_IO-0.7 = V_REG-0.7 = 2.4Vmin when Vreg=3.1V), might be too low for the 5V CMOS levels expected by the MCU Rx pin. Though if you tried it may well work, as the V_OH might approach 3.3V when not loaded. The way to make it robust within the spec, though, is a level shifting buffer, like 74LV1T34. The reverse direction (MCU Tx to transceiver Rx) typically okay, as the USB transceiver's output pins are often (including this one) 5V tolerant.
Also the USB transceiver chip often has a feature of a built in regulator to 3.3V. You should check its current capability. If it's enough to run the MCU, and you don't need the 5V operation, then it would simplify everything.
The potential reason for more regulation, IMO, would be if you're not satisfied with the USB power quality due to digital noises - which is usually if there is analog circuitry. Even in that case you can potentially filter the VDD rather than using an LDO, but that depends on your exact needs. The USB bus VDD noise level will be noticeable but comfortably tolerable for any digital logic, which is the only thing we're seeing in your schematic.
Regarding startup concerns, it's typically just fine provided you satisfy the bus requirements as per Olin. Probably a good idea to make sure the UVLO on your MCU is configured and activated, which ensures the MCU doesn't get going until the VDD is above its minimum by a meaningful margin.

1 comment thread