I'm trying to realize a sawtooth wave generator. The circuit is composed by an op-amp integrator which creates the ramp. Then the integrator output is chained to a comparator with a fixed threshold, which feeds a NPN BJT through a resistor. I want to use the BJT as a switch. When the input signal is below the threshold, the Ib current is 0 and BJT Vce is 'high' and the Ib is null, but when the input signal is over the threshold, the BJT Vce becomes 'low' (saturation condition) while the Ib is greater than zero. I'd like to connect the BJT to the Capacitor in the integrator module so that the capacitor can be discharged, but I don't understand how. Can you help me please? Thank you very much.

Here is a LTSpice sketch of the project.enter image description here

  • \$\begingroup\$ @bummi - why have you edited this question? The edit you have applied makes my answer look incorrect. Either restore the edits or completely take into account that my answer is compatible with the previous version. \$\endgroup\$
    – Andy aka
    Commented Jan 19, 2016 at 14:07
  • \$\begingroup\$ @Andyaka rollback if you don't agree, I included an NAA, sorry if I went wrong. \$\endgroup\$
    – bummi
    Commented Jan 19, 2016 at 14:10
  • \$\begingroup\$ OK rolled-back. Basically you over wrote the first diagram which had the problem with the NPN transistor being connected to 0V instead of -Vs. \$\endgroup\$
    – Andy aka
    Commented Jan 19, 2016 at 14:11
  • \$\begingroup\$ I undeleted the reply that I posted some minutes ago. \$\endgroup\$ Commented Jan 19, 2016 at 14:30

2 Answers 2


Consider this circuit for a minute: -

enter image description here

Other than using a BJT to control the capacitor discharge, it self oscillates and produces a clean triangle waveform and a decent square wave. Now consider what happens when the 2k2 has a diode across it.

This is effectively what you are trying to achieve (saw-tooth) with a transistor - the diode massively reduces the charge time (or discharge time) dependent on the diode direction but think about how this discharge would occur - you need the transistor going to the negative rail and not the earth (mid-rail point) for this to work correctly. It would work in the above circuit (when the diode is added) because the output from the comparator has high negative and positive output voltages with respect to 0V (mid-rail).

Your circuit has the BJT discharging to 0V and this won't cut the mustard.

Here's what my circuit would look like for independent rise and fall ramps using a diode (or two): -

enter image description here

The rise slope is determined by the 100k resistor (R2) and the fall by the 5k6 (R1). You can use a transistor of course but what you end up with is the equivalent of a 555 timer with a constant current source (linear ramp): -

enter image description here

Inside the 555 is the discharge transistor you are trying to implement.

  • \$\begingroup\$ Thank you for your reply! But still I have some problems with my circuits, as I wrote in the next post. \$\endgroup\$ Commented Jan 19, 2016 at 14:28
  • \$\begingroup\$ No, that won't work - you need to discharge the capacitor (via R4) by taking it to the negative power rail with the transistor. Collector to R4, emitter to neg-rail, base from the LT1001 and make sure the base is biased correctly so that it can adequately switch on and off the transistor. Also, your LT1001 needs hysteresis components (see R3 and R4 in my 2nd circuit) \$\endgroup\$
    – Andy aka
    Commented Jan 19, 2016 at 14:50

Thank you for your reply! It was enlightening in some way. My schema was modified in this way:

Schema - version 2

Unfortunately, the C2 Discharge is not sufficient to obtain the desired oscillation...


What I get is a small ripple when threshold voltage is reached. I'd like to obtain a complete discharge so V(U1) returns to 0v.


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.