Gas station without pumps

2018 June 3

VCO (voltage-controlled oscillator)

Filed under: Circuits course — gasstationwithoutpumps @ 11:01
Tags: , , , ,

My students requested that I talk about voltage-controlled oscillators (VCO) and low-frequency oscillators (LFO) for audio work in my applied electronics course.  (We’re in the last week, and they have everything they need to know for the final EKG lab.)

I spent some time Friday night and this morning designing, building, and testing a couple of VCO circuits—one for which frequency is linear with voltage and one for which frequency is exponential with voltage.  Both can easily be turned into low-frequency oscillators by increasing the size of one capacitor.

The oscillators have two outputs: a square wave and a triangle wave. I chose a triangle-wave oscillator, because the design is simpler than for sine waves, and the students have all the concepts they need to understand the design.

The oscillator consists of two parts: an integrator to convert a constant current input into a constant slope: dV/dt = I/C, and a Schmitt trigger to change the current from positive to negative.  Rather than using a Schmitt-trigger inverter chip, I made the Schmitt trigger from an op amp (a comparator would give crisper transitions, but that is not important at the low speeds we’re dealing with).

This design has the frequency linear with the voltage.

The op amp in the upper-left corner is a unity-gain buffer to isolate the input from the rest of the circuit.  It isn’t really needed in this design, and it limits the input voltage range to the power-supply voltage (I used 3.3V).

The next op amp is the integrator, which turns an input current into a constant slope on the output voltage.  The current through the capacitor is 10nF dV/dt.

When the FET is turned off, the current flows through R6+R7, and I= (Vin/2 – Vin)/ (R6+R7), so dV/dt = – Vin/(2* 10nF * 6.6kΩ) = -Vin / 132µs.

When the FET is turned on, the current is the difference between the current through R8 and through R6+R7, and so is (Vin/2)/R8+(Vin/2 – Vin)/ (R6+R7), which simplifies to Vin/(2*6.6kΩ), and dV/dt = Vin/132µs.

The lower-right op amp is an inverting Schmitt trigger with thresholds at 1/3 and 2/3 of Vdd.  It turns on the nFET when the voltage of the triangle wave has dropped below the lower threshold and turns it off again when the voltage has risen above the upper threshold.

The upper-right op amp is just a unity-gain buffer to isolate the output from the oscillator.

My first attempt at this design used larger resistors for R6=R7=R8 and a smaller capacitor, but it had problems when the nFET turned off—the voltage continued to rise for a little while.  The problem was that the drain of the FET had to be charged through R6+R7 before the current through the capacitor was reversed, and this took too long.  Shrinking the resistors made the capacitance on the drain of the FET much less important.

This design has the frequency exponential with voltage (about one octave per 70mV).

The oscillator design is the same as for the linear one, but the diodes provide an exponential current from the input voltage. The input unity-gain buffer is now important, as it provides current limiting to prevent damage to the diodes.  To get double the current through the FET when it is turned on, the diodes are put in parallel on the lower leg (a series arrangement on the upper leg like for the resistors would not halve the current).

I tested both circuits and they seem to work ok, with duty cycles close to 50% for the square wave.  There are slight high-frequency glitches at the peaks of the triangle wave, so it may be worth replacing the output unity-gain buffer with a 40kHz low pass filter.

This is a fairly high frequency from the diode-controlled oscillator (15.431kHz) and the duty cycle is a bit off (59.36%), because the current has gotten large enough that the on-resistance of the nFET matters.

At 500mV, the frequency is 25.77Hz, the duty cycle is about 48%, and the glitches are not visible at this time scale.

I measured and plotted the frequency as a function of voltage for VCO with diodes:

The fit is done here omitting the lowest and highest points. I believe that the highest point has hit the current limits of the input unity-gain buffer, and so is not on the straight line.

The frequency scaling of the diode-based VCO could be changed by replacing the input unity-gain buffer with an amplifier with a different gain.

(2018 June 23: I feel compelled to point out that this circuit does not have any thermal compensation, and the exponential conversion of voltage to current in the diode junctions is highly temperature sensitive.  I’ll try this summer to redesign the circuit to have temperature compensation, though the use of 3 diodes here makes that difficult—a sawtooth oscillator, with only diode would be somewhat easier.)


  1. hi..i make your vco on falstad ..the first design…but dont giveme 1.8kz…why???

    Comment by Manuel Robles — 2020 February 19 @ 19:03 | Reply

    • I’ve no idea—you did not give me enough information to debug your problem. Circuit simulators are often inaccurate, though poor entry of schematics is more common problem. I don’t know where the problem is here. I’ve never used falstad, so I’ve no idea whether it is a decent simulator or what its limitations are.

      Comment by gasstationwithoutpumps — 2020 February 19 @ 22:05 | Reply

  2. hi can you help to explain the formula of first image? what is the value of vin and vdd

    Comment by reservar hotel — 2021 July 12 @ 13:06 | Reply

    • Vdd is whatever voltage is appropriate for powering your op amps. In the test circuit, I used MCP6004 op amps with Vdd=3.3V (though 5V or 6V would also have worked).

      Vin is the control voltage for changing the frequency. The formula is derived in the body of the text—the current determines how fast the capacitor charges and discharges, and the Schmitt-trigger circuit determines when the circuit changes between charging and discharging.

      Comment by gasstationwithoutpumps — 2021 July 12 @ 14:47 | Reply

  3. wich value is for Vin, Vdd & power supply ic´s? also single or dual power supply?

    Comment by reservar hotel — 2021 July 12 @ 17:08 | Reply

    • The circuit uses a single power supply, Vdd, with the voltage at 3.3V for the tests I did (though anything from 2V to 6V would probably work with the MCP6004 op amps). Vin is the input voltage for controlling the frequency, and can be anywhere from 0V to Vdd.

      Comment by gasstationwithoutpumps — 2021 July 12 @ 17:21 | Reply

      • ok tnks for your using tl082 could work? so i have to use only positive voltage on pin 8 and ground to pin 4 right?

        Comment by reservar hotel — 2021 July 12 @ 22:48 | Reply

        • I’ve not used the TL082 op amp, but it might work, with some changes to the voltage ranges. That op amp is an old-fashioned one designed for ±15V dual power supplies.

          The TL082 does not have rail-to-rail input range—in fact, it has quite a narrow input range, with the common mode supposed to stay 4V away from either power rail (unless you have a TL082H, which can get a little closer to the rails). That means that you need at least a 9.6V power supply for the Schmitt-trigger circuit (the bottom right amplifier), but I’m not sure that the unity-gain buffer on the input would have the right range, nor the integrator in the middle. For that op amp, we’d probably have to change the source voltage on the nFET and change the range of the voltages for the input. That might be doable simply by using a dual power supply, and replacing the ground connections to -Vcc connections except for the nFET source, which would stay at ground. I don’t have any old-fashioned high-voltage op amps around, and I’m not going to rush out and buy a new power supply just to see whether this circuit would work with them. If I were designing with a dual power supply in mind, I’d probably do the circuit a bit differently anyway.

          It is probably easier for you to buy some MCP6004 op amps, since they are quite cheap.

          If you want to improve the circuit, replace the Schmitt-trigger op amp with a rail-to-rail comparator (like the TLC3702).

          Comment by gasstationwithoutpumps — 2021 July 13 @ 09:38 | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: