Capacitor grounded between two resistors

Thread Starter

Dominati

Joined Aug 18, 2015
7
Hi guys.

This is part of a segment of a design I came up with using schmitt triggers as relaxation oscillators.

The picture below shows the 4 possible states of the circuit at any given time.

Basically, the left side toggles between 0V and 3V faster than the right. From this, the voltage across C3 changes at different rates given what 'state' the schmitts are in (0,0...0,3...3,0...3,3). This changes the oscillation rate and hence generates two different tones.

The capacitor voltage moves between 0.478V and 2.054V as thats the upper and lower thresholds the schmitt toggles its output.

Basically what I need to do is find the time taken to charge then discharge, with respect to C. From here I can spreadsheet capacitor values and pick one that generates the frequency I desire.
The (0,0) and the (3,3) states are easy because its a simple RC circuit after you combine the parallel resistors.
The (0,3) and the (3,0) states are harder because as Vc goes up, it opens up a potential voltage drop across the other resistor.

This is the formula I derived to find t with respect to C;



Granted the only difference is the direction the 3V comes from for these 2 harder states, I thought I could just swap what i substitue for R1 and R2 around.
When R1 = 3300ohms, R2 = 560ohms....I can solve it.
But when R1 = 560ohms and R2=3300ohms I get a negetive inside my log and cant get any further.

Is there a better way to be trying to calculate these 2 conditions? How can I work out the (0,3) state?

Thanks for any help.
 

crutschow

Joined Mar 14, 2008
34,468
Another way to solve the problem is to calculate the Thevenin equivalent resistance and voltage of the two resistors and the various states, and use that to calculate the needed time constants. That gives one equivalent resistor and one capacitor, which should make it easier to solve the exponential for the required value of C.
 

Thread Starter

Dominati

Joined Aug 18, 2015
7
Another way to solve the problem is to calculate the Thevenin equivalent resistance and voltage of the two resistors and the various states, and use that to calculate the needed time constants. That gives one equivalent resistor and one capacitor, which should make it easier to solve the exponential for the required value of C.
Thanks for the reply. I'm just a bit stuck as to how to represent V_th. Are you able to push me in the right direction please?
 

MikeML

Joined Oct 2, 2009
5,444
The same time constant applies to all four steps because the circuit can be reduced to a Thev. Equiv. containing only one voltage source and one resistor. The final voltage at each step can be solved as a simple voltage divider.

Here it is with three volt steps:

266.gif
 
Last edited:

MrAl

Joined Jun 17, 2014
11,496
Hi guys.

This is part of a segment of a design I came up with using schmitt triggers as relaxation oscillators.

The picture below shows the 4 possible states of the circuit at any given time.

Basically, the left side toggles between 0V and 3V faster than the right. From this, the voltage across C3 changes at different rates given what 'state' the schmitts are in (0,0...0,3...3,0...3,3). This changes the oscillation rate and hence generates two different tones.

The capacitor voltage moves between 0.478V and 2.054V as thats the upper and lower thresholds the schmitt toggles its output.

Basically what I need to do is find the time taken to charge then discharge, with respect to C. From here I can spreadsheet capacitor values and pick one that generates the frequency I desire.
The (0,0) and the (3,3) states are easy because its a simple RC circuit after you combine the parallel resistors.
The (0,3) and the (3,0) states are harder because as Vc goes up, it opens up a potential voltage drop across the other resistor.

This is the formula I derived to find t with respect to C;



Granted the only difference is the direction the 3V comes from for these 2 harder states, I thought I could just swap what i substitue for R1 and R2 around.
When R1 = 3300ohms, R2 = 560ohms....I can solve it.
But when R1 = 560ohms and R2=3300ohms I get a negetive inside my log and cant get any further.

Is there a better way to be trying to calculate these 2 conditions? How can I work out the (0,3) state?

Thanks for any help.
Hi,

Are you saying that you are providing a PWM signal to both resistors?
Can you show the whole circuit?
How do you determine what the initial capacitor voltage is for any state?
 

Thread Starter

Dominati

Joined Aug 18, 2015
7
Hi,

Are you saying that you are providing a PWM signal to both resistors?
Can you show the whole circuit?
How do you determine what the initial capacitor voltage is for any state?
Hi, yes this is correct.

Basically it all boils down to the schmitt, which has preset toggle points, it will always be trying to charge to the upper voltage or discharge to the lower voltage, because when it hits the thresholds, the output toggles.

http://imgur.com/9eauTAu
 

Thread Starter

Dominati

Joined Aug 18, 2015
7
The same time constant applies to all four steps because the circuit can be reduced to a Thev. Equiv. containing only one voltage source and one resistor. The final voltage at each step can be solved as a simple voltage divider.

Here it is with three volt steps:

View attachment 90302
This isnt how the capacitor behaves though because the output toggles between 0V and 3V as the Vc hits the thresholds.
Here is the full circuit.

http://imgur.com/9eauTAu
 

MikeML

Joined Oct 2, 2009
5,444
This isnt how the capacitor behaves though because the output toggles between 0V and 3V as the Vc hits the thresholds.
Here is the full circuit.
Then why did you waste our time? What I simulated matches your description of the problem. And why post your diagrams on an external website where we are subjected to a barrage of adverts?
 

Thread Starter

Dominati

Joined Aug 18, 2015
7
Then why did you waste our time? What I simulated matches your description of the problem. And why post your diagrams on an external website where we are subjected to a barrage of adverts?
Sorry if you feel that way MikeML, but I am not here to waste anyones time and I did stipulate this in the original post,
The capacitor voltage moves between 0.478V and 2.054V as thats the upper and lower thresholds the schmitt toggles its output.
I also did try to input an image but as you can see by the broken link it wouldn't let me, hence I edited the post and provided the direct link. Sorry for any inconvenience this caused.

Here is a picture of Vc and its respective toggles. The green line represents the toggle on the left side of the circuit. Blue line is the capacitor charging and discharging and the red line is respective to this Vc toggling between 3v and 0v.

 

MrAl

Joined Jun 17, 2014
11,496
Hi,

You can see from your simulation that the capacitor does not charge from 0v to 3v, nor from 3v to 0v, and even if it did appear to do that for your chosen set of other values (in addition to the cap and two resistors you talk about) then you would still want to consider it because not all values of the other components and the cap and two resistors will lead to a situation where the cap does go from 0 to 3v and back again. That, and the fact that the thresholds are always above zero means any formulas must included your initial cap voltage.

It appears that the right side Schmitt is the main oscillator, and the left one change the period because of the change in bias caused by R2.

What happens to the cap in the center (C2) is it will charge to some level and then back down to some other level, which means two levels of which neither will be zero.

The basic charge formula changes then from:
Vc=Vs*(1-e^(-t/RC))

to:
Vc=Vs-Vs*e^(-t/RC)+Vc0*e^(-t/RC)

where Vc is the cap voltage and Vs is the source voltage, and Vc0 is the cap voltage at the start of the charge cycle.

The discharge formula stays the same:
Vc=Vc0*e^(-t/RC)

and you get Vc0 for this from the charge formula for Vc above. This leads to another Vc0 which you then use in the formula above for the charge cycle. So you go back and forth calculating the charge, then the discharge, then the charge again, using the Vc from the last calculation for the Vc0 of the next calculation.
The upper limit of Vc however will be the threshold of the second Schmitt because that causes the start of the discharge cycle, so it's a little easier because of that. If the upper threshold is VTH, then the discharge cycle leads to:
Vc=VTH*e^(-t/RC)

and then that Vc becomes Vc0 for the charge cycle:
Vc=Vs-Vs*e^(-t/RC)+Vc0*e^(-t/RC)

What is unusual however is that he second Schmitt will also act as an oscillator because the resistor R7 will cause the cap to discharge which will change the state of that second one. This means it will oscillate regardless of the state of the first oscillator. The state of the first oscillator will just influence the period.
So to calculate the period of A2 you would analyze the circuit with the left side of R2 either at 3v or at 0v, while the output of A2 switches between 0 and 3v, and the upper threshold of the cap C2 is the upper threshold of the Schmitt, and the lower threshold is the lower threshold of the Schmitt.

Because there are two resistors that change levels the general formula comes out to be:
Vc=(E1*R7+E2*R2)/(R7+R2)-(((C2*E1-Vc0*C2)*R7+(C2*E2-Vc0*C2)*R2)*e^(-(t*(R7+R2))/(C2*R2*R7)))/(C2*(R7+R2))

and simplified a little:
Vc=(((Vc0-E1)*R7+(Vc0-E2)*R2)*e^((-t*R7-t*R2)/(C2*R2*R7))+E1*R7+E2*R2)/(R7+R2)

where E1 is the voltage out of the first Schmitt, and E2 is the voltage out of the second Schmitt, and Vc0 is the initial cap voltage.
Note there is probably a series solution for this but i'll leave that for another time.

The way to use this general formula is you set Vc0 to the initial cap voltage from the first cycle (either the upper threshold or the lower threshold) and you set E1 to either 3v or 0v depending on the state of the first Schmitt. You then calculate the output Vc with either E2=0 or E2=3 depending on the current state of the second Schmitt, alternating E2 and calculating the time required to reach the next threshold. Simultaneously calculate the output of the first Schmitt, and when that changes state E1 in the long formula above changes from 0 to 3 or from 3 to 0.
Note that if the two are synchronized (not likely) then the switch point of the first changes at the same time the second does, but because they are independent oscillators that is not the typical case. This means that there will be times when the first switches at mid cycle of the second, but you dont have to think about that too much as long as the first is much slower than the second. If the two periods are comparable however, then you would need to take this into consideration or else the calculations would not be correct.

If you'd like to go though an example we can do that too.
 
Last edited:

MrAl

Joined Jun 17, 2014
11,496
Hi,

That's good :)

It should not be hard to solve that last equation i posted for 't'.
I checked the charge and discharge times with the values you posted and it came out pretty close. The variation will come in as a threshold voltage difference, where you'll have to know the threshold voltage for the two Schmitt sections. They publish this info, but it can vary a little bit.

Here is the solution for 't':

t=-(C2*R2*R7*ln(((E1-Vc)*R7+(E2-Vc)*R2)/((E1-Vc0)*R7+(E2-Vc0)*R2)))/(R7+R2)

Vc is made equal to the threshold voltage, either high or low, for either the charge or discharge cycle. E1 is either 0v or 3v, E2 is either 0v or 3v. Vc0 is the threshold voltage from the previous hal cycle. "ln" is the natural log.
So if the threshold voltages were 1v and 2v and with the output of the first section zero volts and we wanted to calculate the time to charge to the upper threshold, we would set E1=0, E2=3, Vc=2v, Vc0=1v, and set all the R's and the C to the right values, then we could calculate the time 't' that it takes the cap to get from 1v to 2v. For the discharge, we set E2=0, Vc=1, Vc0=2, and again calculate the time 't' but this time it would be the discharge time.
The total oscillation period Tp is the time for one charge cycle plus the time for one discharge cycle. The frequency is then f=1/Tp.

BTW there is also a limitation on the value of the two main resistors because if the left resistor is made too small, the right side oscillator will not be able to oscillate because the cap voltage will never reach the correct threshold. This is easy to figure out too by calculating the voltage for a long time period to see what the limiting voltage is, and if it does not reach the intended threshold voltage then it wont work with those values of resistors.
The limiting values can be found from:
Vc=(E1*R7+E2*R2)/(R7+R2)

If for any half cycle Vc can not get high enough or low enough (as needed) then the values for the resistors must be changed or it wont oscillate. So for example if the threshold voltage is 2v and we calculate 1.9v from the above, then the second oscillator wont be able to oscillate.
 
Last edited:

MrAl

Joined Jun 17, 2014
11,496
Hello again,

I did a couple "home made" simulations and found some interesting results.
Varying E1 from 0 to 3v, i see the charge time and discharge times switch roles. By that i mean that with E1=0v i see a charge time maybe 22.5us and discharge time 33.5us, and with E1=3v i see the charge time go to 33.5us and the discharge time go to 22.5us (for example). This is interesting because the frequency itself does not change, just the duty cycle.
Someone might want to verify this using a normal simulation. The simulation i used was a hard coded numerical simulation using a computer language and starting from scratch. The results i am posting below. Note there is a startup time which can be ignored. After that, there is a repetition of low and high periods. The thresholds i used were 1v and 2v, and Thp is the half cycle time.


Code:
  E1=0.0
t          Vc        Thp         E2
0.000000  0.000788  0.000000010  3.0
0.000049  2.000076  0.000049250  0.0
0.000072  0.999800  0.000022570  3.0
0.000105  2.000076  0.000033180  0.0
0.000128  0.999800  0.000022570  3.0
0.000161  2.000076  0.000033180  0.0
0.000183  0.999800  0.000022570  3.0
0.000217  2.000076  0.000033180  0.0
0.000239  0.999800  0.000022570  3.0


  E1=3.0
t          Vc        Thp         E2
0.000000  0.000922  0.000000010  3.0
0.000036  2.000298  0.000035760  0.0
0.000069  0.999959  0.000033180  3.0
0.000092  2.000218  0.000022570  0.0
0.000125  0.999931  0.000033180  3.0
0.000147  2.000204  0.000022570  0.0
0.000180  0.999926  0.000033180  3.0
0.000203  2.000201  0.000022570  0.0
0.000236  0.999925  0.000033180  3.0

You'll notice the thresholds are not exactly 1v and 2v, and that is because a step size was used that is a little larger than would be required to see more exact threshold trip points, but making it smaller doesnt change and of the results much. For example:
0.000216 2.000001 0.000033177 0.0
0.000239 1.000000 0.000022566 3.0
 
Last edited:
Top