🕰 RTC Battery Power with Automatic Switching to Main Source
Intro
If your device has separate RTC (Real Time Clock) chip you will definitely want to keep clock running continuously, even if the main power is not present or battery (if exist) is disconnected.
For this purposes on many electronic device boards (especially on old phones with removable battery) you can see small coin cell battery, that act as an independent backup powering for RTC IC.
Structural Diagram
ORing block have two power inputs and one power output, so it give a chance to connect backup coin cell with external power input and connect output voltage to the RTC chip.
Electrical Schematic (FET + SBD)
Main power pass through diode D1
Backup power pass through transistor Q1
R1=10k-470k
In case of powering from another battery instead of USB use diode instead of MOSFET! |
Schematic Simulation
Using Microcap 12 it's very easy to simulate schematic working:
*It is recommended to replace the silicon diode with a Schottky diode. |
When coin cell is not present and USB device is powered from USB 5V the RTC supplied from USB through diode D1, so the output voltage less by diode drop voltage.
NOTE: as you can see if R1=100k we have current leakage 50uA which is ok for USB powering, but if you use another Li-Ion battery for board powering 50uA in sleep mode is a big leakage, so you need to increase resistance of R1 or better replace MOSFET by the Schottky diode (SBD).
USB Only
Battery Only
When main power (USB 5V) is disconnected RTC supplied from secondary input (coin cell battery) through MOSFET Q1:
USB and Battery
When both power sources is connected (USB 5V and BAT 3V) RTC supplied from main power (USB 5V), so secondary power input (coin cell backup battery) not drained.
Electrical Schematic (SBD + SBD)
Li-Ion + Coin Cell
When both Li-Ion battery (main power source) and backup coin cell are connected the RTC powered only from the Li-Ion battery.
Li-Ion
When Li-Ion battery (main power source) disconnected the RTC powered from backup coin cell.
Which battery is suitable?
In case of using RTC chip (e.g. the most popular PCF8563)VIN supply voltage range very wide:
PCF8563T SOIC-8 | ![]() |
PCF8563TS MSOP-8 | ![]() |
Clock operating voltage: | 1.0V-5.0V |
Coin cell battery could be different chemical type, which means different voltages:
MnOâ‚‚ | LiMnOâ‚‚ |
1.5V | 3.0V |
So, because minimum RTC operation voltage is 1.0V it's possible to use even low voltage 1.5V MnOâ‚‚ coin cell battery.
Board
Using SOD-323 package diode and SOT-23 transistor with 0402 components makes backup circuit pretty small.
In case of using just two diodes you can replace it by the diode array in SOT-23 package, but in my design I use two separate Schottky diodes SOD-323 for BOM optimization (because it's more common).
Real Testing of Backup Circuit
Testing performed on the development board.
VIN1 (USB) MAIN POWER | VIN2 (BAT) BACKUP POWER | VOUT RTC_VDD | NOTES |
5.002V | x | 4.867V | USB powering is connected, battery is absence |
x | 2.952V | 2.947V | USB powering is not present and battery is connected (backuping) |
5.003V | 2.968V | 4.869V | USB powering is connected and battery is absence |
Changing Coin Cell Battery without Clock Reset
If you need to change the RTC coin cell battery (no external supply connected) the clock will be reset.
If you want to save clock you can additionally have backup capacitor, that can act as a small reservoir of energy for supply RTC chip during battery replacement.
How much time can you have?
If RTC chip current I <= 1 uA:
Backup Capacitance | Time |
4.7 uF | 6-7 seconds |
1000 uF | 20-30 minutes |
Conclusions
- Battery reserve powering of independent RTC it's not difficult, all you need it's ORing (FET + SBD) | (SBD + SBD)
- If you use battery (e.g. Li-Ion) for device powering use (SBD + SBD) schematic to achieve low sleep current
- If device connected to the primary (main) power supply RTC chip doesn't drain battery, that give a chance to significantly increase device clock life
- Additional backup capacitor can be used for powering RTC chip during coin battery replacement
- Using internal MCU RTC can be more smart solution (e.g. some STM32 have dedicated VBAT pin for RTC and some register data backuping).
Why can't I use the p-channel MOSFET solution if I am giving power from ESP32 and a 1.5V coin cell
That's why it's better to use two diodes and +3.3Vrail(you will save coin battery charge and power RTC from big battery)