# Newbie question - sawtooth signal generation - capacitor discharge via bjt

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.

• @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. Commented Jan 19, 2016 at 14:07
• @Andyaka rollback if you don't agree, I included an NAA, sorry if I went wrong. Commented Jan 19, 2016 at 14:10
• 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. Commented Jan 19, 2016 at 14:11
• I undeleted the reply that I posted some minutes ago. Commented Jan 19, 2016 at 14:30

Consider this circuit for a minute: -

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): -

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): -

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

• Thank you for your reply! But still I have some problems with my circuits, as I wrote in the next post. Commented Jan 19, 2016 at 14:28
• 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) 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:

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.