Connect with us

How to prevent a capacitor from dischargeing back into my circuit?

Discussion in 'General Electronics Discussion' started by Pete the hop, Sep 26, 2014.

Scroll to continue with content
  1. Pete the hop

    Pete the hop

    4
    0
    Sep 26, 2014
    I want to determine how long my circuit has been powered off by storing a charge in a capacitor. When power is resumed, I want to read the voltage of the stored charge and determine how long the power has been off (maximum 6 minutes). Accuracy is not a big issue. I'm using a PIC micro and the problem I see is the capacitor will discharge through the PIC as Vdd collapses. Due to the nature of the psu I can't afford to use too large storage capacitor. If need to keep the leakage current through some kind of analogue (when Vdd = 0) switch to a minimum <1µA.
    Much appreciate any kind of ideas? new-1.gif
    Sorry, Consider the diode is a switch. Otherwise the capacitor would of charged up by the time iv'e read it's voltage.
     
    Last edited: Sep 26, 2014
  2. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    But when you switch back on to measure the voltage won't the capacitor charge back up through the diode putting supply on the capacitor before you have time to measure it? :)
    Adam
     
  3. Pete the hop

    Pete the hop

    4
    0
    Sep 26, 2014
    Yes, thanks Adam I spotted that soon as I posted it. In trying to simplify the diagram I ballsed it up. Consider the diode as a switch. cheers
     
  4. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    What switch are you thinking of using?
     
  5. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    Charge the cap through a diode from a PIC pin. The diode will prevent it discharging though the protection diodes in the PIC. When the PIC resumes, the pin will be an input and you can measure the voltage before setting it to an output.

    I.e. PIC pin to anode, cathode to cap, other side of cap to ground.

    Bob
     
  6. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    How would the PIC be able to measure the voltage on the capacitor if there's a reverse-biased diode between the capacitor and the input pin?
     
  7. Pete the hop

    Pete the hop

    4
    0
    Sep 26, 2014
    Yes this my problem. The connection to read the cap voltage. I need some kind of analogue switch to connect Capacitor to PIC - that will not discharge the capacitor when the circuit power rail collapses.
    I'm thinking some kind of fet based switch thing might provide a solution - what I - don't know!
     
  8. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,271
    Nov 28, 2011
    Have you chosen your capacitor? Six minutes is a long time for what you want to do.

    How about using a supercapacitor or a lithium coin cell, and a 32 kHz oscillator with the PIC running in low-power mode with periodic wakeup?
     
    Pete the hop likes this.
  9. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    Hmm. You've got a point there!

    Bob
     
  10. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    Ok this might work. Charge the cap from any port pin, needs to be on for at least 5 seconds before turning off take a measurement of the voltage and store this value. When the supply is removed the PIC it's self is used to discharge the capacitor through a known load (1M). When switched back on the first thing to do is to measure the capacitor voltage and compare it to the initial value you should then be able to work out a rough time. Change the values of R and C accordingly if you wish.
    Adam

    CAP DIS.JPG
     
    Pete the hop likes this.
  11. Pete the hop

    Pete the hop

    4
    0
    Sep 26, 2014
    Thanks for all your replies so far. I've considered running the LF version PIC at 32khz (7µA all peripherals) off, while power to the circuit is off, but i'll need a 2,500mfd cap, which with my power supply (2mA) (would take too long to charge up and so wouldn't function as intended. Coin cell would solve all, but out of the question for this application. if I could store a charge in a small capacitor with a smaller discharge current (nA's), then I might be onto something.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-