Cap Charge - Page 1
Forum section: electronics / beginners

author: Tnixsw
author_rank: Contributor
timestamp: March 28, 2023, 04:10:03 am
content: Hi all,Due to the way a circuit is switched on or off, I would like to have a small capacitor hold a processor on for about 50mS after detecting that the power was turned off so that I can store some data. The circuit voltage is about 4.4V, and if I use a Schottky isolation diode, then the capacitor charged voltage would be about 4.1V or so. If I allow around 20mA current, and use a 2.2mF capacitor, I should get about 200mS before the cap voltage drops below the microprocessor reset level of about 2.7V.If this seems feasible, what sort of resistor should I use to limit the charge current at switch on. I don't know what is appropriate.I would imagine the processor would have to track a minimum switch on time before it would attempt to save the data.cheersTony

author: inse
author_rank: Super Contributor
timestamp: March 28, 2023, 05:17:03 am
content: If the power is on for only 20ms, you need a low resistance, if it’s on for minutes, you can go for a higher one.Just don’t over-stress your power supply to avoid brown-out (or is it brown-in?) condition for the uC

author: Tnixsw
author_rank: Contributor
timestamp: March 28, 2023, 05:30:09 am
content: The power could be on for hours, but when switched off, I'd be relying on the capacitor charge to store data before the processor halts due to the reducing voltage dropping below its reset threshold.I would have thought something like 5 - 10 seconds to fully charge - not sure.

author: srb1954
author_rank: Super Contributor
timestamp: March 28, 2023, 06:48:55 am
content: Quote from: Tnixsw on March 28, 2023, 04:10:03 amWhat is your power source for the circuit?If it is powered via a linear regulator you might not need any additional resistance as the regulator current limit will protect against excessive current.If you have a slowly charging capacitor powering your MCU I strongly recommend that you use an external CPU supervisor chip to hold the MCU in reset until such time as the power supply voltage has stabilised at an appropriate level, a little above the MCU's maximum internal reset voltage. The internal power-on reset circuit of many MCUs doesn't operate reliably with slowly rising power supply voltages so a CPU supervisor with a well defined reset release threshold is preferred.A combined CPU supervisor/memory protection chip might be necessary if you are storing your data in a battery backed RAM. You wouldn't want to corrupt the RAM data on power up having so carefully saved it after a power failure.

author: Tnixsw
author_rank: Contributor
timestamp: March 28, 2023, 07:21:46 am
content: I'll look into a supervisory IC - thanks.

author: inse
author_rank: Super Contributor
timestamp: March 28, 2023, 07:31:49 am
content: Just do some calculations:Tau=R*C, the capacitor is assumed fully charged after 5TauIn your case Tau would be then 1s, C=2200uFSo R=1s/2200uF=450OhmsThat would mean an initial current of less than 10mA.If your power supply can deliver this, and the uC has a decent reset circuit and maybe even brown-out protection, you would not need a supervisor circuit.

author: Infraviolet
author_rank: Super Contributor
timestamp: March 28, 2023, 08:58:09 pm
content: The trick might be to use a MOSFET or op-amp system as an "ideal diode" with no significant voltage drop across it. Then you could have the chip powered from the end of this "diode", and some decoupling caps beside it, the caps would stay charged until the processor had run for long enough at whatever current it draws to drain them. You'd program the processor to observe the input voltage at the input end of the "diode" with an analogue pin, and whenever it saw this voltage drop too low it would firstly save the data and then just enter a waiting/sleeping/delay state in an eternal while loop until such time as the cap powering it drained. With even a fairly small cap this could easily give it seconds of time to very quickly save and then spend a fair while waiting.