Skip to main content
Visitor II
December 2, 2020
Solved

Connecting a battery to STM32F401 to supply power only at night

  • December 2, 2020
  • 5 replies
  • 7454 views

Hello ST community.

 

I'm using STM32F401RDT6 microcontroller which is powered during the day by a solar panel (power regulators converts the panel's voltage to 3V3). The MCU uses its internal RTC for logs and the issue is to keep the RTC running from the low power mode during the night.

I would like to place a coin bettry and connect it to the MCU via the VBAT pin in a way that during the day only the solar panel will feed the MCU, and at night only the battery will do so.

 

Connecting the battery directly to VBAT causes the battery to drain out even during the day which is not desirable.

 

I Couldn't find any good guidelines for this solution. I hope this forum could help.

Thanks in advance,

Raz.

    This topic has been closed for replies.
    Best answer by Peter BENSCH

    It is the main purpose of the VBAT pin to supply the VBAT domain when VDD is absent. You will find in the reference manual of the particular device:

    The VBAT pin allows to power the device VBAT domain from an external battery, an external super-capacitor, or from VDD when no external battery and an external super-capacitor are present.

    VBAT operation is activated when VDD is not present.

    The VBAT pin supplies the RTC and the backup registers.

    Connecting the battery to VBAT will not discharge it as the VBAT pin is disconnected from VDD via an internal switch when VDD is present.

    Good luck!

    When your question is answered, please close this topic by choosing Select as Best.

    /Peter

    5 replies

    Technical Moderator
    December 2, 2020

    It is the main purpose of the VBAT pin to supply the VBAT domain when VDD is absent. You will find in the reference manual of the particular device:

    The VBAT pin allows to power the device VBAT domain from an external battery, an external super-capacitor, or from VDD when no external battery and an external super-capacitor are present.

    VBAT operation is activated when VDD is not present.

    The VBAT pin supplies the RTC and the backup registers.

    Connecting the battery to VBAT will not discharge it as the VBAT pin is disconnected from VDD via an internal switch when VDD is present.

    Good luck!

    When your question is answered, please close this topic by choosing Select as Best.

    /Peter

    RLand.2Author
    Visitor II
    December 2, 2020

    So connecting the battery completly separated and directly to VBAT pin, and another separated power supply connected to VDD will be sufficient?

    Technical Moderator
    December 2, 2020

    Absolutely correct.

    Please make sure not to exceed the max voltage rating at the VBAT pin.

    RLand.2Author
    Visitor II
    December 2, 2020

    Roger that.

    Thanks for the support.

    Visitor II
    November 22, 2022

    @Peter BENSCH​  I would like to know if it's possible to perform a software switching from vdd to battery (while knowing that vdd is always present). it's in the case of activating BLE when system is powred from current loop. Also the charging could it be desactivated?

    Thanks in advance

    Technical Moderator
    November 22, 2022

    VBAT is only automatically switched to the VBAT domain. There is no other way, because everything else is normally not supplied in battery mode and the CPU loses access to the switch after switching to VBAT.

    Maybe you should look for another solution, e.g. in connection with some external logic?

    If I understand correctly, the supply voltage of the STM32 should come either from the battery (night mode) or from the solar panel (day mode), right?

    In this case, a simple OR circuit with two Schottky diodes could decouple the two voltages. If, for example, the solar voltage is set slightly higher than the battery voltage, the solar voltage would always have priority, while the battery voltage would only be loaded when there is no solar voltage.

    What do you mean by deactivating charging, i.e. charging of what?

    Visitor II
    November 22, 2022

    Thanks for your quick reply

    It's not the same application as @RLand.2

    I do not use solar panel. but harvesting from a current loop 4-20mA to charge a supercap that will power the mcu only when ble is activated.

    i think in that case i should switch externally between source line and battery.