Designing a Triangle/Square wave VCO part 2!

As mentioned in the previous post (https://hsel.co.uk/2014/08/08/designing-a-trianglesquare-wave-vco-part-1/), the maths and somewhat lesser interesting theory will be discussed in this post!

Now just as a disclaimer: I’ve just completed my first year of university and we do cover the shockley equation, we don’t however cover lambert W function and I don’t want to use an interative matlab method to calculate the voltage drop across the current setting resistors though I will include the equations on how to do this if one wishes to do this themselves! In the ideal world where the forward voltage drop of transistors is constant, regardless of current flow, the frequency response with respect to the control voltage would be linear! A control voltage of 1V will produce frequency X where as a control voltage of 2V will produce the frequency X + 2*A. Unfortunately, the voltage drop across the resistors in the current source will not be constant as the voltage drop across the base emitter junctions will vary with the current flowing through them posing a problem. The problem here is that without knowing the current through the base emitter junction, one cannot know the voltage, conversely, not knowing the voltage across the junction means that the current through the junction can’t be worked out, a total catch 22 situation, hence the requirement for an iterative solution.

However, I can quite easily predict the current with respect to the voltage by using a constant value for the junction forward voltage drop. The values used in the current calculation are:

Vs = 5V
Vs Midpoint = 2.5V
2*Vs/3 = 3.33333…V – used internally by the 555 timer
Vs/3 = 1.66666…V – also used internally by the 555 timer
Current source transistor VFwd = 0.5v
Current sink transistor VFwd = 0.5v

Source current mirror set resistor(R6) = 10k
Sink current mirror set resistor(R5) = 10k
Frequency setting capacitor(C1) = 10nF

All of the above values are standard assumptions and can be changes to the users taste (apart from the values used by the 555 timer).

So onward with the math! It is actually really simple throughout and hopefully you can follow it fine. I’ve written it all up using an excel workbook so I’ll upload that at the end for anybody to use. 

The first step is calculating the current flowing through the two current mirrors. I’ll be using a control voltage of 1v as an example meaning that the voltage present at the resistor connected to the top current source will be 5v-1v = 4v.

Calculating the current through the current source is as easy as ohms law and a bit of subtracting.

I(Source) = (Vs – VFwd(Source) – VCtrl(Control voltage @ Source resistor))/Source resistor

And in this example:
0.00005 = (5 – 0.5 – 4)/10k = 0.5/10k = 50uA.

The same style of equation is used for the current sink though it is a tad easier.

I(Sink) = (VCtrl(Control voltage @ Sink resistor) – VFwd(Sink))/Sink Resistor

In this same example:
0.00005 = (1 – 0.5)/10k = 0.5/10k = 50uA

Calculating the current is probably the most important part as this includes most of the variables and is what controls the rate at which the capacitor is charged and discharged.

Now that the actual charge/discharge currents have been calculated, the time that it will take to charge up the capacitor to the sufficient voltage can be calculated. Using the previously mentioned equation V = IT/C, you can re-arrange the equation, making T the subject: T = VC/I.

The above variable T is the time taken to charge/discharge the capacitor based on the current I. Realistically, as I and C are constant, V is time varying. As we know that this will be linear, I’m just going to leave the equation as it is. The V is composed of the voltage difference. As we know we’re charging between 1.666…V and 3.333…V, the voltage difference will be the absolute difference between these two like so:

T(Charge) = abs(V(End voltage) – V(Start Voltage))*Capacitance/Charge current

And in this example:
0.000333333… = abs(3.333…V – 1.666…V)*10nF/50uA = 333.333…us

Once again, because we have symmetrical charge and discharge times, the equation will be the same for the discharge but just for continuity:

T(Discharge) = abs(V(End Voltage) – V(Start Voltage))*Capacitance/Discharge current

Giving the final values:
0.000333333… = abs(1.666…V – 3.333…V)*10nF/50uA = 333.333…us

Now that the time required to charge and discharge the capacitor is known, the sum of these two times will give the total time period at 666.666…us! As per, T = 1/F, therefore F = 1/T. The frequency that the capacitor should be oscillating at will be equal to 1/666.666us which is equal to: 1500Hz

So over to the simulator to see what we’re getting!

FreqPred1
The simulation results including an FFT of the square wave data

Well as can be seen above, the data frequency is pretty darn close to the correct frequency at 1.5KHz! The main help of this was our prediction that VFwd for both the current sink and source would be 0.5V. After measuring within LTSpice, it can be seen that VFwd was exactly 519.9mV, not too far off our original expectation! Just to demonstrate however that using the same values but changing the control voltage to 4V will produce a larger error:

Using the above calculations, a control voltage of 4V should give an output frequency of 10.5kHz. Remember here that as the control voltage has increased, the current through the base emitter junction of the transistors will increase, increasing the voltage drop and therefore adding error to our current calculation. Running the simulation with a control voltage of 4V produces a frequency of 10.2KHz. Ok, that’s not a MASSIVE error but still an error of 2.9% none the less. With an iterative method, this could be calculated and predicted much better though if you’re using this for a relatively low precision project, it shouldn’t be a massive deal!

After using excel and interpolating values from 0.6V to 4.4V in steps of 0.2V, with a 10nF capacitor, the equation for frequency with respect to voltage should be: F = (30*V – 15)*100. To test if this rings true, with our 1V, we calculated a frequency of 1.5KHz. Placing this into the above equation produces a frequency of:
(30*1 – 15)*100 = 1.5KHz!

Using the same equation for the 4V value, we calculated the frequency to be 10.5KHz. Substituting this value into the above equation gives:
(30*4 – 15)*100 = 10.5KHz!

Remember however, the above equation will be dependent on the capacitance and sink/source current setting resistors. Also, ensure that the control voltage range is no larger than V+ – 0.5 and no smaller than 0.5v to ensure the transistors remain forward biased, otherwise the current sources won’t behave properly and we violate the assumption that the capacitor is being linearly charged!

VCOCalc

One day, when I get enough time, I’ll build this up and test it properly! Unfortunately, I haven’t got time to do that at the moment so it will have to be in the future sometime. Until then, you’ll just have to live with the simulations, or build it yourself! The circuits are released under CC BY-SA. If you end up making it, drop me a message so I can see it in action!

I hope you’ve enjoyed my brief VCO design tutorial/ramble. Hopefully I’ll have time for some more cool analog designs in the future!

 

Advertisements

One response to “Designing a Triangle/Square wave VCO part 2!

  1. It’s the best time to make some plans for the future and it’s time to be happy. I’ve read this post and if I could I wish to suggest you some interesting things or suggestions. Maybe you could write next articles referring to this article. I want to read more things about it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s