# Understanding charge and discharge of a capacitor

I feel bad at this point. This will be my last post about it, however, I will explain myself more clearly and more transparent so everyone doesn't need to guess my issues.

Never been so confused with a circuit before.

I am trying to analyze a precision Rectifier circuit with a capacitor at its load/output.

The end goal is: Trying to predict the circuit's output as well see the behaviour of the circuit to see if it needs further improvement.

I am going to go through this circuit step by step and my thinking process and hopefully you can tell me where I went wrong, and show you where I get stuck. simulate this circuit – Schematic created using CircuitLab

• How I am going to approach this circuit is: Assumptions

1. DC analysis because due to the diode changing the topology or state of the circuit depending on the uprising or down rising of the wave.

2. Steady - State. I am going to assume the capacitor will be significantly charged

3. We need to know which state the diode is in (Forward bias or reverse bias).

4. Current travels from High electrical Potential to Low electrical Potential

Starting the analysis:

Since we are working with a diode I would assume you will have to work out the math at each "positive cycle" and "negative cycle" of the wave.  simulate this circuit

In order to find if the current is positive coming out of the OP-AMP, we need to find all the missing voltages (Vout). In matter of fact to find the current of the components, we need to find the missing voltages anyways.

$$\text{Node "0V"}: \frac{0-5}{2k\Omega} + \frac{0-V_{out}}{2k\Omega} = 0$$

$$\frac{-5}{2k\Omega} - \frac{V_{out}}{2k\Omega} = 0$$

$$\frac{-5}{2k\Omega} = \frac{V_{out}}{2k\Omega}$$

$$V_{out} = -5$$

Concluding all our missing voltages, putting this back into the schematic. simulate this circuit

I get stuck here at this point

What I am thinking to myself right now: is that I want to do the current law where In = Iout, however, I only have one current going into a node thus I can't find the rest as shown

$$\ I_{n} = I_{out} \$$

$$\ 2.5\text{ mA} + ??? = ??? \$$

and I don't know how to get the rest of the current, if I knew how to get at least the current out of the capacitor I would be able to find out the op-amp's current plugging it into the equation above.

The thing is, I said assume steady state so I guess I can have the Capacitor become short, however, another problem is that it doesn't tell me if the capacitor is charging or discharging them. simulate this circuit

Same strategy here, finding the voltage, however this time the topology of the circuit change as the op-amp isn't connected via feedback anymore. Thus we can assume this is just a simple RC Circuit (simplified).

$$\ H(s) = \dfrac{1}{0.0004*s+1}\$$

We take the $$\\lim_\limits{s\to0}\$$ we get: $$\ H(0) = 5 \$$

Putting it back in the schematic: simulate this circuit

Looks like our diode assumption worked out, thus when the sine wave is rising up (0-90 degrees) the diode is in R.B.

I get stuck here at this point

What I am thinking to myself right now: I still don't know if the capacitor is in a charging state or a discharging state.

If I were to give it a guess the capacitor is just a short and the current has no current flowing through it, but this is all due to the steady state assumption. Once again gives me the problem if not knowing if the capacitor is charging or discharging during the period of (0-90 degrees) during the rise of the sine wave. simulate this circuit

I get stuck here at this point

What I am thinking to myself right now: is that I want to do the current law where In = Iout, however, I only have one current going into a node thus I can't find the rest as shown

$$\ I_n = I_{out} \$$

$$\ 2.5\text{ mA} + ??? = ??? \$$

and I don't know how to get the rest of the current, if I knew how to get at least the current out of the capacitor I would be able to find out the op-amp's current plugging it into the equation above.

The thing is, I said assume steady state so I guess I can have the Capacitor become short, however, another problem is that it doesn't tell me if the capacitor is charging or discharging them. simulate this circuit

Same thing finding all the voltages, but this time all the voltages are found due to the previous rising wave charging the capacitor. Applying it to the schematic. simulate this circuit

What I am thinking to myself right now: This is the only thing that makes sense as I guess the capacitor is now acting like a voltage source, so its evident that the current is flowing out of the capacitor and discharging. However, I am confused about the assumption of the diode wouldn't it always be open for any $$\V_{out} > 0\$$ the? and input > 0?

This is long enough and hopefully explains my points, I won't go into the negative cycles, as hopefully its the same thing as the positive. Sorry if I got messier towards the end it got pretty late writing this.

• I tried to clean up, but then I noticed there are some duplicated sections like: "What I am thinking to myself right now: is that I want to do the current law where In = Iout" which make this post needlessly long. Could you clean up the post first? (also, the introductory of "This will be my last post about it" is fluff, it's not supposed to be in the post nor anywhere, consider removing it) Oct 23, 2018 at 8:21
• For positive DC voltage at the input, the diode will block the opamp from the rest of a circuit. So you will end with a simple RC circuit. The circuit time constant is RC = 4kΩ x 100nF = 0.4ms. Therefore after 5RC = 2ms the capacitor voltage will reach the value of an input voltage (end of the charging phase). And nothing interesting in this circuit is happening.
– G36
Oct 23, 2018 at 14:09
• Yeah I understand that much, but I am more talking about what state the diode is in and how to find the current of the capacitor branch to verify my diode assumption is correct
– Leoc
Oct 23, 2018 at 16:40

What I am thinking to myself right now: is that I want to do the current law where In = Iout, however, I only have one current going into a node thus I can't find the rest as shown

You're already off track at this point.

You don't need to solve KCL to understand the circuit. You basically already have it solved. The input voltage is +5 V, and the op-amp inverting input is virtual ground. Therefore 2.5 mA through R1, therefore 2.5 mA through R2. Therefore the capacitor node is at -5 V. That's it.

You know to get to -5 V, therefore 0.5 uC must have at some point flowed out of the capacitor to charge it to that voltage.

But wait, the diode has its anode at the op-amp output and its cathode at the capacitor. So the op-amp couldn't have drawn charge off the capacitor this way. You should have been modeling the diode as an open and not a short for this part of the input cycle.

So now go back and analyze this part of the cycle with the diode as an open. And remember that when the negative feedback loop is broken, the inverting input no longer acts as a virtual ground.

• 1. I mean I still want to know if the capacitor is discharging or charging, and I cant know this if I dont know the current coming from the capacitor branch 2. I dont know that, can you explain to me in detail how is that 3. I dont understand this as well, but I did do an analysis of a R.B diode if you keep reading down
– Leoc
Oct 23, 2018 at 5:13
• @Pilsz, you know which way the current is going by how the voltage is changing. And you can find how the voltage is changing without using KCL (for the case where the diode is forward biased). Oct 23, 2018 at 5:18
• I agree you can find the current is going by the change in voltage, but doesnt current "split" once it hits a branch (when more than one wire meet up). So I wouldnt know which way current is going after that branch
– Leoc
Oct 23, 2018 at 6:05
• i=CdV/dt. That's all you need to know. Oct 23, 2018 at 12:38
• Would it be i = 100nF (5/0.002) ?
– Leoc
Oct 23, 2018 at 16:39