sinewave to squarewave converter using LM311

Discussion in 'General Electronics Chat' started by sandel, Jul 8, 2010.

  1. sandel

    Thread Starter New Member

    Jul 8, 2010
    Hi everyone,

    Just joined.

    Could anyone suggest how to wire up an LM311 for sinewave to squarewave conversion. The input is a burst signal comprising 5 nos. ~2Vpeak-to-peak, 200KHz sinewaves repeated every 5msecs. I intend to use a single source of 5Vdc.
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    Well, a peak detector, and a zero cross detector can be used to do this.

    Analog to Digital conversion is another. Just about any uC with an ADC onboard will convert your sinewave into a squarewave to be used with TTL logic or DC measurement equivalents of AC signals.
  3. sandel

    Thread Starter New Member

    Jul 8, 2010
    Hi retched,

    Many thanks for the explanatory response. You didn't include the link for the zero crossing circuit.
    I wired up an LM311 but got a lot of noise - is it because I connected the input signal to the inverting input of the comparator. Is it necessary to include feedback (i.e hysteresis) from the output?
    Thought about the ADC - the programming aspect of setting-up the ADC was my excuse not to. Incidentally, I am working with a PIC 12F683 which has an in-built ADC and programming in c using the MPLAB IDE and the CCS c- compiler. I require to input the squarewave to the ucontroller.
    Your suggestions (with relevant links) are appreciated.

  4. Norfindel

    AAC Fanatic!

    Mar 6, 2008
    If the sinewave is AC with no DC, you could compare it against 0v, and obtain an square wave output. You should connect the AC signal to the + input and 0v to the - input, if you want the square wave in the same phase than the input signal.

    About the noise, did you decouple the power supplies to ground?
    If the input signal itself is noisy, you may need to make a schmitt-trigger (hysteresis) comparator.