Voltage regulation ESP-WROOM-02D/U (or any MCU?) - Page 1
Forum section: electronics / projects

author: oliv3r
author_rank: Frequent Contributor
timestamp: November 12, 2022, 10:02:11 am
content: Hey guys,I'm trying to do a design based on a WROOM-02 (replacement of a wemos d1, so stuck with that one) and need to do voltage regulation. Obviously the WROOM-02 needs 3v3@500mA (right? can't do with much less then that?) so finding a (V)LDO for that isn't a big issue. However, the power input is 12V and the SPI bus that we need to talk to is 5V, which means 5V pull-up MISO (the wroom is a slave). However, there is no 5V available for this, thus either a dual output LDO is needed (hard to source with the needed specs) or some other means are needed.I could daisy chain regulators (better for efficiency of the 3v3 part? But that means needing a bigger 500mA 5V regualtor, just to regulate the 3v3 later. What alternatives are there? I could do a 5V zener for the pull-up, but how are we looking on consumption? We'd be talking super low power usage, just that of the pull-up ... and what value would be best for that?A small schematic added to show what I mean (hopefully :p).

author: kripton2035
author_rank: Super Contributor
timestamp: November 12, 2022, 10:26:19 am
content: P = U x I = (12-3.3) x 0.5 = 4.35Wreally too much for the small 1117you must input 5v at the 3.3v regulator...

author: oliv3r
author_rank: Frequent Contributor
timestamp: November 12, 2022, 01:59:00 pm
content: Thanks kripton for your response, but my question had absolutly nothing to do with that 1117But in that light, according to the datasheet, it's a 3V3 LDO with a 1A output current. Input voltage is upto 20V. I was under the impression that it could deliver the 1A when feeding it 20V. There's also no graph in the datasheet that would indicate this (input v vs current capability. So what makes you say this?https://eu.mouser.com/datasheet/2/115/AZ1117-1596017.pdfJust a reminder to all responders, I'm wondering how to create a pull-up voltage for the MISO without adding a 5V LDO, but instead use a 5v1 zener.

author: DavidAlfa
author_rank: Super Contributor
timestamp: November 12, 2022, 02:53:24 pm
content: Nope.It means "It will not explode up to 20V, and might will provide up to 1A output", doesn't mean it can provide all that at the same time.Use a buck regulator, not that electric stove. LDO can be ok for small voltage drops, ex. from 5 to 3.3V, not from 12 to 3!Anyways, read the datasheet of the device you're connecting to, and check the ViH level for digital pins.Sometimes it's % of VDD, otyhers it's an absolute threshold.For example, for the ESP8266 it's 0.75*VIO, meaning it will read "1" starting from (0.75*3.3)=2.475V.When devices talk different voltage levels, what you should search is "voltage level translation" or "voltage level shifter".

author: oliv3r
author_rank: Frequent Contributor
timestamp: November 12, 2022, 03:09:31 pm
content: Quote from: DavidAlfa on November 12, 2022, 02:53:24 pmSo how does one search for a proper part? buck/ldo doesn't matter much to me, in this quick sketch I did in the schematic, I just picked a sensible part, but it's not so sensibe! But how is one to know this based on the specs?Regardless, thanks for the tip, and for the real thing I'll def. look for a buckQuote from: DavidAlfa on November 12, 2022, 02:53:24 pmThere is no datasheetSo we dont' know. We only know that the other side supplies 12V and talks 5V. The ESP is known to have 5V capable IO's (this is well documented by now), but the output (MISO) is 3v3, so we need to pull it up to 5-ish volts. Its been known to cause problems. Alternative boards use a 5V ldo, but I'd rather avoid that if possible.Quote from: DavidAlfa on November 12, 2022, 02:53:24 pmAh, the whole point of this design, is to avoid the level shifter

author: DavidAlfa
author_rank: Super Contributor
timestamp: November 12, 2022, 03:18:40 pm
content: The LDO datasheet will also show thermal characteristics, showing how much power it can disipate depending on different factors, but as general rule >0.5W is usually in the red zone for naked LDOs.You need some way to put the heat out so the LDO stays cool enough, like a DPAK soldered in a large copper area full of thermal vias, or through-hole with a decent sized aluminium heatskink.Parts can ususally handle safely 85ºC (Actually up to 125ºC), but that migh shorten the lifespan, also any slight power increase or ambient temperature increase might trigger overheating shutdown.You should never stay so close the the limits, 60-ish ºC is usually ok.A buck regulator efficienty is about 90%. So it would probably waste less than 0.2W.Requires more external parts (coil, diode), but you can find them in modules.I don't say you need a level shifter IC for this, but you DO need some sort level shifting technique.So you don't know what device you'll connect there?Try this single transistor level translator. The 100pF cap enhances the switching time, simulated to 10MHZ just fine, but you must test yourself!

author: Siwastaja
author_rank: Super Contributor
timestamp: November 12, 2022, 03:23:59 pm
content: You want to have switch mode converter from 12V to 3.3V 500mA because linear regulator is just not practical. Of course linear regulator is possible, plenty of such designs in 1980's, but you need an actual aluminum heatsink! (12V - 3.3V) * 500mA = 4.35W of dissipated power is a lot from thermal viewpoint. A switch mode converter (synchronous buck) however can do this at 80-90% efficiency, meaning < 0.3W of dissipated power.A 3.3V MCU cannot communicate with 5V SPI bus without level translation. Even though some hacks can be possible, I would recommend using actual level translator IC(s). Because SPI signals are all unidirectional, this is easy-peasy. Look at unidirectional level translator ICs at your distributor parametric seach. You can find the required four signal translator (three in one direction, one in other direction) in one IC package, or you can just use multiple parts, one small translator IC for each signal for example.If you only need the 5V to power this level translator, required current is so small you can use linear regulator from 12V to do that (like the classic 78L05), then you can use 12V -> 3V3 switch mode regulator for the MCU.Switch mode converters are more work and more prone to go wrong, though. Unless you want to go the easy way and use a complete module, pick a completely integrated regulator, one which only needs external inductor and capacitors, and carefully follow the example circuit and layout advice in datasheet, and you'll be fine.

author: oliv3r
author_rank: Frequent Contributor
timestamp: November 13, 2022, 09:47:31 pm
content: Quote from: DavidAlfa on November 12, 2022, 03:18:40 pmYeah, I just figured the LDO would be hunky dorey as it was well within my parameters. Since I"m talking ESP, I'm excpecting 100mA of current, with very regular 300mA spikes for wifi transmissions, so figured 1A should be no problem ...Quote from: DavidAlfa on November 12, 2022, 03:18:40 pmYeah I saw, but also those get quite pricey (3 - 5€ a pop?)Quote from: DavidAlfa on November 12, 2022, 03:18:40 pmSo far others have found, that a pull-up on the miso is sufficient, however their design/test setup had a 5V regulator that they could easily pull-up to. A pull up is still a 'level shifting teqnieque'the ESP will let go the MISO, where the pull up pulls it to 5V, and will pull it to gnd to signal a 0.Hence, my question, can a zener + single/dual resistor be used as a pull-up source ...Quote from: DavidAlfa on November 12, 2022, 03:18:40 pmIt's probably some 5V micro, PIC/arduino? Mitsubshi indoor AC unit, where there's a connector for wifi connectivity, or rather, 5V SPI bus, 12V power supply.

author: oliv3r
author_rank: Frequent Contributor
timestamp: November 13, 2022, 09:54:03 pm
content: Quote from: Siwastaja on November 12, 2022, 03:23:59 pmPretty sure we didn't have fancy LDO's in the 80'sDidn't know they where 'standard linear regulators' however, and the datasheet isn't clear in its characteristics that its just burning the rest of the power. Also there's tons of designs that use LDO's albeit to do 3.5+V to stable 3v3.Quote from: Siwastaja on November 12, 2022, 03:23:59 pmExcept, this is not just some random MCU, this is an MCU that has 5V compatible GPIO's per spec. So why not use them if it is specced as such? The CEO of ESP even said so, here's a nice readuphttps://www.qworqs.com/2021/05/19/are-the-esp32-and-esp8266-5v-tolerant-yes-they-officially-are/Also, we're talking about 5 units, so if one of them fries their gpio's every 3 years, I don't even mind :pQuote from: Siwastaja on November 12, 2022, 03:23:59 pmAgain though, the point is to not having to use a level shifter :pQuote from: Siwastaja on November 12, 2022, 03:23:59 pmOk so lets discuss this instead. Can I power the level translator using a zener onlywe'd be talking nA's probably maybe 1mA?Quote from: Siwastaja on November 12, 2022, 03:23:59 pmYeah, I have not found a buck with integrated components, they all need external components sadly.

author: Siwastaja
author_rank: Super Contributor
timestamp: November 14, 2022, 11:58:43 am
content: Quote from: oliv3r on November 13, 2022, 09:54:03 pm5V tolerant is good for input, but the output is still a problem. Being a slave, you need to output MISO, and 3V3 high level won't cut it (at least reliably). But of course if you utilize the 5V tolerance of inputs, you only need one single level shifter for the MISO, not four like I said earlier.QuoteIt's not about frying anything (5V tolerant inputs can take 5V just fine as specified), it just... does not work, because 3V3 output is not reliably recognized as '1' by the 5V SPI master device, although it might appear to work by luck. CMOS input voltage thresholds are typically 30/70% of Vcc so high input level is approx. 3.5V for the 5V thing, and you want to add some noise margin - and also margin for Vcc regulation error, regulators are usually around +/-2% so 3.3V can be actually 3.23V and 5V can be actually 5.10V, except if it's powered straight off USB then it can be easily like 5.3V.QuoteZener shunt regulator is fine (series resistor + zener&capacitor in parallel), but a tiny linear regulator in small package is simple and affordable, too.QuoteThere are modules which need no additional components - although quite expensive, see this example:https://www.digikey.com/en/products/detail/recom-power/R-78W3-3-0-5/5226204

author: Siwastaja
author_rank: Super Contributor
timestamp: November 14, 2022, 12:18:53 pm
content: Quote from: oliv3r on November 13, 2022, 09:54:03 pm1980's were golden age of linear regulators because digital things like computers etc. emerged and started to require regulated supplies, and switch mode converters were at their infancy still. So often it was mains transformer, bridge rectifier, and linear regulators in large heatsinks.LDOs or "low dropout regulators" were available, but "low dropout" back then meant like 1V-1.5V of drop-out, instead of the standard 2-3V drop-out. Modern-day 100mV drop-out parts did not exist. 1980's LDO linear regulators were worse in other parameters and required specific types and values of output capacitors; standard dropout linear regulators were more tolerant. Yet people love to use 1980's LDO crap such as 1117 (OK, it might be from early 1990's, I don't know) still in in $current_year.But your use case has 12V-3.3V = 8.7V or 12V-5V = 7V of dropout, so you do not need LDO. Standard drop-out part is fine, which gives you more to choose from - and classic standard drop out parts like 78xx are much better and easier to use than the LDO part of the same era (like 1117). 78xx is stable with a small ceramic output cap; I have never seen one oscillate by accident.Power lost in linear regulator is always (Vin - Vout)*I, plus extra loss in ground pin current, only latter of which is part-specific, and only relevant in very low-power applications because it's small. This is why you need a heatsink if you try to make that 12V into 3.3V 500mA with linear regulator, no matter the type of linear regulator, the efficiency will be 27.5%.

author: oliv3r
author_rank: Frequent Contributor
timestamp: November 15, 2022, 08:36:17 am
content: Quote from: Siwastaja on November 14, 2022, 12:18:53 pmSo this is super interesting to learn. as mentioned, I wasn't aware an LDO is just a linear regulator, but with lower dropout. I thought they where some form of 'very simple' buck switcher, or 'magic'. So that's quite valueable informationQuote from: Siwastaja on November 14, 2022, 11:58:43 amYep, which is why I asked for the pull-up on MISO only in my start postthe other ports are fineQuote from: Siwastaja on November 14, 2022, 11:58:43 amYep, I stated that as well, it kinda works, but not well, so 3.5 + noise is what we're dealing with, hence the 5V pull up, so we go 0 -> 5V making nice and clean signals.Quote from: Siwastaja on November 14, 2022, 11:58:43 amExcellent! So I either find a cheap 12V -> 5V LDO or use a zener, it just depends on cost really. Wonder why the CAP though, I haven't seen many zener shunt regulator circuits, but they generally just had a current limiter and the zener ...

author: Siwastaja
author_rank: Super Contributor
timestamp: November 15, 2022, 06:32:13 pm
content: Zener shunt regulator needs capacitance because the load (level converter IC) will be taking pulses of current. Average power is very small, but power can be high for short period of time. That would require using tiny series resistor values for the shunt regulator, wasting massive amounts of power. But if you use capacitor to deliver short high current to the load, shunt regulator needs to provide only the average current, so series resistor value can be large, and power dissipation is low.But if the MISO pin is 5V tolerant as well, and if open-drain mode is available for the pin (or can be bit-banged using direction configuration register), then you can indeed use a pull-up to 5V to make it 5V level. Note though this limits the maximum SPI bus speed and reduces tolerance against noise; basically you enter the same calculations you do with I2C, regarding pull-up resistor value and total bus capacitance (parasitic capacitance of the device pins and wiring). Around 1kOhm is usually as close to sweet spot one easily gets without calculations, and SPI will then probably be good up to around 500kHz.

author: oliv3r
author_rank: Frequent Contributor
timestamp: November 30, 2022, 10:12:35 am
content: Quote from: Siwastaja on November 15, 2022, 06:32:13 pmThis is some golden advice!Basically, pull-up is a no-go as it limits you to 500 kHz, which on a 10 MHz bus won't really work. So a single channel directional level shifter is required (or some FET solution) ... But then, can we still use the zener + resistor + capacitor solution?

author: Siwastaja
author_rank: Super Contributor
timestamp: November 30, 2022, 11:04:25 am
content: Quote from: oliv3r on November 30, 2022, 10:12:35 amTo power the level shifter, yes, if it seems better (smaller, cheaper, etc.) than linear regulator IC, by all means. I would probably just pick the smallest regulator IC I can find for ease of design.Indeed, for 10Mbit/s SPI, you want to use actual level shifter ICs and not just kludge something together. But level shifters are small and cheap so don't worry about it, just avoid the "bidirectional" versions because on SPI, every signal is unidirectional. And make sure the shifters are specified for over 10Mbit/s, don't just look at the headline, but the tables which list actual voltage levels on the both sides; level translators are slower than headline under lower voltages.Finally, route SPI over contiguous ground plane (4-layer PCB is optimum if you can afford that; if not, don't skimp on stiching vias), and if it's longer than a few inches, source-terminate the lines, in other words, place small approx. 33-ohm series resistors right at the driver output pin (MOSI, SCK, NSS at master, MISO at slave). For short buses, this does not matter.

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 01, 2022, 12:15:07 am
content: Note that for SPI,TI TXU0304is a good choice for 3.3V to 5V level translation (can do 200 Mbit/s there), and is in stock at Mouser for 0.87€ apiece in singles in TSSOP-14. It's my new "go-to" SPI level shifter, as it can go down to 1.1V and up to 5.5V. Prior to this, I used e.g. 74LVC1T45 and 74LVC2T45, since I occasionally need to interface down to 1.8V and 5.25V.I've found these unidirectional level shifters very useful. The bidirectional ones tend to have artefacts at the low level due to the circuitry switching the direction, and that can easily create problems. For UARTs and SPI, I only use unidirectional ones. (I also have someTXU0202for UART use, and might have TXU0204 for UART with hardware RTS/CTS handshaking.) For I2C, I only use dedicated I2C level shifters. I don't recall if I have any in stock, but would reach for the PCA9306 variants from different manufacturers for level shifting between 1.2-3.3V and 1.2V-5.5V at up to 400 kHz (fast mode).I also occasionally use full isolators. For SPI, I look at Si8641 or ISO6741; for dual UART or UART with RTS/CTS, Si8642 or ISO6742; for I2C, ISO1640.Even using a full isolator, an isolated DC-DC converter (TEA 1-0505, RFM-0505s), and a voltage level shifter in front, doesn't cost that much.I'm not an EE, I'm a hobbyist with much more software than hardware experience; I just often interface my microcontrollers to various sensors and Linux single-board computers.

author: oliv3r
author_rank: Frequent Contributor
timestamp: December 01, 2022, 05:03:31 pm
content: What I'm trying to replace/avoid is this board (see attachment) which seems to be an EBAY favoritehttps://www.ebay.com/itm/134140416433?hash=item1f3b6451b1:g:~PwAAOSwPwFiob3bamongst others ... But I wonder if that's actually a level shifter? probably a FET?

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 01, 2022, 11:40:36 pm
content: Quote from: oliv3r on December 01, 2022, 05:03:31 pmIt's the bidirectional one using one N-channel MOSFET, likely a 2N7002 or BSS138 clone based on D702 marking on the SOT-23-3 chip, plus two resistors, per signal. Board is probably a clone of theAdafruit one. You can find variants of the circuit all over the net if you search for "bidirectional MOSFET level shifter".As it is bidirectional, I don't think it is a good fit for SPI or UART, because they really are unidirectional signals and bidirectionality can only cause issues here.

author: oliv3r
author_rank: Frequent Contributor
timestamp: December 06, 2022, 04:26:32 pm
content: Well the board I'm trying to replace is currently using exactly this oneBut I want to avoid using the 4 channels; just using 1 chip though I'm okay with if they are cheap enough ...You are correct in that it seems to be a BSS138 one, but that's not a level shifter per say, it's just a 'Logic Level Enhancement Mode FET'.But I'll scourge LCSC to find a unidirectional one, as I really do not need the bidirectional of course.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 06, 2022, 04:49:12 pm
content: If the single MOSFET solution is one that uses a pull-up to perform level conversion, it is as slow as just using a open-drain output with 5V pin tolerance, with a pull-up, with no benefits over it IMO. Probably even slower unless the MOSFET is of very small Cg type.The idea of that MOSFET circuit is, if you don't have a microcontroller pin with 5V tolerance and open drain mode, then you need the MOSFET to do the same.An actual converter IC goes to higher frequencies.Does this MOSFET thing really work with the 10MHz SPI? Have you looked at the edges with a scope? It might be very marginal.

author: Martinn
author_rank: Frequent Contributor
timestamp: December 06, 2022, 07:23:40 pm
content: Not sure if I missed that:The ESP-WROOM-02 datasheet says 500 mA max, but 80 mA average.Most likely the ESP will use a few hundred mA just for wifi transmit, which are short pulses. So an LDO would only see 0.7 W on average.

author: Siwastaja
author_rank: Super Contributor
timestamp: December 06, 2022, 07:43:36 pm
content: Quote from: Martinn on December 06, 2022, 07:23:40 pmThis is OK for thermal design, since wifi transmit peaks are in order of tens of milliseconds, and thermal inertia of even small SMD regulators is larger. You still need to be sure you don't exceed the maximum current of the regulator because they employ short circuit current limiting and that may get triggered not much beyond the maximum current. (Operating beyond maximum ratings is not guaranteed, no matter how short it is. Voltage may also drop more than one expects.)Also wifi transmit peaks are too long to be practically handled by capacitors, so the regulator really needs to supply the full peak current. But it's OK to calculate junction temperature based on the average power and RthJ-A given in the datasheet.

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 07, 2022, 08:41:55 am
content: Quote from: oliv3r on December 06, 2022, 04:26:32 pmConsider theTI TXU0304-Q1, which LCSC saysit can ship in 3 days for $0.87 apiece, in TSSOP-14 footprint (0.65mm pitch, but hand-solderable).I personally buy them from Mouser, where TXU0304PWR costs 0.87€ in singles and TXU0304QPWRQ1 1.03€ in singles, both in TSSOP-14, and well stocked (>18000 and >36000 in stock as of early December 2022).I just created a small break-out board (15.24mm × 15.24mm) for it in EasyEda,here. It's in Public Domain, but I haven't used it yet. It is so simple there should be no risk of goofing it, as you only need the TSSOP-14 TXU0304 chip, and two 0.1µF = 100nF bypass capacitors in 0603. You should be able to get and populate five such boards for less than ten bucks.Of course, it is not just for SPI, though. You can use the same level shifter for UART, and have two unidirectional (A to B) signals on top. The same board works for TXU0204 as well, in which case the third signal is in the same direction as the fourth, so you can use it for example for UART with hardware handshaking (RTS/CTS). And for TXU0104, which has all four signals in the same direction.It might be better to leave the signal names blank (silkscreened completely white), so one could write the signal names on top depending on which chip is being used. And if you don't care about the ENAble line, you could simply tie it in to VCCA or VCCB. I left it out, so that one could use a jumper if one wants to tie it to a MCU pin, for example to multiplex SPI buses with devices that do not have or honor the CS pin. Anyway, Public Domain, so do what you wish with 'em. No warranties, though, as usual.

author: oliv3r
author_rank: Frequent Contributor
timestamp: December 17, 2022, 10:23:35 pm
content: Thanks for that, but there's a dime a dozen of those breakoutsI was really looking for something tiny, just for the 1 pin (MISO), ideally in SOT23-3, though SOT23-5 can work just as well (GND, VCC-lo, VCC-hi, in, out). But I haven't scoured yet

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 18, 2022, 01:13:00 am
content: I've used SN74LVC1T45DBV in SOT23-6 quite happily. These are unidirectional, except that side A has an extra pin that can control that direction. For one-bit stuff, I'd love to use them still, but they're not easy to find right now; LCSC does have them (TI SN74LVC1T45DBVR) in stock for US $3.28 for ten (and in SC70-6/SOT-363, SN74LVC1T45DCKR, for US $3.31 for ten).Mouser does have NXP 74LVC1T45GW-Q100H and 74AXP1T45GWH in SC-88/SOT-363 in stock, which seems to be very similar to the SN74LVC1T45 I've used before (except for automotive qualification or the exact logic level trigger voltages, respectively). But SC70-6/SOT-363 is tiny, entire footprint 2.15mm × 2.40mm, six legs with 0.65mm spacing, so carefulling is needed. SC-74/SOT23-6 is much easier for me, even if it is just a tiny bit larger (2.9mm × 2.8mm, with 0.95mm spacing).Whatever you pick, I recommend you get ten even if you now only need one; they are that useful whenever one works with different voltage levels (which for me, is very often).