# How to trigger a pulse until a capacitor fully discharges based on the output of a comparator

In my circuit I have a comparator which compares the output of a sine wave with a staircase wave, if the staircase is above the sine wave, I wish to use a Mosfet in its cut off mode which will allow the capacitor to full discharge. I have hooked up the output of the comparator to the gate of the Mosfet as shown. My problem is that the output of the comparator switches back to low almost immediately as the staircase function drops below the sine wave. I was wondering if there was a way to generate a pulse which stays put until the capacitor is 0, or a fixed period of time.

Edit: I am unable to use digital components.

• Do you realize that according to theory, a capacitor never fully discharges. As it has less and less charge, the discharge rate becomes lower. It's exponential towards the equilibrium which is 0. It never reaches 0. (Ok, you could argue that when it has less than one electron of charge, it's discharged.) – juhist Apr 27 '18 at 19:35
• @juhist: You are being needlessly pedantic. Besides which, your statement only applies to discharging through a resistance. There are other ways to discharge a capacitor. – Dave Tweed Apr 27 '18 at 19:41

This whole series of questions ( A B C ) is getting a bit tiresome, because you've never explained exactly what it is you're trying to accomplish, but I'll try to answer this specific one.

If one full cycle of your V3 source would be enough time to discharge the capacitor, you could simply add a flipflop to the output of your comparator:

simulate this circuit – Schematic created using CircuitLab

If you need a slightly longer pulse, add a couple more FFs:

simulate this circuit

An alternative approach would be to use two comparators and a S-R latch, in much the same way that a 555 does internally.

• Thank you for answering, I apologise for any vagueness I tried to explain to the best of my ability english is not my first language. I should have said this but this is for a analogue assignment so I cannot use digital components which is why I did not use a flipflop. Is there anyway to achieve this using only analogue components? – JohnDoe Apr 27 '18 at 19:30
• Define "digital" and "analog" in this context. The output of any comparator is by definition a digital (binary) signal. The function you are asking for is necessarily nonlinear and time-varying. What are your actual constraints? Even if you don't use integrated FFs, you will have to build the equivalent circuit using discrete parts. Where do you draw the line? – Dave Tweed Apr 27 '18 at 19:39
• My constraints are quite vague, I was only told I cannot use an and gate from which I assume I cannot use the flipflop as well, but constructing the flip flops from transistors etc is a good idea and I will attempt that. – JohnDoe Apr 27 '18 at 19:48

There was another circuit very much like this one. I suggested to change the comparator into a Schmidt-Trigger. With careful selected components you can set the voltage at which it triggers, but also the voltage (much lower) at which it goes 'back'.

That may be enough.

However the owner of the other circuit (Which was a lot more complex than this one) complained that it still did not work. I suspect that the gate voltage was not sufficient to get a low enough resistance of the FET as the voltage across the capacitor/FET changes a lot when you discharge it.

I could put your circuit in LT spice but it very late here now.

You should be aware that there is more than one way to skin a cat. But first you need to be careful of what you're calling a cat.

You state that "this is for a analogue assignment so I cannot use digital components". Well, strictly speaking you've already violated that by using a comparator. Since those are allowed, you can easily produce a fixed-width pulse using an RC network and another comparator.

simulate this circuit – Schematic created using CircuitLab

In this case, when the first comparator goes high, it quickly charges up C2, and the second comparator will also go high. This will cause the first to go low, but the second will stay high until the cap is sufficiently discharged through R1. This will (nominally) give you a fixed reset pulse width.

But be aware that you can get weirdnesses if the first comparator retriggers while the second is still high, and you need to look closely at how this will work.