1
\$\begingroup\$

Please excuse my beginner's question. Having read about electronics and logics basics and specific power-related questions, I've not found anything that would explain to me how to realize the following scenario.

I have a main circuit with an Attiny13, a few LEDs and FETs turning motors on or off. This circuit is powered by a 3.7V LiPo battery connected to Vin and GND.

I have a USB charging board that I can connect my LiPo battery to. I would like to use that. But I don't want to always unplug the LiPo from my board, but instead have the charger connect via a cable to it.

I am not looking for a parallel loading-and-running circuit. I am searching for an exclusive automatic switch acting like the following:

If there is power on my board's charging connector, cut off the main circuit and let the power only flow to my battery.

If there is no power on my board's charging connector, connect the main circuit and let the power flow from my battery through the circuit.


Since this is a small-sized PCB project, a ready IC would be great, but a few discrete components will do either. If you could explain to me, how to connect it and what to be careful with, that'd be nice.

Side question: Is it true that I should put decoupling capacitors between Vin and GND of my MCU, Vin and GND of my battery and between anode, cathode of every of my current drawing components (like LEDs)?

\$\endgroup\$
1
  • \$\begingroup\$ "I have a main circuit with an Attiny13, a few LEDs and FETs turning motors on or off. This circuit is powered by a 3.7V LiPo battery connected to Vin and GND" Please show with a schematic or block diagram. \$\endgroup\$ – winny Nov 5 '20 at 11:54
0
\$\begingroup\$

From what I understand, your device either runs from battery or, if it's charging, your device is then unpowered and only charging battery. So you could have a P-Ch MOSFET on the main power line that will be open when Vcharger=0V and closed when Vcharger=5V. I suggest you connect Vcharger to the gate of that MOSFET (via some 100R) and have a pull-down of some 10k on it too. So if there is no charger, your MOSFET has gate to the ground and it's conducting, but when you plug in the charger, it closes.

Here is my crude 1 min paint ullustration. Let me know if I understood you wrong (I skipped the charger circuit itself, the one the converts 5V into some 4.2V, it doesn't matter here, it's obviously between the battery and the charger, here the focus is on MOSFET gate): enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.