I am trying to convert an input sine wave to a square wave. The sine wave is centered at 2.5V and has an amplitude of 2V, with a frequency of 100kHz.

I am looking for a hysteresis of 100mV centered around 2.5V. (ie. 50mV below and 50mV above 2.5V)

I am trying to achieve something like the following (except that the output is inverted), where both waves are centered about 2.5V:

enter image description here

To do so I looked through Design with Operational Amplifiers and Analog ICs, and I thought that I could work with a VTC offsetting single-supply inverting Schmitt trigger.

enter image description here

I then calculated the resistance values according to my parameters.

VTH = 2.55V
VTL = 2.45V
VCC = 5V

enter image description here

Assuming R3 = 100kΩ and R4 = 2.2kΩ, I calculated R1 and R2 both being 4.1kΩ`.

I proceeded to construct the circuitry on Proteus software using the LM311 comparator.

enter image description here

And here is my output.

enter image description here

Yellow is Channel A, Blue is Channel B. I zoomed in on the square wave can be seen from the dials.

enter image description here

The output is not only attenuated, but also unevenly centered. The book mentions none of these effects, so I suspect that I am missing something more fundamental here. Any suggestions on what I am doing wrong would be appreciated.

  • \$\begingroup\$ You have both scope channels set for AC coupling - that will remove any DC component from the signal, so you won't know where the signal is relative to Ground. The two vertical position sliders have different non-zero settings which will also change the vertical position of the traces. \$\endgroup\$ – Peter Bennett Nov 14 '18 at 17:28
  • \$\begingroup\$ Also you have not said what the input signal level is not have you said whether it is adequately biased at 2.5 volts. \$\endgroup\$ – Andy aka Nov 14 '18 at 17:43
  • \$\begingroup\$ Thanks, updated images of oscilloscope. @Andyaka, input signal level is adequately biased at 2.5V, with an amplitude of 2V. \$\endgroup\$ – rrz0 Nov 14 '18 at 17:45
  • 1
    \$\begingroup\$ LM311 has enormous gain, and large output-stage current surges during transitions. You may have oscillations. Use a Ground plane. Use a very small package, so inductance in the VDD and GND pins are minimal. \$\endgroup\$ – analogsystemsrf Nov 15 '18 at 3:56

You've tied the collector of the NPN output to ground and you are trying to take an output from the emitter - you have this the wrong way round. Tie emitter to ground and use a pull-up on the collector like most folk (who still use this ancient part): -

enter image description here

  • \$\begingroup\$ Many thanks for your answer. This very strangely yields no output on my oscilloscope. I will try other comparators such as the LM397. \$\endgroup\$ – rrz0 Nov 14 '18 at 18:06
  • \$\begingroup\$ I must be using the wrong simulator. Got an output 10 minutes after I started the simulation, which has never happened before. This was it. When connecting the output to pin 1 I immediately got an incorrect output, but when connected to pin, I got an output waveform appearing after 10 minutes. Thanks \$\endgroup\$ – rrz0 Nov 14 '18 at 18:21
  • \$\begingroup\$ Ten minutes is an awfully long time to wait for an output! \$\endgroup\$ – Andy aka Nov 14 '18 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.