I want to create a sawtooth signal generator. I know, how to build op-amp comparator to create a square wave. I also know, how i can get triangular signal by integrating comparator output with op-amp integrator.

What i don't know nor find is how do i get sawtooth signal out of square/triangular wave. Could someone explain this a bit and es

Thank you.


1 Answer 1


A saw tooth generator circuit can be built using a constant current source to charge a capacitor in a linear ramp. A comparator is then set to monitor the ramp for its upper threshold. At the upper level the comparator then flips state and is used to discharge the capacitor quickly. If the comparator is setup with positive feedback so that it has both an upper and lower threshold then the comparator will flip back when the capacitor has discharged to the lower level. This would allow the cycle to repeat again. This would be a simple way to get a repeating sawtooth ramp. You may want to buffer the ramp with an opamp voltage follower depending on the type of load you want to use.

Note that it is not directly feasible to get a sawtooth waveform at the same frequency from a square wave or triangle wave. At least not without a lot of extra circuitry so it is generally best to generate your saw tooth separate from the square or triangle and then switch to the sawtooth when needed. Now that said it is entirely possible to setup a circuit that can be used to generate the square wave and triangle wave using the same set of comparators if you choose one function at a time.

Edit: Here is a simulation circuit showing how a sawtooth generator circuit could be built. This example with nominal values runs at about 1kHz.

enter image description here

enter image description here

  • \$\begingroup\$ Could you edit your post by adding a schematics. TY \$\endgroup\$
    – 71GA
    Commented Jan 9, 2013 at 17:59
  • \$\begingroup\$ Sure. I'll add a typical saw tooth generator circuit. \$\endgroup\$ Commented Jan 9, 2013 at 18:17
  • \$\begingroup\$ One could design a circuit which, given a triangle wave of arbitrary frequency and DC offset, would--assuming "ideal" components, produce a sawtooth wave of the same frequency and DC offset. Use sample/hold circuits to measure the upper and lower bounds of the triangle wave, and then during the rising portion compute "output = (input+min)/2", and during the falling portion "output = (3*max-input)/2". \$\endgroup\$
    – supercat
    Commented Jan 9, 2013 at 19:23
  • 1
    \$\begingroup\$ You should put your circuit into LT-Spice (free at www.linear.com) and check out how the circuit works with those values. Then using an oscilloscope compare what you see in the simulation against the circuit that you built. This can lead to a better understanding of what you built, help get it debugged and give satisfaction that you learned something. BTW you didn't say what you did with R5. Note that R3, R4 and R5 are setting the threshold values for the comparator - changing them too much may render a non-functional circuit. (Cont next comment). \$\endgroup\$ Commented Jan 10, 2013 at 13:31
  • 1
    \$\begingroup\$ @71GA - Just so you know the LM358N is a dial op-amp. It should be able to function in this circuit topology. \$\endgroup\$ Commented Jan 11, 2013 at 1:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.