Hi,
I'm trying to find the simplest way to convert the signal shown by the blue trace into a square wave while preserving the pulse width "exactly".
The output should go high on the positive edge of the signal and return low on the negative edge, so the pulse width always matches the time between these two edges.
The pulses width is variable, therefore the circuit must accurately track it.
What is the simplest way to achieve this?
Hi,
I like solutions that are guaranteed to work with no question about it. Here is one that will work along with some notes.
First, I would not use any series capacitors to develop a new signal to work with. That makes up a high pass filter/differentiator that is subject to noise interference from unknown sources.
Second, I would not use any parallel capacitors except as a low pass filter tuned to pass the required frequencies and reject the higher ones. A slight amount of input filtering adds reliability, but it can not be too much or it might reject some of the input pulses. I am not sure if you specified the min and max pulse times and required resulting pulse widths but that would be good to know in order to design the front end correctly.
Third, this can be done with one LM339 and some resistors, and that one capacitor on the front end to reject higher frequency noise.
That IC has four independent comparators that are open collector so you can set the output voltage easily. There may also be a solution with one of the two comparator versions.
The idea with the LM339 is to form a SET/RESET latch with two sections of the IC, then use the other two to detect the high going input pulse and the low going input pulse.
The reason I suggest this is so that you can set the detect voltages to ANY value, provided they are within the range of the allowed input voltages for the LM339. This would mean the detect part would need 4 resistors if you want to make adjustment really simple, or 3 resistors if you don't mind a little more complicated adjustment.
The Latch part would require 2 more resistors in order to make two digital inverting amplifiers which when cross coupled forms a set/reset latch.
I'm sure anyone can draw this circuit up in a minute or two.
The advantages are:
1. Easy to adjust input detect levels if needed.
2. Easy to filter out unwanted noise.
3. The technology and circuit have no mysterious sections and is well known.
4. Output voltage is independent of the input pulse voltages.
5. Operation is definitive and repeatable.
There is one assumption here: the input pulses are all ABOVE ground. If one actually goes negative, we may have to add a diode clamp (like 1N4148).
It would help a lot to completely specify the input pulses and how they might change, in detail. That means min/max voltage levels for both high and low going pulses, and min and max input pulse widths at say the 50 percent voltage levels for each pulse, and the min and max times of the output pulse. The pulse min time will be more important, the max time could probably be infinite because the circuit will be DC coupled throughout.
Basic operation is very simple...
The input pulse goes high and flips the latch to digital state 1 with voltage at the output logic high state. The input pulse goes back to nominal and nothing happens. The input pulse goes below nominal and the other comparator detects it and flips the latch output state to a logic low state. It's that simple and that is partly why it is guaranteed to work
The simplification, that should come later, is to use just two comparator sections as a latch and try to get the input pulses to control that directly. It is best not to use any series capacitors to couple the signal into the latch inputs though, a DC coupled circuit is much more preferred.