I have a 4.43MHz sinusoidal output from an IC that I want to convert to a TTL square wave to use as a clock. The signal has a DC offset of around 2.5V and has an amplitude of about 0.5V peak to peak.

I attempted to convert this to a 0-5V square wave using a TLV3501 high speed comparator with this circuit.

tlv3501 updated schematic

The comparator appears to work as expected: with RV1 at one extreme the output at SQ_OUT is 0V, at the other it is 5V, at a point roughly in the middle I see a waveform. However it has a DC offset and doesn't look much like a square wave.

not square

(Above is 0.5V / div and has a DC offset of nearly 2V).

The datasheet shows a square wave generated from a 50MHz signal so obviously I am doing something wrong. I am using a breadboard but the IC is on an adapter with C1 and C2 soldered to the pins. I also tried disconnecting SQ_OUT from the breadboard and measuring the output at the pin, but saw the same result. How can I get a 0-5V square wave?


Following the suggestions here I fed the comparator with signals ranging from 500hz to 20000hz and offset by 2.5VDC. I mostly observed the same result: with RV1 at one extreme, a 5V flatline, at the other, 0V, and in between a waveform of about .5Vp/p and offset at around 2.5V (the offset varied depending on RV1).


The closest I ever got to expected output had flat peaks at 5V but still not swinging between 0 and 5V.


This would seem to rule out scope issues, so it must be either the electrical environment (I'm using a breadboard) or else I've wired it wrong (which I doubt, but I will certainly be triple and quadruple checking). Or possibly a dud chip, which also seems unlikely.

I'm wondering if these issues could be a factor:

  • I'm using a breadboard (SQ_OUT is not connected to the breadboard though).
  • There is no load connected, except for the scope probe. Previously when I was feeding 4.43MHz there was a load connected (clock input on an AD724).
  • Could RV1 which is a 20K voltage divider be too much resistance?

Edit 2

I believe my problems were caused by a noisy power supply (5V unfiltered USB), and exacerbated by stray capacitance from the breadboard. With the USB supply the comparator seemed to have 3 states: flatlining at 0V, flatlining at 5V, or the voltage at the input. This was the case even without any signal, just 2.5VDC. I'm guessing the "middle state" was high frequency oscillation. I managed to get the expected output by powering the circuit from a battery and got best results when I removed it completely from the breadboard. Only then did I get only 0V or 5V flat lines with no "middle state". On the breadboard and supplying a 1000hz signal, I see a 0-5V square wave with some zigs and zags around 2.5V, showing that the output is not a clean. I guess if I want to continue with this device I'll have to put it on its own board and filter the power supply. Thanks to everyone who contributed.

Rough square

  • \$\begingroup\$ The waveform looks like that the comparator is not fast enough for your load. Is there any load capacitance on the output? why not use a capacitor (0.1uF or so) at the input and block the DC of sine input? That should make the input varying with O DC and then have an appropriate reference voltage? \$\endgroup\$
    – rsg1710
    Commented Nov 5, 2017 at 18:25
  • \$\begingroup\$ Is SQ_OUT floating or is there a load at the end during measurement? \$\endgroup\$
    – Mast
    Commented Nov 7, 2017 at 9:33
  • \$\begingroup\$ There is no load, SQ_OUT is connected only to the scope probe. @rsg1710, the comparator is rated at 4.5ns, it should certainly be fast enough. \$\endgroup\$
    – Batperson
    Commented Nov 7, 2017 at 21:38
  • 1
    \$\begingroup\$ Is your oscilloscope an analog or digital (sampling) type? If it's analog, the 10 MHz rating is typically at the instrument's -3dB bandwidth. For a 4.43 MHz input signal, a 10 MHz analog scope will likely compress the signal's amplitude, and will cause some rounding off at the signal's rising and falling edges. Note that if the square wave input signal has a rise time of, say, 10 ns, that rise time corresponds to a frequency (bandwidth) of around 35 MHz, which is well beyond the scope's 10 MHz frequency response, and therefore the scope will distort the signal's rising and falling edges. \$\endgroup\$ Commented Nov 8, 2017 at 2:12
  • 3
    \$\begingroup\$ Bread boards are notorious for stray capacitance. High speed comparators are very sensitive to stray capacitance. Try building the prototype dead bug style. Solder components and wires directly to the pins. Keep the output away from the input. Also check out the output sine wave with respect to the input sine wave. Verify that the output isn't just oscillating. \$\endgroup\$
    – user125718
    Commented Nov 8, 2017 at 14:09

6 Answers 6


A 10 MHz scope rise time should be 0.35 * 1000 / 10 = 35 nS.

Half cycle time at 4.43 MHz is 500 / 4.43 = 113 nS which is over 3 times the scope rise time showing the scope should be adequate for displaying the full excursion of the output signal. However the scope trace provided looks CR / rise-time limited in excess of this. Therefore the first thing to look at is output loading and as the LM393 data sheet shows a parameter for Output Sink Current I would suggest in the first instance you try a 4.7k pull up resistor between +5 volt and SQ_OUT. When working correctly outputting a clean square wave I would expect the scope output waveform to be similar to the bottom one simulated by JonRB - due to the scope bandwidth limit - although the voltage scales will differ. Whilst scope probe tuning is important for digital work - I believe it to be a red herring in this instance.


@Batperson in your comment following ovirt's answer you stated that you had substituted a LM393 which has an open collector output, hence the pullup suggestion. However this is a trivial circuit and shouldn't be difficult to nail. First a word of advice. When there are problems and you find yourself answering 'should' rather than 'does' - you need to check as there is an element of doubt. There is often a big difference between should and what is actually happening. e.g. this circuit SHOULD be producing a square-wave output.

What you describe does not make sense. You have a 0.5 Vp-p input signal that biased at +2.5V to ground connected to the comparator input and you are shifting the comparator ref between gnd and +5V. Once the reference voltage exceeds the oscillator bias plus about 0.25V the output should flatline near gnd. Conversely once the ref drops below the bias minus about 0.25V it should flatline near +5V. e.g. the output should flatline whenever the ref is outside of the input signal range. After you investigate this hang an 0.1uF ceramic C between ref and ground close to the IC pins and try again. Next replace the oscillator input with two 10k R's in series and connect between gnd and +5V the comparator input connected to the mid point. Look for the output changing between flatline +5V and gnd as the ref passes through the mid point. You have just proved/disproved the comparator functioning at DC.


@Batperson having though about some more I realise your scope traces do not make sense. The only way (other than -ve feedback) the circuit shown can have an output bias near mid point is for the output to be spending equal time at +5V and gnd (The resulting level being the average). This is not evident in your scope pictures 1 & 2 - it looks more what the input should be - almost as if the ground IC gnd was not connected. The tests I suggested yesterday should help to resolve this. It would be helpful if you titled pictures 2 & 3 with voltage reference points and scale or frequency as it is not clear from your text. Also maybe a picture of your breadboard.

  • \$\begingroup\$ if you note my reply, scope leads (frequency or compensation). the leads supplied with a 10MHz scope will be suitable upto 10MHz. What you will then have is two 1st order 10MHz filters cascaded. Let me update my reply to overlay the impact of the two filters \$\endgroup\$
    – user16222
    Commented Nov 7, 2017 at 23:20
  • \$\begingroup\$ Thanks @JonRB and Venustas. I'm pretty sure now after testing with a .5-20 kHz signals it is not the scope (also the probe is tuned and displays a perfect square wave using the scope's test signal which IIRC is 10kHz). The part is a TLV3501 with a push-pull output so shouldn't need a pullup? I confused everybody by doing a quick schematic with an LM393 Eagle lib but it is corrected now. \$\endgroup\$
    – Batperson
    Commented Nov 7, 2017 at 23:43

It will be one of two things & more than likely both:

  1. The probe you are using is not suitable, be it in frequency or in its compensation (the little screw on the side of the probe).

    Enter link description here

  2. A 10 MHz scope is too slow for a 4.5 MHz signal

Here is the buildup of a squarewave up to the 100th harmonic (4.43 MHz fund):

enter image description here

import numpy as np
from matplotlib import pylab
F= 4.43e6
t = np.arange(0, 2/F, 1e-12)
x = np.sin(2*np.pi*F*t) 
pylab.title('Sinewave of increasing frequency: Fourier content of a squarewave')

for i in range(3,100,2):
    a = (1/i)*np.sin(2*np.pi*F*i*t)
    x +=a

pylab.title('Equivelent squarewave for summation of its harmonics')

y= np.zeros(len(t))

A= 10e6*2*np.pi*t[1]/(10e6*2*np.pi*t[1]+1)
for i in range(1,len(t)):
    y[i] = y[i-1] + A*(x[i] - y[i-1])
pylab.plot(t,y,label='4.43MHz through 1 filter')
x = y
y= np.zeros(len(t))
A= 10e6*2*np.pi*t[1]/(10e6*2*np.pi*t[1]+1)
for i in range(1,len(t)):
    y[i] = y[i-1] + A*(x[i] - y[i-1])
pylab.plot(t,y,label='4.43MHz through 2 cascaded filters')

pylab.title('Result of passing a 4.43MHz squarewave through 1 & two 10MHz 1st order filters')


If the acquisition is only capable of 10 MHz, the contributors will be attenuated and phase shifted producing a distorted waveform similar to the one you are seeing.

Cascading two 10MHz "filters" (one in the probe, one on the input of the scope) will further distort the waveform resulting in a signal closer to that seen on the scope.

The mean of a 0-5V squarewave is 2.5V. if your scope as an "average input" it will also produce a similar waveform and tend towards 2.5V. I have been caught out a number of times looking at PWM only to see a very strange walking waveform ONLY to find someone messed with my scope and had enable "16sample averaging"

enter image description here

  • \$\begingroup\$ Thanks, the compensation should be correct but I will check again. I did wonder whether scope artefacts could be involved, so I made sure to include "10MHz Handy Oscilloscope" in the photo :-) However, it is mainly the apparent 2V DC offset I am concerned about. Could that be a scope artefact too? \$\endgroup\$
    – Batperson
    Commented Nov 5, 2017 at 18:21
  • \$\begingroup\$ The DC offset is a bit dubious. Testing at a much lower frequency where the scope works well should clear up doubt... \$\endgroup\$
    – bobflux
    Commented Nov 5, 2017 at 19:28
  • 3
    \$\begingroup\$ @Batperson an 0-5V square wave has an average DC component of 2.5V, so there's absolutely nothing wrong there. Insufficient frequency response will raise the (apparent) troughs just as much as it lowers the (apparent) peaks. \$\endgroup\$
    – hobbs
    Commented Nov 5, 2017 at 19:36
  • \$\begingroup\$ exactly, the example signal I have is a +-1V signal, the comparator with be a 0-5V signal. \$\endgroup\$
    – user16222
    Commented Nov 5, 2017 at 19:39
  • \$\begingroup\$ The manual for my scope says nothing about averaging, it certainly doesn't have it as a feature that can be enabled. This is all useful information for me to know though. \$\endgroup\$
    – Batperson
    Commented Nov 8, 2017 at 2:16

You should realize that a 4.43 MHz square wave has a much larger bandwidth than 10 MHz.

A "proper" 4.43 MHz square wave will contain frequencies up to and beyond 50 MHz. That is because a square wave is made up of a whole sum of frequencies (as opposed to a sinewave which is only one frequency, this is why EEs use it a lot).

If you had an ideal 4.43 MHz square wave but looked at it through a 10 MHz bandwidth system (like your scope) then you'd see a distorted triangle wave. Which is what you see here.

Try again but at a 10x lower frequency (or even 100 x lower) and see what you get.

  • \$\begingroup\$ I will try to test it using a lower frequency signal. Mainly I want to confirm that the output is actually swinging between 0 and 5V at 4.43MHz (and not 2 and 2.5V). Is there any way to confirm that using my limited equipment? \$\endgroup\$
    – Batperson
    Commented Nov 5, 2017 at 18:31
  • \$\begingroup\$ At a lower frequency you can check that easily, then if the load at the opamp's output is low enough (small capacitance) you can assume it is also OK at 4.33 MHz. To check that for real you would not only need a scope with about 200 MHz bandwidth but also a suitable 10:1 probe because of the low input capacitance. \$\endgroup\$ Commented Nov 5, 2017 at 18:35
  • 1
    \$\begingroup\$ @batperson, perhaps in your bat-cave you have some 1n4148 diodes and ceramic capacitors, you could build a peak detector. \$\endgroup\$ Commented Nov 6, 2017 at 8:56

Other answers have covered the bandwidth considerations of your scope, etc.

You say that you're using the TLV3501 device but your schematic circuit does not match the pin configurations shown in the TI datasheet TLV3501, TLV3502 - e.g. the output should be on pin 6 or pin 5 depending on the package (SOIC or SOT-23).

Neither does your schematic show a connection to the "shutdown" pin which should be connected to the negative supply - "GND" in this case.

If the information supplied in your question is accurate then it would appear that the device is not connected correctly (unless you have managed to find the device in a package not listed in the linked datasheet).

  • 1
    \$\begingroup\$ I should have obscured the pin numbers on the schematic, they are not accurate. I substituted a LM393 part in the schematic as I didn't have one for the TLV3501. The device is connected correctly including the shutdown pin, and the circuit is behaving as expected just not at 4.43MHz. \$\endgroup\$
    – Batperson
    Commented Nov 5, 2017 at 18:17
  • \$\begingroup\$ @Batperson - Sigh. So you used a different part, and it doesn't work as you expect. Please read Transistor's answer. \$\endgroup\$ Commented Nov 5, 2017 at 20:48
  • 1
    \$\begingroup\$ @WhatRoughBeast S/he substituted a different part when drawing the schematic, because the schematic builder didn't have the part s/he was actually using and didn't have a generic part. \$\endgroup\$ Commented Nov 5, 2017 at 23:23
  • \$\begingroup\$ Looks like I created confusion by doing so, my bad. The schematic has been corrected. \$\endgroup\$
    – Batperson
    Commented Nov 5, 2017 at 23:34
  • \$\begingroup\$ @Batperson Ok, thanks for doing that. I'll comment here since I don't yet have sufficient rep to do it on other answers. If the scope (and probe) genuinely has 10MHz bandwidth, then the fundamental 4.43MHz should only be minimally attenuated. What display does the scope give if you look at the source signal? In any case the display that you've shown for the output (assuming that the circuit is working) suggests that your measurement train is BW limited to much less than 10MHz. The offset is consistent with that scenario - i.e. offset at half the output swing. \$\endgroup\$
    – ovirt
    Commented Nov 6, 2017 at 2:27

As others have pointed out is is likely due to your oscilloscope only being rated for 10MHz. I wanted to explain why that is an issue in simpler, less theoretical terms.

The 10MHz rating means that it can display a 10MHz sine wave with minimal attenuation and distortion. Frequency ratings are always given for sine waves, not square waves.

To understand why a square wave requires much more bandwidth to display, you have to understand that frequency is determined by rate of change over time. So actually a square wave is very low frequency (close to DC or zero) on the flat parts, and then suddenly very high frequency when it transitions from high to low or low to high.

If you look at the datasheet for the comparator it will give the slew rate. That is the maximum rate of change of its output. It will also depend on your circuit, but for the sake of this example let's say it is 1ns/V. The output will swing over 5V, taking 5ns. So the frequency of the transition part of the square wave will be 1/5ns, or 200MHz. Since your scope is only 10MHz, it will display something like the waveform you are seeing, unable to swing up and down as fast as the square wave.


A 10 MHz bandwidth would round off your signal so it looks more like a sinewave than a squarewave and would likely also cause some attenuation but it does not explain why your signal is 10 times smaller than it should be.

One possible cause of such behaviour would be having a scope configured for an X1 probe but actually using an X10 probe but that would also affect the DC offset level which you seem to be saying is roughly correct.

So I conclude that your system must have a bandwidth of considerablly less than the 10MHz printed on your scope. So either your scope is made by a manufactuerer that lies (I don't recognise the brand), your probe setup is not suitable for high frequencies or there is something wrong with ythe circuit under test.

  • \$\begingroup\$ It's not 10 times smaller than it should be, I'm expecting peaks of 5V and seeing around 2.5V. I don't think my scope is configurable for the probe (it is budget as I've said) and the probe is set for X1. But the consensus appears to be that the circuit is actually working and what I'm seeing is due to the limitations of my scope (or its configuration). Once I have an opportunity I will try to confirm that using the suggestions that people have put forward here. \$\endgroup\$
    – Batperson
    Commented Nov 6, 2017 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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