# Help Comparator circuit

I would like to design a comparator circuit with hysteresis, which will provide a PWM signal in the output as shown in figure 2. The first input of the comparator circuit will be a sinusoidal signal as shown below in figure 1 and the other input of the comparator fed by a triangular waveform. Is there any circuit which is suitable for this comparator circuit and for this purpose?

The power supply voltage is VDD=1.2V.

Which should be the DC level and the amplitude of the triangular waveform to achieve this purpose?

figure 1 figure 2 • (1) It's a little unclear what you are trying to do. Normally a DC voltage would be used as a PWM control signal and the comparitor compare that with the triangle waveform. Are you trying to generated a PWM encoded version of a sinusoidal signal? (2) Why are you working with such a low supply voltage? If you explain your application (in the question rather than in the comments) you will probably get more relevant answers. – Transistor Sep 16 '17 at 12:13
• Sounds like he is looking for some sort of zero crossing detector and ramp to use to trigger an SCR .. but who knows. – Trevor_G Sep 16 '17 at 12:42
• See if there is a LM555 circuit that would do what you want? Use google image search and look at waveform pictures for something interesting. – KalleMP Sep 22 '17 at 21:03

Is the offset of your triangular waveform at the same Level as your sinusoidal waveform? If so, you could use a single comparator circuit with a open drain Output stage, and an external resistor as pullup to 5V. Then the ouput will toggle between nearly 0V and 5V. Here is a basic circuit for a PWM modulator. R1 and R2 halve the supply voltage to provide a 'virtual earth' reference for the op amps. OA1 and OA2 generate a triangle wave. Amplitude is controlled by the ratio of R3 to R4. C2 and R5 determine the frequency.

OA3 compares the level of the triangle wave to the modulating signal. R7 and R8 produce a small amount of positive feedback, creating hysteresis which ensures that the PWM output 'snaps' from one rail to the other.

Your sine wave has relatively small amplitude and a large DC offset which would be difficult to null out in a DC coupled circuit, so I AC coupled it through C3 and referenced it to the virtual earth with R6. simulate this circuit – Schematic created using CircuitLab

To avoid clipping the triangle wave peaks need to extend beyond the peaks of the modulating waveform. AC coupling the modulation ensures that the midpoints align, so you just have to make the triangle wave's amplitude larger than the modulation.

• Thank you so much mr Bruce Abbott for your response. But this circuit looks like a very complicated system and I can't understand how does it work. There is no other way to create a PWM signal? – vl123 Sep 18 '17 at 10:01
• Time to learn! This the standard method using 3 op amps. There are other ways that might be simpler (eg. 555 timer) but most will not work on a 1.2V supply or provide sufficient modulation depth with a weak signal. – Bruce Abbott Sep 18 '17 at 17:25