Discrete Sawtooth Oscillators

I've been playing with swept oscillators recently, so work on sawtooth oscillators was required. Normally I'd use an op-amp or a 555, but for fun I decided to see just how simple I could make a sawtooth oscillator using discrete components. A unijunction transistor is by far the easiest way to make one, but unijunctions aren't cheap or easily available any more. BJTs however are, so I constrained myself to common components that were available everywhere. It is quite easy to implement a unijunction-like device using a complementary pair of BJTs - the result is something quite like the commercially available programmable unijunction transistors but with more versatility since you have access to all the "layers" inside the composite device.


The basic oscillator needs just two transistors, one NPN, the other PNP. The capacitor C1 starts discharged, it is charged through R1, producing the familiar 1st-order charging solution. The PNP, Q1 has its base biased (via R2 and R3) such that it is cut off until its emitter voltage (the capacitor voltage) exceeds the base voltage by the BE diode drop. Once this happens, the PNP starts conducting a base current into the NPN Q2. Q2's collector sinks current from the divider and from Q1s base regeneratively slamming it on hard which in turn slams on Q2. C1 discharges through Q1 and Q2 until its voltage drops to the minimum of Q1's and Q2's EB drops and saturation voltages. As Q2's base current drops to zero the divider voltage rebounds and the the charging cycle begins again. This is a simple relaxation oscillator.

Basic Sawtooth Generator

Examining the limits of this circuit is is obvious it has some problems. In particular, the capacitor is essentially shorted through Q1 and Q2, driving almost half an Ampere through both transistor's base-emitter junction. This is very hard on the transistors, and while brief I do worry that such operation would slowly damage the devices. (In practice the devices seem unharmed, but this operation is outside their datasheet limits.) The maximum ramp voltage is limited by the base bias of Q1, we can increase it by dropping the value of R2 and/or increasing R3. Dropping R2 means more current will be sunk by Q2 when it saturates, so it can't be reduced too much. Another limit is that R2 must drop at least the EB drop of Q1 or else the transistor will never turn on and the circuit will fail to oscillate. We can however insert a diode to provide the minimum drop required and avoid having to computing a minimum resistor value based on other parameters like supply voltage. We leave R2 in place to limit the discharge cycle current in Q2 and are now free to increase R3 to a large value to get almost the maximum available output voltage.

Diode Dropper Circuit

Now we reduce the peak currents through the transistors by adding another diode and slightly rearranging the circuit. D2 now carries the bulk of the discharge current, which is no longer allowed to flow directly through Q1's base into Q2's collector, and with the available drive current for Q1 limited during discharge by the large R3, the discharge pulse is extended somewhat the reduced in magnitude to something all components in the circuit can handle. (A resistor may also be placed in Q2's base to further limit the current in that discharge path - and Q2's saturation depth - steering most of the discharge through D2 and into the collector instead where it can be controlled by the base current.)

Collector Dumped Circuit

Technically the 2N3904 datasheet doesn't specify the maximum pulsed collector current (or the maximum base current for that matter). The current pulse peaks at about 350 mA which exceeds the continuous rating of 200 mA but the duty cycle is so short it is only dissipating about 3.6 Watts for a few microseconds. You might wish to not bother with this modification.

Linear Voltage Ramp

To make the ramp of the charging cycle linear with time the capacitor must be charged from a constant current. R1 is replaced with another PNP Q3, which implements a constant current source. Q3's base voltage is fed from a diode drop, leaving just a single resistor R1 to vary the charging current, and hence frequency of oscillation. This isn't the best topology for frequency stability with temperature changes however.

Linear Ramp Circuit

An alternative if you don't mind output amplitude varying with frequency (e.g. fixed frequency use) is to use the Q1 base biasing to also bias the current source. This makes R3 the frequency determining resistor but amplitude will drop as frequency increases (R3 drops).

Simpler Linear Ramp Circuit

The resulting circuit is very simple, three common BJTs, two diodes, two resistors and one capacitor. If the ramp signal must source or sink a significant current an emitter follower of the appropriate gender can be used to buffer it. The voltage at Q2's collector in either circuit is almost rectangular and can be used as a sync output if so desired. The circuit is almost perfect for a discrete component VCO sweeper generator, keeping about a volt bias of reverse bias on a varactor at minimum (frequency linearity will still be a problem however, in some cases the 1st-order waveform may work better than the linear one).

Practical Circuit

That's all looks great in spice so I built the practical circuit (the single-bias version).

Practical Circuit Lash-Up

In practice it behaves differently once the supply voltage exceeds about 8 volts. A small non-linear region near the bottom of the ramp appears that isn't simulated in spice. This is caused by Q1's base-emitter junction avalanching at about 7.4 volts. Once Q2 turns off and the bias rebounds essentially immediately the capacitor remains discharged placing a large reverse voltage across Q1's BE junction which breaks down until the capacitor charges up to reduce the reverse voltage to below the breakdown threshold. Reducing the supply voltage removes the effect, additional diodes could eliminate it.

Breakdown Causing Ramp Non-Linearity

This is an excellent reminder of how simulation is often not sufficient for design verification. The spice models for the devices clearly don't model the breakdowns. I tested a fistful of 2N3906s from the junkbox for their BE breakdown, all were around the 7.3-7.5 volts (at a constant resistance of 12k from 13.8 volts), the datasheet minimum is 5 volts. (You could use this as a bandgap reference in a pinch, but I don't like to design circuits that use an uncontrolled parameter.) I simulated the breakdown using a Zener model in LTSpice (D4 and D5).

Breakdown Model Emulation Circuit

The result in silico is very similar to what is observed in the practical circuit. The fix is easy (D5 and D6 are just for the breakdown modelling and aren't required in the practical circuit).

Breakdown Avoiding Circuit

This circuit includes an additional diode D2 in Q1's base to prevent the reverse breakdown. Note also the small resistor in series with the capacitor, this limits the discharge current pulse and can be increased quite a bit to lengthen the discharge cycle before its value disturbs the amplitude of the waveform or its linearity too much. The current source however is no longer easily biased from the threshold dropper so the simplified circuit is not very practical. In practice it is probably better to have a separate current control circuit which can vary the rate without impacting the amplitude. The saturation voltage of the current source transistor means the dropper diode is no long sufficient to guarantee the threshold is correct for any R2 value, but practical values that won't destroy Q2 during discharge should present no problems. Removing the diode would require reducing R3's value and sacrificing voltage swing. Adding another diode however almost completely compensates for the compliance limits of the current source allowing R2 to be made very small if required. In the opposite direction R2 can be too large; the circuit will behave as a one-shot with Q2 remaining on. A more robust circuit for smaller currents can feed the current source from a tap on the dropper string which is pulled down by Q2 during discharge helping to turn-off the discharge.

Fixed Breakdown Trace


The linear ramp circuit with the bootstrapped charging resistor suggested by Russell (see comments):

Bootstrapped Charging Resistor Circuit



title type size
Basic Generator LTSpice File application/octet-stream 1.121 kbytes
Diode Dropper LTSpice File application/octet-stream 1.211 kbytes
Collector Dumped LTSpice File application/octet-stream 1.388 kbytes
Linear Ramp LTSpice File application/octet-stream 1.658 kbytes
Simpler Linear Ramp LTSpice File application/octet-stream 1.450 kbytes
Breakdown Avoiding LTSpice File application/octet-stream 2.040 kbytes
Breakdown Model Emulation LTSpice File application/octet-stream 1.937 kbytes
Bootstrapped Charging Resistor LTSpice File application/octet-stream 1.540 kbytes