# Triangular waveform to square waveform circuit

I am working on a frequency counter project and I am in the midst of thinking about how to go about doing a triangular wave to square wave converter. I have done some research but couldn't find any circuit diagram that could help. It was mostly just triangular wave to sine wave. I would appreciate if anyone could help. Thanks.

• So I'm guessing the triangle-to-sine converter circuits you found were probably all integrators? What do you think you'd get if you fed a triangle into a differentiator? Apr 3, 2019 at 11:51
• Or a comparator? Apr 3, 2019 at 11:53
• The right answer depends a bit on whether you need it to work over a wide range of amplitudes and/or frequencies, and whether the triangle wave has noise on it that has to be rejected. Apr 3, 2019 at 12:36
• Differentiate it.
– Chu
Apr 3, 2019 at 18:20

A comparator is used to produce square waves: simulate this circuit – Schematic created using CircuitLab

At high frequencies ($$\ > \frac{1}{2\pi R C}\$$), the R-C filter passes only the DC offset of the input signal, and the output switches at the zero-crossings relative to this level.

At low frequencies, the R-C filter simply produces a time lag and the output switches based on the slope of the input signal.

Something like the following would work, change the ratio of r2 to r3 to change the duty cycle simulate this circuit – Schematic created using CircuitLab

The LM393 is a comparator, when the signal at the + input is greater the signal at the - input the output is pulled high via R1, when the signal at - is greater than the signal at + the output is driven low. The potential divider R2 and R3 defines the set point at which the transition from high to low happens.