Fork me on GitHub

Project Notes

#163 VariableSawtoothGenerator

Test a variable-geometry, fixed-amplitude sawtooth wave generator circuit


This is an interesting sawtooth wave generator that’s described in an excellent w2aew tutorial.

It uses two independently-controlled BJT current sources to sequentially charge and discharge a capacitor - generating the rising and falling slopes of the wave.

A comparator with hysteresis is used to switch the current sources.

Components and Limitations

I’m using an LM324 op-amp for the comparator and buffer circuits. This is just borderline acceptable, since it is not rail-to-rail and so the resulting votage differential in the hysteresis cycle is only about 1V. It also seems to be contributing some degree of crossover distortion.

1N4148 diodes are recommended, but I did try replacing them all with standard 1N4007 rectifers. While the circuit still functioned, with 1N4007 diodes there was more distortion of the waveform - I think primarily because of the lower switching speed.

Results - LM324

The following trace is with a 5V supply. It’s a bit hard to read because I crammed 4 measurements in one. The inputs are all DC coupled with no offset to the centre 0V line. comparator output swings from ~0.7V to ~3.7V (showing how far from rail-rail the LM324 is!) *

5v trace LM324

Channel Colour Probe Point Measurement
CH1 yellow SAWOUT saw output
CH2 blue SQUAREOUT comparator output / left of diode bridge, swinging from ~0.7V to ~3.7V
CH3 red P3 charging current source
CH4 green P4 comparator voltage threshold


Replacing the LM324 with LF347N, circuit loses dynamic range but still produced a relatively undistorted wave.

5v trace LF347N


Replacing the LM324 with TL074CN, circuit loses some dynamic range and has significant crossover distortion.

5v trace TL074CN



The Schematic

The Build

Credits and References

About LEAP#163 OpAmpOscillators
Project Source on GitHub Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is my personal collection of electronics projects, usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting (IMHO!).

The projects are usually inspired by things found wild on the net, or ideas from the sources such as:

Feel free to borrow liberally, and if you spot any issues do let me know. See the individual projects for credits where due. There are even now a few projects contributed by others - send your own over in a pull request if you would also like to add to this collection.