convert sin wave (withe dc level) to square wave ?

Thread Starter

pro111

Joined Mar 2, 2007
2
hello all.

i need to convert sin waveform with 30Vp-p (ride on DC level of 5V)
to square wave beetween 0V-5v.

how i execute this ?

thank's :)
 

Papabravo

Joined Feb 24, 2006
21,159
What is the frequency of interest in this signal? If it is too high, ordinary opamps won't be much help.

AC couple to remove DC offset.
Use a diode limiter to create a 5V Peak to Peak quasi-squarewave
Add 2.5 VDC offset to get 0-5V quasi-squarewave

This won't be a true square wave in the sense that the rising and falling edges will be sine functions, but the tops and bottoms will be pretty flat. Maybe that's good enough for your purposes.
 

hgmjr

Joined Jan 28, 2005
9,027
You could also use a circuit with a logic gate to square up your sine wave.

Here is a link to a self-powered version of a sine-wave to square-wave converter circuit. You will need a voltage divider to decrease your 30 volt sine-wave down to a 5 volt peak to peak signal level. It is ac coupled so the dc offset will not cause any problem. You can forego the self-powering feature if you have a 5 volt power source.

hgmjr
 

Papabravo

Joined Feb 24, 2006
21,159
I guess a comparator, such as an LM393 or LM339, with an open collector output would also work. Just make sure you select a reference within the common mode range.
 

hgmjr

Joined Jan 28, 2005
9,027
Depending on the speed of the input sinewave, another possible solution could use an opto-coupler with one side of the input biased to a dc level at or near the 5V offset.

hgmjr
 

Thread Starter

pro111

Joined Mar 2, 2007
2
If i want to use comprator (like lm311), why it depend in frequency waveform ?
and how i can know what is the max frequency for this comperator (i mean, which paramter indicate this value)


thanks :)
 

hgmjr

Joined Jan 28, 2005
9,027
In the National Semiconductor datasheet, the graph of output response time versus input overdrive for the configuration that ties the emitter to ground with a 500 ohm pull-up resistor is a good guide to the LM311's output switching speed.

The output with the input overdriven can slew 5 volts in approximately 200 nanoseconds. If you double that and then allow another 100 nanoseconds per half cycle the total time would be around 600 nanoseconds. That equates to 1.6 MHz. This figure is an upper end frequency since there are a number of real-world factors to consider.

The capacitance of the load on the output of the comparator will reduce the switching frequency further. A buffer stage can be added to help if the load capacitance is excessive.

Hope this helps somewhat.

hgmjr
 
Top