3
\$\begingroup\$

I'm seeking guidance on accomplishing seamless power source switching for a microcontroller (ATtiny85). My objective is to seamlessly transition power input between two distinct sources (Raspberry and Button cell). I am exploring various methodologies such as diodes, MOSFETs, relays, and specialized power management ICs.

Could you provide insights into the most effective approach for my specific scenario? Additionally, I would greatly appreciate any recommended reference links or resources where I can find comprehensive solutions and detailed circuit designs for implementing this power source switching mechanism.

\$\endgroup\$
3
  • \$\begingroup\$ What sort of current will the ATtiny85 circuit draw? \$\endgroup\$
    – user85471
    Commented Aug 11, 2023 at 6:27
  • 1
    \$\begingroup\$ Duplicate of OR-ing power supplies (diode or mosfet) \$\endgroup\$
    – CL.
    Commented Aug 11, 2023 at 6:44
  • \$\begingroup\$ How much time will the device spend on the battery vs the Pi? What else is on the ATTiny circuit? \$\endgroup\$
    – jonathanjo
    Commented Aug 11, 2023 at 7:00

3 Answers 3

4
\$\begingroup\$

Diodes: it's the simplest solution, but inefficient (especially on low voltage), because you have the voltage drop of diode (for a cell coin, it's quite some loss).

MOSFETs: the loss is lower (specially for low current). Double check you can turn the MOSFET fully on (can restrain quite a lot the choice of MOSFET for very low voltages).

Dedicated IC with integrated MOSFETs: Probably the best solution for low voltage, low power applications (the MOSFET is driven optimally). Depending the component, you can have a "preferred" source that you use, even if it's voltage is lower (ex.: only use the backup battery if the raspberry is absent).

Dedicated IC with external MOSFETs: A bit more complicated to integrate, but you can choose your MOSFETs. Best solution for higher currents, higher voltages, or if you which minimal losses but accept to use oversized MOSFETs (we did that in one application where we had to minimize thermal dissipation: we ended up using 100 A rated MOSFETs for 3 A, just to get very low resistance (Rdson)).

Relays: They are big, slow and expensive: I can't see any good reason to use them in this situation, excepted if isolating the 2 power supplies in case of a bad failure is critical. It would require big capacitors, as they would have to provide all current for tens or even hundreds of milliseconds.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ There's also components that fit in both "diodes" and "dedicated IC with integrated MOSFETs"; look at TI's SM74611 for instance. \$\endgroup\$
    – Hearth
    Commented Aug 11, 2023 at 18:06
  • \$\begingroup\$ not sure it works well for powering directly a micro-controler (which might not like switching regularly between nearly no drop to a standard diode drop). But if powering a (good) switching regulator, I think it can be quite useful. Thanks for sharing the existence of this kind of components (It would have been handy in some past designs). \$\endgroup\$
    – Sandro
    Commented Aug 11, 2023 at 19:03
3
\$\begingroup\$

For seamless power switching of microcontrollers, I suggest you consider using a dedicated power management IC, which allows more precise control of the power switching process. For example, you could choose a power-management IC with dual-input, auto-switching capability that automatically switches to one power supply when the other fails, avoiding interruption.

At the same time, this kind of IC usually provides protection functions such as overvoltage and overcurrent to ensure the stability of the system.

\$\endgroup\$
0
\$\begingroup\$

I had a similar obstacle recently on a project that uses a microcontroller (ATTiny84 in fact) to detect the loss of mains power and switch over to a rechargeable cell seamlessly.

I used a dedicated IC that takes two independent voltage sources (one primary and one backup) and outputs 3.6 - 5 V for the microcontroller to run from. It also has single digital output that indicates which of the two input supplies is being used.

The part I used is a Texas Instruments TPS2114. It is extremely simple to use and even allows you to set an output current limit by choosing an appropriate resistor.

My mains supply was converted down by first using a generic 10 V DC wall adapter and then that was regulated down to 5 V using a jelly-bean regulator like a generic 1117-5V. This was used as the Primary 5 V supply. So when the mains power was available, the system just runs from the mains.

When the mains power was lost, the TPS2114 IC sees the primary supply dipping down below the voltage of the secondary supply (in this case a 4.2 V Li-Ion cell). The TPS2114 switches over to the cell and the microcontroller detects the changeover using the digital signal provided.

When mains power is restored all of that happens in reverse. At no point does the microcontroller suffer any ill effects and there is no brown-out or glitch on it's VCC rail. All that happens is that the 5 V quickly (but smoothly) falls to 4.1 V or so which is the cell voltage at the time.

There's nothing special about the TPS2114 particularly, there are many similar chips that might suit your purpose better. This one just happened to be ideal for me. (Apart from the fact that it's tiny and hard to solder!).

The other nice thing about this method is that I didn't need to have a Li-Ion cell charging circuit. When the system runs from mains, I can just yank the cell, replace it with a freshly recharged one, without the system being interrupted.

\$\endgroup\$

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