Author Topic: Cap Charge  (Read 537 times)

0 Members and 1 Guest are viewing this topic.

Offline TnixswTopic starter

  • Contributor
  • Posts: 23
  • Country: au
Cap Charge
« on: March 28, 2023, 04:10:03 am »
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.

cheers

Tony
 

Online inse

  • Frequent Contributor
  • **
  • Posts: 646
  • Country: de
Re: Cap Charge
« Reply #1 on: March 28, 2023, 05:17:03 am »
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
 

Offline TnixswTopic starter

  • Contributor
  • Posts: 23
  • Country: au
Re: Cap Charge
« Reply #2 on: March 28, 2023, 05:30:09 am »
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.
 

Offline srb1954

  • Super Contributor
  • ***
  • Posts: 1086
  • Country: nz
  • Retired Electronics Design Engineer
Re: Cap Charge
« Reply #3 on: March 28, 2023, 06:48:55 am »
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.

cheers

Tony
What 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. 
 

Offline TnixswTopic starter

  • Contributor
  • Posts: 23
  • Country: au
Re: Cap Charge
« Reply #4 on: March 28, 2023, 07:21:46 am »
I'll look into a supervisory IC - thanks.
 

Online inse

  • Frequent Contributor
  • **
  • Posts: 646
  • Country: de
Re: Cap Charge
« Reply #5 on: March 28, 2023, 07:31:49 am »
Just do some calculations:
Tau=R*C, the capacitor is assumed fully charged after 5Tau
In your case Tau would be then 1s, C=2200uF
So R=1s/2200uF=450Ohms
That 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.
 

Offline Infraviolet

  • Super Contributor
  • ***
  • Posts: 1012
  • Country: gb
Re: Cap Charge
« Reply #6 on: March 28, 2023, 08:58:09 pm »
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.
 
The following users thanked this post: Victorman222


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf