# How to regulate 5V 3A to 3.3V for ESP32 and level up 3.3V to 5V on a PCB

esp32level-shiftingpowerpower supplyvoltage-regulator

I'm making my first custom PCB with an ESP32-WROOM-32E. I am following this tutorial for the ESP32 part. My project requires a 5V 3A power supply but the ESP32 only takes 3.3V.

The tutorial uses an LM1117. I've done some research but can't find out how much current it can take. From what I understand it turns the volts into heat, right? Does that apply for current as well? Is the LM1117 the right one for my situation? If the the input current is the same as the output current, will the LED blow up or only take as much as it needs?

Later on in the project I'll need to level up the 3.3V from a GPIO pin (which sends fast data) to 5V. How can I do this? I'm pretty new to real electronics.

The linear regulator burns the extra voltage as heat. Example:

ESP32 draws maximum 240mA. Let's use 300mA instead, assuming the ESP32 will draw a bit of extra currents to light LEDs, etc.

At this maximum current, the dropout voltage across the regulator is 5V-3.3V=1.7V, and 300mA is passing through it. P=VI, so this corresponds to 1.7V*0.3A=0.5W dissipated in the regulator.

Note the "3A" in your "5V 3A" power supply is only the maximum current it can provide. This has no influence on the dissipation of your regulator, which depends only on dropout voltage and how much current the load draws.

Of course at lower current it will burn less power.

0.5W means SMD SOT-89 or SOT-223 packages are adequate, with a bit of copper area to cool the tab. In thru-hole, a TO-220 without a heat sink will work fine. A TO-92 regulator burning 0.5W would be quite toasty, and a SOT-23 would smoke.

LM1117 requires an output cap with "ESR between 0.3 Ω to 22 Ω" according to the datasheet, so you have to use an electrolytic cap, say 100µF. The reason for the capacitance is mostly to get an ESR that's low enough to get good transient response. General purpose caps all cost pretty much the same below a few hundred µF anyway.

Usually I use LDL1117, this one works fine with 10µF ceramic surface mount cap, so it makes for a smaller footprint solution. It has a nice fast transient response, and much lower quiescent current than LM1117 too.

I'll need to level up the 3.3V from a GPIO pin (which sends fast data) to 5V.

You can use a 74HCT logic gate or buffer to translate logic levels from 3V3 to 5V. If you power it from 5V, it will output 5V logic levels, and it will correctly interpret 3V3 logic levels on its inputs. You can check "Vih" in the datasheet, which is the minimum voltage that is guaranteed to register a 1 level on the input, on 74HCT it is around 2V, so no problem to read a 3V3 logic level.

This is not the case for 74HC logic gates, which need 3.5V on the input to reliably register a high logic level when powered from 5V. Usually 74HC will work, because 3.5V is only the limit, so most chips will read 3V3 as a logic high... but it's not guaranteed, and the threshold depends on temperature, so it will probably stop working when it gets too hot or too cold.