Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

User avatar
corz.org
Posts: 80
Joined: Fri Feb 03, 2023 10:44 pm
Location: Aberdeen
Contact:

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby corz.org » Fri Apr 07, 2023 2:32 am

I regularly power modules via external power and plug in and out the on-board USB to flash with no issues, ever.

But then, my regulated external power goes in the 3.3V pin. I wouldn't have thought to put 5V on the 5V USB pin, because that's crazy!

You can pick up decent breadboard power supplies on AliExpress for under a pound.

Craige Hales
Posts: 94
Joined: Tue Sep 07, 2021 12:07 pm

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby Craige Hales » Fri Apr 07, 2023 2:33 am

I found https://www.reddit.com/r/esp32/comments ... from_a_dc/ which points to https://www.youtube.com/watch?v=yZjpYmWVLh8 which points out that there is an EN pin that can disable the regulator so you can supply 3.3V. You are right, the diagram is hard to follow: VIN is shown and not implemented and EN is implemented and shown without the proper symbol.
Craige

marcmerlin
Posts: 30
Joined: Mon Apr 17, 2017 12:50 am

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby marcmerlin » Sun Apr 09, 2023 9:12 pm

corz.org wrote:
Fri Apr 07, 2023 2:32 am
I regularly power modules via external power and plug in and out the on-board USB to flash with no issues, ever.
But then, my regulated external power goes in the 3.3V pin. I wouldn't have thought to put 5V on the 5V USB pin, because that's crazy!
Well, it's not that crazy, all ESP32 boards I've bought do expose 5V on a breadboard pin, because it does go to that board's voltage regulator which makes 3.3V and also makes 4.2V for an onboard lipo charger and many circuits have 5V, so why not? But I guess it's become clear that dual powering from the 5V pin and the USB plug, is not a good idea since there is no protection between them. That said, I'm still not sure how that would damage the USB chip except maybe due to some overcurrent condition through some trace that would overheat and get damaged.

I think I can fix this by putting a diode between the 5V input which goes to my power converter, that way my batteries will provide 4.3V or so to the ESP32 Vreg, and if it gets plugged into USB for flashing and gets 5V from USB, that 5V will not be able to flow from USB plug back through the blocking diode and into the rest of my circuit that needs a higher amperage than USB is able to deliver, but would work from 4.2V instead of 5V.

All this said, I'm still not too sure what part of the dual 5V powering somehow damages the USB chip, on a technical level, can you think of a reason?
And does my plan of just adding a diode which could argue should be part of those breadboard chips (like the arduino ones that do support dual powering all day long), sound like it would solve my problems?

Thanks

marcmerlin
Posts: 30
Joined: Mon Apr 17, 2017 12:50 am

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby marcmerlin » Sun Apr 09, 2023 9:21 pm

Craige Hales wrote:
Fri Apr 07, 2023 2:33 am
I found https://www.reddit.com/r/esp32/comments ... from_a_dc/ which points to https://www.youtube.com/watch?v=yZjpYmWVLh8 which points out that there is an EN pin that can disable the regulator so you can supply 3.3V. You are right, the diagram is hard to follow: VIN is shown and not implemented and EN is implemented and shown without the proper symbol.
Thanks Craig, that's the thread/message I should have found and answered the question. I really appreciate the link.

For what it's worth, I'm not sure about the EN pin bit they were talking about, EN is the reset pin, so that would reset the chip. However, they give 2 useful bits I'll paste here:
"An alternative is to power at 4.2V via the battery connector. The TP4054 can take up to 7V on its BAT pin, and the charger won't enable unless the voltage drops below 4.2V, so one could also supply, say, 5V via this connector. The D2 diode will protect USB.

One third option is to supply 5V via VBUS pin, ensuring it is as close as possible to the USB voltage (a difference of a few tenths of a volt may not cause any problems). If paranoid, a diode can be used to protect the USB supply."

Basically I've been doing #2 which seemed obvious except that I guess I got in a condition where my 2 5V sources were not close enough, which is not surprising, and caused an unwanted current flow that honestly neither my laptop USB or my circuit voltage regulator, care about, they are both protected against minor backflow, but somehow it seems to damage a trace on the breadboard.
Using the battery pin however, I didn't think about that, that is a smart idea, I like it (and saves a diode)

Thanks for the answers/hints, really appreciated.

User avatar
corz.org
Posts: 80
Joined: Fri Feb 03, 2023 10:44 pm
Location: Aberdeen
Contact:

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby corz.org » Sun Apr 09, 2023 9:32 pm

The most likely cause of frying the chip with dual-powering is poor design. Early Chinese modules are prone to all sorts of failures due to "user error". Original clone WROOM-based DevKit boards, for example, would pop when you connected the ground from the 3.3V side to the ground of the 5V side. The internet is full of posts about early Wemos board's issues, too.

Later iterations generally fix these issues. I have a recent Wemos D1 R32 which has been Voltage-abused in all sorts of ways but soldiers on regardless.

If I had an old module that was screwed like yours are, even though I religiously recycle and re-use whenever possible, I would bin it and buy a replacement. The mental effort and time taken tracking down and resolving these issues isn't worth it. You can buy a new module for under a fiver (£5), so even a few minutes spent thinking about it (or typing about it) is counter-productive. Live and learn. Move on.

Diodes are great, but be careful about heat dissipation. Also, as mentioned, in the time (== money) it takes to solder one diode, you could have bought a new module. And I'm assuming your soldering skills are good.

If you want dual power, get a proper power supply. If you want to power from a battery, get a battery shield (auto-charging 18650 shields are super-cheap on AliExpress and work great).

If you really like masochistic pursuits; why not buy some UART chips and solder those in!

marcmerlin
Posts: 30
Joined: Mon Apr 17, 2017 12:50 am

Re: Can I still flash wemos/lolin ESP32 via pin headers if USB is destroyed?

Postby marcmerlin » Fri Apr 21, 2023 5:23 pm

corz.org wrote:
Sun Apr 09, 2023 9:32 pm
The most likely cause of frying the chip with dual-powering is poor design. Early Chinese modules are prone to all sorts of failures due to "user error". Original clone WROOM-based DevKit boards, for example, would pop when you connected the ground from the 3.3V side to the ground of the 5V side. The internet is full of posts about early Wemos board's issues, too.

Later iterations generally fix these issues. I have a recent Wemos D1 R32 which has been Voltage-abused in all sorts of ways but soldiers on regardless.
Fair. I did already buy new chips, but I'm ok re-using these for applications that I only need to flash once, they work ok otherwise.
As for the diode, I do want to protect the new ones I bought, I don't need to solder the diode on the chip, simply on my wire sending 5V to the board from my battery source. This will bring the battery voltage down to 4.4V or so, which means current won't flow from the battery if I connect 5V from USB during flashing, and current will not backflow to the battery either due to the diode.
This takes less than 1mn and should make my circuit safer and reliable.
Agreed?

Who is online

Users browsing this forum: No registered users and 209 guests