back-up battery circuit - Page 1
Forum section: electronics / beginners

author: Watth
author_rank: Frequent Contributor
timestamp: January 16, 2022, 07:42:53 pm
content: Hello!I'm looking into a way to add a back-up battery to a MCU normally supplied by a main battery.I'd like to have a back-up battery that would keep the MCU's memory and RTC running when the main batt is being changed.Is this something that would work?LowVDetecton is a input of the MCU that detects the loss of the main power, to set the MCU to a less power-consuming mode.When the main bat is disconnected, Q3 should allow current from the back_up (BT3) to reach the MCU.D2 prevents BT3's voltage to be detected by LowVDetection as well as to reach Q3's gate.So, would that work as intended?

author: Benta
author_rank: Super Contributor
timestamp: January 16, 2022, 07:59:32 pm
content: What's Vin? Is it VDD?

author: Watth
author_rank: Frequent Contributor
timestamp: January 16, 2022, 08:13:03 pm
content: Quote from: Benta on January 16, 2022, 07:59:32 pmYes!

author: Peabody
author_rank: Super Contributor
timestamp: January 17, 2022, 12:18:54 am
content: I think your circuit should work well. The diode would typically be a Schottky, and the mosfet would have a low Vgs threshold voltage.

author: Watth
author_rank: Frequent Contributor
timestamp: January 17, 2022, 10:25:34 am
content: Quote from: Peabody on January 17, 2022, 12:18:54 amThanks for the relpy!What would be an appropriate Vgs value?For the diode, I'm planning to use what ST recommends:BAR42FILM, that's indeed a Schottky (I forgot to use the proper symbol in my schematics).

author: Peabody
author_rank: Super Contributor
timestamp: January 17, 2022, 03:32:53 pm
content: You haven't told us anything about the processor or the batteries, but it appears you are driving the processor directly from the battery with no regulator, so I'm gonna assume you're using a single lithium-ion or LIPO, nominal 3.7V. There are a number of P-channel mosfets with a typical threshold voltage around 0.55V, with a maximum of 1.0V. Any of those should work. Something like a DMP1045U. But finding any in stock could be a problem. That diode is only rated to 100mA. Is that enough?

author: Watth
author_rank: Frequent Contributor
timestamp: January 17, 2022, 04:28:55 pm
content: Quote from: Peabody on January 17, 2022, 03:32:53 pmThanks for your reply!The main battery is not directly fed to the MCU, but goes through a regulator to be lowered to 3V.For the N-ch mosfet, I found this one:RE1C001ZPTLthat is still in stock, with Vgs between 0.3 and 1V. I checked on RS, TME and Farnell, there seems to be several models that are still in stock. 100ma is more than enough since the back-up battery would only feed the MCU (or may be at most an e-paper display that need very low current).threshold Vgs is the minimum voltage to allow current through DS, right?

author: Peabody
author_rank: Super Contributor
timestamp: January 17, 2022, 09:41:26 pm
content: Well first, it's a P-channel mosfet, not an N-channel.The threshhold voltage is the gate voltage at which the mosfet just *begins* to conduct. The full story can be seen in Figure 6 of the datasheet, which shows you get your full 100mA at about 1.6V. But if the battery is at 3.3V worst case, that's still plenty of room. What's not so great about your mosfet is its Rds(on) which is a high 2 ohms or more. That's the resistance of the mosfet when it is fully turned on. That will cause a voltage drop across the mosfet, and heat dissipation in the mosfet. But at 100mA or less, it may still work fine. But you should calculate the voltage drop and heat dissipation at the expected current to see if either is important. By contrast, the DMP1045U has Rds(on) of less than 0.05 ohms, which would have essentially zero effect at 100mA.The diode will be carrying the normal current from the main battery almost all the time. Is 100mA enough for that part?

author: Watth
author_rank: Frequent Contributor
timestamp: January 18, 2022, 12:30:49 pm
content: Quote from: Peabody on January 17, 2022, 09:41:26 pmDarn, how did I miss that? Well it's a typo, I meant of course I could still find P-ch Mosfets.The back-up battery should be a 3v coin-cell (CR/BR 1225 or something like that).Considering current, the main battery voltage probe is, in case it's zero, to set the MCU in low-power mode (enough to display a warning on the e-paper, and set the MCU to lower functions) so a few dozen mA at most, then even less.I found another MOSFET of the same series you suggested earlier :DMP2100Uwith a RDS (ON) that should stay under 100 mΩ. VGS(th) between 0.3 and 1.4 V (so well under the 3 V).Rg is quite low (250 Ω), should I add a resistor on the gate so that not too much power is lost in the MOSFET through the gate?I made new schematics that shows that the main battery (3.7 V Li-Po) voltage goes first through a charger IC (XC6806) then a regulator (AP2125N-3.0TRG1.This means that the main battery offers higher voltage that could drive the MOSFET if VGSis an issue.See bellow for updated (and more complete) schematics.Thanks again for your reply!

author: Peabody
author_rank: Super Contributor
timestamp: January 18, 2022, 06:22:41 pm
content: I don't know what Rg is. I don't see that spec in the datasheets of other brands. In any case, there's no DC current flow through the gate of a mosfet, other than leakage. The only current is what charges or discharges the gate capacitance. I don't think I've ever seen a series gate resistor used in a circuit like this.Thanks for posting the circuit. What microcontroller will you be using?You're on your own re the XC6806. The datasheet says it's been discontinued, and I don't know anything about it. The other mosfet and the regulator look ok.So the backup battery is there only so you can change out the main battery without turning off the MCU? As an alternative, would it be possible to plug in power to the USB to do that? Then you wouldn't need the backup battery. What's bothering me is that the current circuit will drop the VDDA voltage to about 2.7V because of the Schottky diode, and I'm looking for an alternate circuit without that drop. You could do away with the mosfet, the resistor and the diode, but would need to replace that with a way to read battery voltage so you could go into low-power mode when it gets low. Then VDDA would be the full 3.0V.You will need to use a main battery with built-in protection. The XC part doesn't include protection.

author: Watth
author_rank: Frequent Contributor
timestamp: January 19, 2022, 12:57:19 pm
content: A word on the project: it's a kind of wristwatch that I'm doing as a hobbyist and as a study case, therefore this is why I bother with extra efforts to keep the µCU's power supplied to keep its inner RTC and RAM working. Also this is why I bother with features that can be seen as unnecessary. The device includes many LEDs and to that effect I2C LED drivers; and a SPI-controlled e-paper display (EPD). In low power mode, only the EPD (that consumes very very low power) will be used (to warn user that the batt and USB power are missing)Rg is "Gate resistance", according to the Datasheet, and I thought it was the resistance between the gate and source but I must be wrong.The µCU should be aSTM32L011F3P6that can work with a voltage as low as 1.65V.So Ire-remadethe schematics to include more details, such as the XC's complete pinout. But as not everything is decided yet, I omitted details on the µCU's particular pins that would be used, especially since some signals (XC's shutdown command or Vusb's detection) could go through an I/O extender. Also you can see I removed the diode.Note that VDDA is now VDD.I didn't specify every pins of the µCU and I/O extender wiring.Considering the XC6806 and its battery protection features, in addition to limiting and monitoring the charging voltage ant current :At first I really simplified it on the schematics, but it has more pins (therefore functions), for example it provides thermal protection as it has an external thermistor to check on the battery's temp. For the battery's low voltage protection, I'm planning on monitoring it on the µCU, to warn the user when the battery gets under a first threshold (e.g. 3.5V), and under a lower voltage (say about 3.3 V) command the XC to shutdown to prevent over-discharge of the battery.It provides a PGB ("Power Good status") output, that indicates if Vusb is high enough (> Vbatt). This can be read on the µCU to detect USB power, therefore directly monitoring Vusb is not needed. This needs to be taken into account by the µCU to function nominally when if the battery is disconnected (Vbatt = 0) but the device can be powered by USB.I'm trying to figure out if the Voltage regulator (U1) prevents backward voltage from Vout to Vin, so that the back-up battery's voltage wouldn't be confused with the main battery or USB's (Vcharg), so that the diode can be removed.I/O extender: the design includes an I/O extender (PCA9535PW,118) that will be used (amongst other) to detect and command the charger. So it needs to be powered in low-power mode.I'll have to check the number of available ADC ports on the STM32, if needed I might have to add a multiplexer that should be powered under low-power mode.Wow, writing this message is the best way for me to progress on the design as will doing so I gather and summarize info on my design and also try to answer by myself the questions that arrise. And thanks again for you reply.

author: Peabody
author_rank: Super Contributor
timestamp: January 19, 2022, 09:28:50 pm
content: I don't think you can eliminate the diode. Vreg would then be directly connected to VDD, and when the backup battery takes over, its current would flow back through the Vreg line to the mosfet gate, and would turn off the mosfet.Also remember that since your processor will be running at 3V, you can only connect inputs like Vbatt to a 5V-tolerant pin, and even if that works, I don't think you will get any meaningful ADC readings on any input above 3V. So something like Vbatt might need to be divided down.You didn't answer my question - would you consider plugging in the device to USB in order to change the battery? That would require that the XC charger pass through USB power even if no battery is connected. I know the TP4056 charger will do that, but don't know about the XC. Anyway, that would let you eliminate the backup battery and the diode. You would then shift into and out of low-power mode based on reading the battery voltage. But instead of a backup battery to change the main battery, you would have backup USB power to keep the clock running.I'll attach a circuit showing how Vbatt could be divided down for the analog read, with the divider enabled through a mosfet so it doesn't draw current all the time.

author: Watth
author_rank: Frequent Contributor
timestamp: January 19, 2022, 10:59:19 pm
content: Of course the proper way would be to plug to USB before disconnecting the battery. The TX-something is made for this: its output either takes power from the battery or the charging source (in this case the USB connector). But I wish to consider the possibility that both could be accidentally disconnected or if the battery gets too discharged while not plugged to USB.I considered using a supercap as a back-up, but havent found yet what capacitance is required to provide a few mA as minimal power to keep the µCU's RTC and RAM running.Quote from: Peabody on January 19, 2022, 09:28:50 pmWell yes, Vcharg should be used on the mosfet gate. That would work without an extra diodeifI can be sure the regulator won't let current back from its output to input.

author: Peabody
author_rank: Super Contributor
timestamp: January 20, 2022, 05:18:03 am
content: Quote from: Watth on January 19, 2022, 10:59:19 pmOk, I understand. The regulator has a resistor divider from the output pin to ground, so there will be a small back-current flow. But I suspect that will be very small. The main question is whether the P-channel mosfet that drives the output will turn on when input power is lost. I see nothing in the datasheet that answers that for sure. You will just have to test it.

author: Watth
author_rank: Frequent Contributor
timestamp: January 21, 2022, 11:54:48 am
content: The voltage drops from the mosfet would be a problem, anyway.I think I should drop the idea of a back-up battery. Using a supercap could be a better solution if for some reason neither Li-Po and USB can provide power. I'm looking into a way to calculate said supercap's values.

author: Peabody
author_rank: Super Contributor
timestamp: January 21, 2022, 03:38:39 pm
content: There should be close to zero drop across the mosfet. Any good mosfet will have an On resistance of about 50 milliohms, and at these currents that will not cause any noticeable voltage drop. And a supercapacitor would be much larger than an equivalent battery.Well, as I've said before, the question for me is whether you need a backup at all, other than USB. It just seems you could follow the battery voltage, and when it gets low you could switch into low-power mode, and the remaining battery life would still last a long time. You would have to determine experimentally what battery voltage works for that. But that method assumes the XC6806 will provide power when USB is connected but the battery has been removed. Something like a 3.5V switchover point would reserve about 10% of the main battery as your backup. If you're only drawing a few microamps, that's going to last a long time. And hopefully one of the outputs of the charger can function as a wakeup interrupt to the MCU when USB power is available again.

author: Watth
author_rank: Frequent Contributor
timestamp: January 21, 2022, 07:04:16 pm
content: Quote from: Peabody on January 21, 2022, 03:38:39 pmOk, I misunderstood the mosfet datasheet. I think what you suggest is the best solution.The XC6806 is design to provide power on its output whatever the best source (battery or USB) is. That's why I don't have to tap voltage directly from the battery or the USB connector.I could drop the supercap idea, or content myself with a smaller one to keep power for a few seconds as sometimes USB connector/cables canThis project doesn't really need such back-up system, it was just for me the occasion to try to implement one, but that's too much shoe-horning. I'll certainly have other occasions to explore this type of power back-up designs.