Simplist sqaure wave clock circuit. - Page 1
Forum section: electronics / beginners

author: nbritton
author_rank: Frequent Contributor
timestamp: September 20, 2015, 12:14:53 am
content: What is the simplest way (least amount of jellybean components) to implement a square wave generator that goes high when it's input sine wave is positive and goes low when its input sine wave is negative? I want to implement the following function: y = x / ( x + 0^sin(x))Lets assume I have a 50 ~ 100 MHz sine wave output coming in from an signal generator. It seems like you could get this done with one transistor, but I'm not sure what transistor selection I should use for this.

author: John_ITIC
author_rank: Frequent Contributor
timestamp: September 20, 2015, 12:48:05 am
content: How about using an op-amp? GND negative input and feed your sine wave to positive input. When input goes positive, the op-amp goes full-rail positive. Vice-versa for negative. If your sine wave has a non-zero DC offset then set the negative input to the same offset via a resistor voltage divider. Or simply remove the DC offset via a series capacitor. Seems classical...https://www.google.com/?gws_rd=ssl#q=op+amp+comparator+sine+square+wave+

author: Ian.M
author_rank: Super Contributor
timestamp: September 20, 2015, 03:00:08 am
content: @John: jellybean OPAMP at 50 - 100 MHz? ROTFLMAO

author: John_ITIC
author_rank: Frequent Contributor
timestamp: September 20, 2015, 04:21:11 am
content: Quote from: Ian.M on September 20, 2015, 03:00:08 amIs this a problem? Digikey has five pages of them; stocked and starting from $2.http://www.digikey.com/product-search/en?pv658=22&FV=fff40027%2Cfff800dd&k=op-amp&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25Then perhaps the slew rate that causes trouble... Must check...Well, I just picked one that had slew rate of 2000V/us. This is 0.5ns/V. Or about 1.5ns rise time for a 3.3V signal. A 100 MHz signal has a 10ns period so would work.http://www.ti.com/lit/ds/snos823b/snos823b.pdfThe OP did not mention anything about rise time of the square wave so the above solution should work.Disclaimer; I don't normally do much analog design but what I recall from college, this should work. No?Edit: Digikey has even better; these have slew rate of over 3000V/us. Costs about $3 in single-quantity.http://www.digikey.com/product-search/en?pv511=260&pv511=264&FV=fff40027%2Cfff800dd%2Ca480016&k=op-amp&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25]http://www.digikey.com/product-search/en?pv511=260&pv511=264&FV=fff40027%2Cfff800dd%2Ca480016&k=op-amp&mnonly=0&newproducts=0&ColumnSort=0&page=1&stock=1&quantity=0&ptm=0&fid=0&pageSize=25

author: Quarlo Klobrigney
author_rank: Super Contributor
timestamp: September 20, 2015, 05:33:43 am
content: http://www.allsyllabus.com/aj/note/ECE/LINEAR_ICs_and_APPLICATIONS/unit2/Comparator.php#.Vf5EzIIfAmg3. Zero Crossing Detector: [ Sine wave to Square wave converter]

author: John_ITIC
author_rank: Frequent Contributor
timestamp: September 20, 2015, 05:43:28 am
content: Quote from: Quarlo Klobrigney on September 20, 2015, 05:33:43 amYes, this is what I meant. However, what is the reason to use the opamp in inverting mode? What are the bandwidth limitation? I tried to simulate in Multisim but could not get it to work after a little while. My naïve approach was to filter out any DC offset of the input signal via a capacitor, then raise the bias level to some 1V via a voltage divider on both + and - inputs. The idea was to have the opamp hit its rails as the AC input swings around the 1V bias voltage.However, the output doesn't switch properly for higher frequencies. Clearly, I'm missing something but it's been 20 years since basic op-amp training.Edit: It seems the answer is here: OP-AMPs are useless at higher frequencies since it takes too much time to get it out of saturation after having been driven into one of the rails; use a dedicated comparator IC instead:http://electronics.stackexchange.com/questions/84990/how-to-use-op-amps-as-comparator-in-high-frequenciesMy simulations seemed to confirm this; when increasing the input frequency to 10 MHz+ the output didn't switch properly. The duty-cycle became less and less until the output got stuck low. Good use of the evening; something new learned...Edit: More explanations here:http://www.learnabout-electronics.org/Amplifiers/amplifiers62.phpAnyways: it would be interesting to know what the op-amp gurus have to say...

author: Quarlo Klobrigney
author_rank: Super Contributor
timestamp: September 20, 2015, 06:18:02 am
content: Don't know. Does it matter what is the op-amp being simulated? Must be a high speed type in the sim? I don't use simulators for analog. Perhaps one like the CLC430 or others as posted in the previous links. I usually just build it and try. As far as the inverting circuit that's what Google is for as far as determining how to do it on the non-inverting input. I'm like you, haven't designed with op-amps in a while. Being in radio I know that you can clip a sinewave with diodes and have a pseudo-square signal.

author: John_ITIC
author_rank: Frequent Contributor
timestamp: September 20, 2015, 06:23:50 am
content: The problem is that an op-amp is intended for high gain and high slew rate within it's linear operation range and not intended to be driven into its rails. When this is done, it takes much too long to get it out of saturation resulting that it appears 'stuck' at one of its rails. My simulations confirm this. This is independent behavior from slew rate specs. See the below links for details.https://www.google.com/?gws_rd=ssl#q=time+to+pull+op-amp+out+of+saturationI have found dedicated comparators that appears to work up to 150 MHz and more. That could be the solution to the OP's problem.

author: Chris C
author_rank: Frequent Contributor
timestamp: September 20, 2015, 06:34:40 am
content: Quote from: John_ITIC on September 20, 2015, 06:23:50 am+1. The time to get out of saturation is typically the amount of time the op-amp spent at the rail, up to a limit of a few us.You may actually still manage to get a square wave out, but best-case it will be phase shifted 90° from the input. Better to just use the proper part, a comparator.

author: knks
author_rank: Regular Contributor
timestamp: September 29, 2015, 01:07:41 am
content: schmitt trigger?

author: Zero999
author_rank: Super Contributor
timestamp: September 29, 2015, 10:00:21 am
content: Why on earth would you use an op-amp for this?Yes, a Schmitt trigger is much better suited. Try the 74AC14.

author: Flenser
author_rank: Regular Contributor
timestamp: September 30, 2015, 04:01:32 am
content: A comparator, like the LM393, would make a 1-chip solution with no external components.Op Amps are not ideal as comparators. Seehttp://www.analog.com/media/en/technical-documentation/application-notes/AN-849.pdfYou will need to have V+, V- and GND available (but you will need these if you decide you want to use an op amp anyway).

author: knks
author_rank: Regular Contributor
timestamp: September 30, 2015, 05:21:34 am
content: Quote from: Flenser on September 30, 2015, 04:01:32 amAt 100MHZ?

author: RoadRunner
author_rank: Frequent Contributor
timestamp: September 30, 2015, 05:50:37 am
content: just put any high speed Schmitt trigger buffer or inverter on the output.

author: ONETEN
author_rank: Contributor
timestamp: September 30, 2015, 04:08:49 pm
content: FWIW I have done similar in automotive applications using an LM1815 IC which works very well, however the IC has an fmax of 2khz or similar.Is 50-100mhz what you really need or just an example? Cause the solution is much simpler if you are only working with low frequencies.

author: John_ITIC
author_rank: Frequent Contributor
timestamp: September 30, 2015, 08:03:31 pm
content: Quote from: Hero999 on September 29, 2015, 10:00:21 amThis simulates ok in Multisim so should work okay. I simulated with a HC14 up to 100 MHz. One caveat is that you would need to bias the input such that the input signal swings around the middle of the hysteresis curve or else the duty cycle of the output square wave would be something else than 50/50. A resistor divider and AC input cap would do the job.