1

I'm dipping my toes into using LiPo batteries for supplying power to small devboard projects, currently with an LOLIN S2 mini.

So I got hold of a MH-CD42 module, which seemed like a safe way to start with.

I came up with this example schematic to illustrate what I'm trying to do: to use the onboard USB port to power the board and charge the battery when connected, and to power the board with the battery if USB is disconnected. In this schematic I would need to flip the switch to accomplish this but I wonder if there is a way to wire this up so that a switch is not needed and the board does not reset when (dis)connecting the USB connection. Any thoughts on this are appreciated.

Schematic

Greenonline
  • 3,152
  • 7
  • 36
  • 48

1 Answers1

1

I can see what you are trying to do (make use of the already present USB connector), but I think that you are looking at it the wrong way, as well as trying to make the MH-CD42 work (or rather, connect it up) in ways that it isn't really meant for.

Forget about using the onboard USB of the WEMOS.

You should connect the VOUT to the VBUS as you are meant to (check the usage and diagram in the link to the MH-CD42 that you provided):

MH-CD42 connections

Provide a separate female USB connector (or alternate power supply connector) to VIN of the MH-CD42, and apply power that way (instead of trying to gain "dual usage" from the USB connector onboard the WEMOS).

In this manner, you are using the MH-CD42 correctly - it will automatically do the "switching" for you and no power glitches will occur when the USB (or whatever) power supply is removed (from VIN).

In addition, you no longer have to worry about dual-purpose/dual-direction power lines - that seems like a recipe for disaster.


An alternative method (without the MH-CD42) can be found in this answer to How to create automatic dual battery changeover/switching circuit for uninterruptible power?

Greenonline
  • 3,152
  • 7
  • 36
  • 48