Capacitive voltage divider with half wave rectified voltage

Discussion in 'General Electronics Chat' started by soderdaen, Nov 21, 2015.

  1. soderdaen

    Thread Starter New Member

    Nov 21, 2015
    Hey guys,

    I am completely new to this forum, that's why I want to introduce myself a little.
    I am a german student studying regenerative energies and I have some trouble in calculating a capacitive voltage divider for my bachelor thesis.

    So here we are:
    voltag divider.PNG

    This is my voltage divider with a 470µF capacitor parallel to the second resistor. On the right side you can see the voltage above R2||C1.
    My problem is in calculating that voltage. It wouldn't be a problem with a normal AC sine singal or a simple DC voltage, bit since there is the diode in it I have to calculate it different. How can I set my resistor R2 that the voltage over the parallel circuit is x Volts (in the long run after the capacitor is fully loaded). I just like to have some suggestions how to calculate.


  2. shiva007nand


    Sep 25, 2015
    voltage divider V0 = Vin * R2/(R1+R2)
    According to which diode you are using, diode will have some voltage drop across it
    eg. if you are using 1N4007 voltage drop will be 0.7 v
  3. soderdaen

    Thread Starter New Member

    Nov 21, 2015
    Yep, but as you can see from the diagramm it is wrong here because of the capacitive resistor.
    In your case I would get: 12V-0,7V=11,3V

    And V0=11,3*2000/8000 = 2,825V which is NOT 1.05V
  4. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    Two things to consider:
    1) 12V is the sine amplitude, not the RMS value,
    2) R2 is constantly discharging the cap, which complicates the maths.
    To simplify the maths, move D1 so that its anode connects to the R1/R2 junction and its cathode goes to C1.
    cmartinez likes this.
  5. MrAl

    Well-Known Member

    Jun 17, 2014

    Hello there,

    This is a much more difficult problem than it looks like at first glance. That's because of the diode as you noted. You cant apply AC analysis directly, and you cant apply DC analysis directly. The diode complicates things quite a bit and part of that is because the diode becomes effectively an open circuit for certain time periods which in addition to everything else you also have to SOLVE for. So this is a switching circuit, and most of the time we have the switch times predetermined so we can apply those times to the circuit and come up with a reasonably simple analysis (such as with a PWM circuit). Here however, we dont even know when the diode will turn on or off yet, so we must solve for that as well, and that equates to a partial differential equation, or some procedure that leads us to something similar.
    To outline the process, the first step is to determine when the diode first turns on. If the diode voltage drop is assumed to be 0.7v (which if not would also have to be solved for BTW) then we can assume that the diode turns on when the input half sine reaches 0.7v. We then have a circuit that is excited by a sine wave, but only up to the point where the diode turns off, and during that time we have to calculate the capacitor voltage so we can determine when the diode turns off (less than 0.7 across it). One way to calculate the cap voltage during this time is with Laplace transforms where the input is a sine or cosine, and the diode is dropping 0.7v. We can find the inverse transform and that gives us the time expression vc(t). Having that, we then have to solve that for the turn off time and that ends the first half cycle for the charge phase. We then have to calculate the voltage for the discharge time of the cap, and solve again for the time when the input voltage again becomes greater than the cap voltage, and then start again only this time we will have an initial voltage for the cap.
    We then repeat everything above, except after the first half cycle the cap has initial voltage so that has to be included in the equations.

    This can be summarized with a partial differential equation which i can post if you are interested, but to solve that still requires doing the steps as above. The transfer function has to be calculated, etc.

    There may be an averaged way to handle this too, which gives us a quicker way to estimate the output but we'd have to look into this. If it was a square wave input it would be simpler, so perhaps we could find a way to use the average value of a half sine and the fact that it only turns on for part of the time, but again we'd have to find a way to calculate the times that the diode turns on and off or we would not know the duty cycle.

    I actually posted the set of equations that would help solve this kind of problem on the web somewhere, but i'll post again here if you would like to review them. I will say again however, that the solution still requires the steps above.
    cmartinez and soderdaen like this.
  6. soderdaen

    Thread Starter New Member

    Nov 21, 2015

    Hey MrAI, thanks for this posting, really helpful. I think I have to get through it, so it would be kind if you can post the partial differential equation where I am trying to do the transfer function, but my best math times are gone ;)

    I also thought about an effective value at the rectified one wave signal. Since the the effective value of a half sine wave is U/sqrt(2), the effective value of a rectified sine wave is half the value, so it is (U/sqrt(2))/2 = U/(sqrt(2)*2) = U*sqrt(2)/4. In my case: 12V -0,7V= 11,3V ->
    11,3V*sqrt(2)/4=3,99 which is my effective value. Now the voltage divider in the long run (the cap is fully loaded) -> 3,99V*2000/8000 = 0,998V
    This is very close to the LTSpice Simulation at 1,05V.

    Can I do it that way or is this completely wrong ? ;)

    What I dont get in that case: When the capacitor is on "DC", the whole voltage drop should be over it in the end or not?
  7. MrAl

    Well-Known Member

    Jun 17, 2014

    That's a good idea and may actually work for some component values, but will completely fail for other component values. For example, change the large resistor to 1 ohm, then the diode does not turn on for very long and so we can not use the 'effective' value of the half sine because it is not a half sine current anymore.
    You can try it though and see how much it is off with various resistor values.
    I was assuming that you wanted to know the general analysis that would work for any values in the circuit. If you just need a solution to this circuit with those particular values that's a little different.

    The first file is a solution someone else found to a full wave rectifier circuit with NO cap ESR.
    The second file is the general solution, which is VERY general for sure. This would also work for a half wave rectifier too just the approach would be a little different that's all.
    I show the first file because i like to show how complicated the final solution can come out to be. Since the PDE solution can include a resistor in series with the cap that solution will be even more complex than the first file shows. When i did the full solution myself i used a computer program to do some of the math (algebra) so i would not have to write all the equations out by hand. It requires solving the equations for both time and amplitude, and since the time keeps changing there's no easy shortcut until the solution reaches steady state and then many of the variables settle.

    Hey if you dont mind i think we can do a completely numerical solution which would be much simpler and faster.

    Here are the files...
    Last edited: Nov 21, 2015
    cmartinez likes this.
  8. soderdaen

    Thread Starter New Member

    Nov 21, 2015
    Hey, thanks for your reply. As I saw the two attached files it looked quite confusing, but hopefully I can get behind it.
    By the way you are completely right, I checked the 1Ohm resistor in the simulation and the whole voltage drop happens at the parallel circuit which the voltage divider would predict but the effective voltage thing isnt working anymore...

    Wow, thanks for your offer. I'd be glad to do the numerical solution with you but I'm not quite sure how to start.
  9. WBahn


    Mar 31, 2012
    It sounds like you are looking for a steady state condition, so assume the circuit has reached steady state and draw the voltage waveform of interest over one cycle, noting that you must end up back where you started in order for it to be in steady state. With that you can develop a set of equations, one for charging and one for discharging, and solve them. There are a number of approximations you can make to get it simpler to solve and, under most conditions, give you good enough results.
  10. MrAl

    Well-Known Member

    Jun 17, 2014
    Hello again,

    Yes there are some approximations that can be used, but if you care to elaborate we can take a look at your approach too. The approximation i had used in the past assumed one of the variables was a constant, so it helped with the equality where the charge time must end at the start of the discharge time and the discharge time must end at the start of the charge time. We can go over that too at some point.

    We still need the differential equation for this to start with, would you like to come up with that or no, as i am not sure what math you got up to so far in your studies and how much of this you want to try for yourself first.
  11. soderdaen

    Thread Starter New Member

    Nov 21, 2015
    My maths is quite good I think, things I don't know I can normally look up quite easily. But to apply the maths to this circuit is a problem for me.
    I guess we need the formula for loading the capacitor which is:
    Uc(t)= U * (1-e^(-t/(R*C))

    and for the deloading:

    So I think this is the very first step because the capacitor is a "shortcut" at the beginning and responsible for the voltage drop at the parallel circuit. But for the PDE we need the R2 as well.
    So Z2 is first determined through the capacitor with the above formula until the voltage drop on the R2 is higher. How to arrange this DC part with the rectified part to the PDE? I have absolutely no clue, sorry.
  12. MrAl

    Well-Known Member

    Jun 17, 2014
    [See attachment for time drawing, lower section for half wave]


    Well, that is the time equation not the differential equation, but if you want to look at the time equation then we would have to have for charging the capacitor with a step input:
    Vc(t)=R2/(R2+R1)-(R2*e^(-(t*(R2+R1))/(C*R1*R2)))/(R2+R1) [EQU1]

    but we really need a sine input because we have a half sine input, so we end up with a more complicated equation for the charging of the capacitor:
    (Vpk*w*cos(t*w)*C*R1*R2^2)/((w^2*C^2*R1^2+1)*R2^2+2*R1*R2+R1^2) [EQU2]

    and with a zero diode drop (for simplicity here) that is only valid between t=0 and the point where the input half sine becomes less than the capacitor voltage:
    Vpk*sin(w*t)<=VcCharge(t) [EQU3]

    Once we reach that point, then the capacitor discharge is as noted:
    VcDischarge(t)=Vc0*e^(-t/(R2*C)) [EQ4]

    where Vc0 is the voltage of the capacitor at the point in time where EQU3 is satisfied.

    That works for the very first half cycle of the first cycle, but for the first half cycle of the second cycle we have to include the ending capacitor voltage from before to find out the start time of the next charge cycle as well as add that cap voltage to the charge equation which makes it more complex yet.

    That is the analytical approach, which is in itself quite interesting, but for the numerical approach all we need is the differential equation which could be written as follows...

    The voltage across C is Vc and the change is dVc/dt=Ic/C where Ic is the current through the cap.
    It is much simpler however to abbreviate the derivatives as lower case and non derivatives as upper case, so the change in cap voltage is simply vc, and the cap voltage itself is just Vc, and again the current is Ic, so we have:

    Solving this for Ic we get simply:

    So we have an expression for the cap current, and knowing the voltage is Vc then we know the current through R1 is:

    and that should be self evident. We subtract two voltages and divide by a resistance, so we get a current.

    Now part of that current flows through the cap and part through the resistor R2, and we know that the current though R2 is:

    and the current though the cap C is:

    and the current though R1 must equal these two summed, so we end up with:

    and solving for C*vc we get:

    and dividing through by C and setting R1C=R1*C and R2C=R2*C we get:

    and that is our main differential equation (where again vc=dvc/dt the time derivative) for the charging phase. We also need the equation for the discharge but we know that is already:

    so we can calculate that directly.

    Next, as an approximation to keep this simpler, we note that E is the input voltage, which is really a half sine, but we use the sine itself to start with:

    The next part is simple because we just apply a numerical method, agreeing that the time increment will stay small to keep the solution valid. Interestingly, the next steps will be almost like the analytical method except we use numerical solutions rather than keep solving for equalities, so this is not a waste of time.

    What we will do next is:
    1. Run through the numeric solution until we reach the point where Vpk*sin(w*t) is less than Vc(t).
    2. Switch equations to the discharge period equation.
    3. Solve or run through the numeric solution until Vpk*sin(w*t)>Vc again.
    4. Repeat steps 1 through 3.

    We can use a more exact numerical solution but for example one might look like this:

    so you can see this should be very simple.

    If you'd like to proceed using this technique just let me know, or if you'd like to try it yourself first that's cool too :)

    BTW, it helps to use some computer programming language to run through the numerical solution as that provides a ton of solutions without having to do much work, and we can write in code that detects the transition points between charge and discharge. It's up to you though, as you can do this with a calculator too it just takes longer to complete.
    Last edited: Nov 23, 2015
    Sinus23, soderdaen and cmartinez like this.
  13. soderdaen

    Thread Starter New Member

    Nov 21, 2015
    Wow MrAl,
    looks great. I am going to think about it today in the evening or tomorrow morning since I dont have any time right now.
    Hope thats ok, I dont want to slow down your motivation :)
  14. MrAl

    Well-Known Member

    Jun 17, 2014
    Hi again,

    Hey no problem :)

    I am looking into this partly as a refresher for myself too. What i found i think is a simpler form for the analytical approach for the period of the charging of the capacitor:

    ee=e^(-(t*(R2+R1))/(C*R1*R2)), and
    Vpk is the peak of the input sine, and
    Vc(t) is the voltage of the cap when charging, and
    Vc0 is the initial voltage of the capacitor at the start of the charge period.
    This is assuming the diode has zero voltage drop when turned on, but that's good for a start anyway.
    We still have to solve for the time points, but it will be much simpler with that equation.
    We also still have to use the discharge equation too: Vc=Vc0*e^(-t/(R2*C)) .
    That equation may be able to be simplified further, i havent tried that yet.

    Since this turned out much simpler than i thought (we dont have to solve the PDE because we dont need to solve for the peak of the output explicitly as we do when doing a rectifier circuit when we want to know the percent ripple) i might try to calculate a solution later today sometime using this approach, as well as go over the equations to make sure they are 100 percent correct. Perhaps we can compare with a numerical solution as well just to see how accurate we can get with this.
  15. MrAl

    Well-Known Member

    Jun 17, 2014

    I started going over the equation for the charge time and found that we also need to include a phase shift in the solution for the charge time because later when we use the exponential we have to be able to sync back up with the exponential, which will be based on t=0 which later of course is actually a time later in the solution. This complicates the charge solution a little but it is still not too bad:


    and this might be simplified, and although that looks like a mess it comes out much simpler once we apply the known values as floating point values:

    You can see this is just the usual sine and cosine terms plus the one exponential term.
    This is without using the time delay, but that wont be too bad either.

    To find the first solution we set the charge time equation equal to the input sine equation which in short form is:

    where td is the delay time discussed above and to start this is equal to zero, and so the first solution comes out to be (with Vpk=100 volts not 12 volts to get results that can also be expressed in percent of Vpk):

    and that capacitor voltage agrees with a simulation to at least 4 significant figures so it looks good so far.

    The next step would be to compute the exponential and equate that to the input again to find out when the input voltage goes over the cap voltage again, which would mean it would start to charge again. That would be some time just after 20ms.

    Note that because of the large capacitance and large series resistance the capacitor only charges a very little after the first half cycle.
  16. MrAl

    Well-Known Member

    Jun 17, 2014
    Hello again,

    I had to go out for a while but when i got back i threw this little program together to perform the numerical solution. As you can see, it's fairly simple. I figured i better post this in a new post rather than the previous one with the analytical approach because it is a little larger with the program code.

    Here is the program, and the solutions, one for every second up to 10 seconds, are shown in the inset in the attachment. They came out very close to the simulation, hard to tell apart. The diode used was a high quality Zetex Schottky diode rather than a run of the mill rectifier so the voltage drop is much lower than normal, about 0.1v with a slight curve to it. Here we assume it has a constant 0.1 volt drop for all appropriate time points.

    Code (Text):
    3. --11/24/2015 MrAl
    4. --
    5. --Program description:
    6. --Calculate voltage across cap numerically for the rectified input sine.
    9. include misc.e --contains the 'sleep' function used far below
    11. constant pi=3.1415926535897932384626433832795
    13. atom X1,h,R1,R2,C,t,w,f,Vpk --declare variables, Note: X1 is cap voltage
    15. --set constants and calculate w:
    16. R1=8000
    17. R2=2000
    18. C=470e-6
    19. Vpk=12
    20. f=50
    21. w=2*pi*f
    23. --set the time interval:
    24. h=0.00001 --the time increment, we keep this small
    27. --declare the input wave function:
    28. function E(atom t)
    29.   return Vpk*sin(w*t) --the input voltage wave
    30. end function
    33. --declare the calculations for the derivatives and solutions:
    34. procedure CalcNext()
    35.   atom x,Et
    37.   Et=E(t)-0.1 --subtract 0.1 volt for Zetex high quality Schottky diode as rectifier
    39.   if X1<Et then
    40.   x=-X1/(C*R2)-X1/(C*R1)+Et/(C*R1) --derivative when cap voltage is less than input voltage
    41.   else
    42.   x=-X1/(C*R2) --derivative when cap voltage is greater than input voltage
    43.   end if
    45.   X1=X1+h*x --simple numerical method, first order
    46. end procedure
    49. t=0  --Starting the solution at t=0
    50. X1=0  --with cap voltage equal to zero at t=0 .
    52. for k=1 to 1000000 do
    53.   t=t+h
    54.   CalcNext() --calculate next solution at new time t
    55.   if k/100000=floor(k/100000) then --only print solutions for every second
    56.   printf(1,"t=%04.1f  Vc=%f  \n",{t,X1}) --print the time t and the new cap voltage X1
    57.   end if
    58. end for
    60. sleep(3600) --keep text display showing for one hour so we can view it and copy it
  17. WBahn


    Mar 31, 2012
    I'm recommending an incremental approach that starts off making some broad assumptions and then asking questions to probe whether or not those assumptions were reasonable.

    The first assumption is that, in steady state, we have an effectively constant voltage across the capacitor (i.e., low ripple, which becomes the criteria we will use later to see how reasonable this assumption is).

    If we have constant voltage, V0, across the capacitor, then the total charge that flows through the load resistor, R2, over one cycle is:

    <br />
Q_{R_2} \: = \: \frac{V_0}{R_2} T_0<br />

    where T0 is the period.

    This is therefore the total charge that must flow through R1 during the fraction of a cycle that the diode is conducting. The current flowing in R1 will be

    <br />
i(r_1) \: = \: \frac{V_p \sin \( 2 \pi \frac{t}{T_0} \) - V_d}{R_1}<br />

    for values of t such that the diode is forward biased.

    Since we are assuming a constant output voltage, the window during which the diode will be conducting will be symmetric about the peak, which occurs at T = T0/4. Taking this into account and exploiting symmetry about this point, the total charge through R1 during one cycle will be

    <br />
Q_{R_1} \: = \: 2 \int_{T_1}^{\frac{T_0}{4}} \frac{ \( V_p \sin\( 2 \pi \frac{t}{T_0} \) - V_p - V_0 \)}{ R_1} dt<br />

    where T1 is the time after the positive zero crossing at which the diode begins to conduct.

    Evaluating the integral gives us

    <br />
Q_{R_1} \: = \: \frac{2T_0}{R_1} \[ \frac{V_p}{2 \pi} \cos \(2\pi\frac{T_1}{T_0}\) - \(V_0+V_d\) \( \frac{1}{4}-\frac{T_1}{T_0} \) \]<br />

    Noting that

    <br />
V_0 \: = \: V_p \sin \( 2 \pi \frac{T_1}{T_0} \) - V_d<br />

    and setting these two charge amounts equal to each other, we get

    <br />
\pi \( \frac{R_1}{R_2} + \frac{1}{2} \) \: = \: \Theta_0 + \frac{ \cos \( \Theta_0 \) + \pi \frac{R_1}{R_2}\frac{V_d}{V_p}}{ \sin \( \Theta_0\) }<br />


    <br />
\Theta_0 \: = \: 2 \pi \frac{T_1}{T_0}<br />

    and so

    <br />
V_0 \: = \: V_p \sin \( \Theta_0 \) - V_d<br />

    This is non-analytic and must be solved numerically, but this only takes a few steps and you get

    Vo = 1.00 V

    Looking at the original post, we can see that this result is in the ballpark, though a bit on the low side.

    So what kind of ripple do we expect? That can be answered by looking at the time constant during the discharge period, which is R2·C, and comparing that to the period of the 50 Hz signal.

    With 470 uF and 2000 Ω, we have a time constant of 0.94 seconds. That is nearly 50x 20 ms waveform period, so we would expect very little ripple and, furthermore, expect a linear estimate to be very close. If we assume that the conduction period is a full half cycle, then the capacitor voltage would droop about (Vo/2)(To/(RC)) which would be about 10 mV (and 1%).

    I don't know why my estimate is so far off the simulation results in the first post. If the diode D1 is being modeled as an ideal diode, then my result would change to 1.10 V, which misses on the high side by about the same amount that my 0.7 V diode assumption misses on the low side. Since the diode current is fairly small, perhaps I am simply overestimating the diode voltage drop. If I make it 0.4 V then I get 1.04 V, which looks to be in very close agreement.

    Perhaps the TS can tell us what diode model is being used (or run a sim showing the voltage at across the diode over the course of one period).
    Last edited: Nov 24, 2015
    cmartinez likes this.
  18. Tesla23

    Active Member

    May 10, 2009
    I can also recommend this approach - I was about to type in some very similar calculations but WBahn has saved me the trouble. I obtained 1.14V with Vd = 0.7, with the diode conducting for 35.5% of the cycle.
  19. WBahn


    Mar 31, 2012
    Hmm. Wonder why you came out so much higher than mine.

    When I first did it I incorporated the diode drop into the supply voltage by making it an 11.3 V peak waveform. Making this simplification (which makes the numerical evaluation simpler) yielded 1.03 V, which is pretty darn close to the sim result. So I was surprised when my circuit model that took the diode into account in a more realistic way resulted in a value that went down 30 mV instead of up the 10 mV to 20 mV that I missed the sim results by.

    I may well have an error in my derivation that introduced a minor error in the result.

    If I didn't make a mistake just now, I got a conduction length of 45.5%.
  20. Tesla23

    Active Member

    May 10, 2009
    I don't know - you are closer!

    I balanced the charge on the capacitor, set my input waveform to be V_s cos(\omega t) and assumed the diode conducted from -\phi/2 to \phi /2

    then when the diode conducts the charge added to C is

    Q_{charge} = \frac{V_s}{R_1\omega}(2 sin(\phi/2) - \phi cos(\phi/2))

    when the diode is not conducting, the charge leaking from C is

    Q_{discharge} =\frac{V_o}{R_2}\frac{2\pi - \phi}{\omega}

    where Vo, the output voltage, is related to the angle phi where the diode switches by

    V_o = \frac{R_2}{R_1+R_2}(V_s cos(\phi/2) - V_D)

    equate the two charges and solve for Vo as you did. I may have made a mistake, but it is an exercise for the OP if he is interested.