sloppy sine to square wave

ronv

Joined Nov 12, 2008
3,770
Your getting there. But the signal generator will want to be terminated into 50 ohm - 50 ohms to ground. So you should use the + input for best results. The second stage is still a problem because the op amp as a comparator will go from +15 to -15. When you run it this way it becomes slow. since what you want is a comparator with offset adjust look again at this:
Your waveform may be distorted because the signal generator may be ac coupled and the low termination resistance you used (low) may cause it to "sag" at the low frequency.
If your mind is made up to use the op amp let me know and I'll see what I can come up with for the conversion to a square wave.

PS. Couldn't get the bmp files to open---maybe save as a .png file
 

Attachments

Last edited:

Thread Starter

magnet18

Joined Dec 22, 2010
1,227
Your getting there. But the signal generator will want to be terminated into 50 ohm - 50 ohms to ground.
I'm not entirely sure what you mean by that...

So you should use the + input for best results. The second stage is still a problem because the op amp as a comparator will go from +15 to -15. When you run it this way it becomes slow. since what you want is a comparator with offset adjust look again at this:
The advantage of this being that it has feedback and isn't slamming from power rail to power rail?
that makes sense
If used as a comparator as I currently have it, how "slow" are we talking?

Your waveform may be distorted because the signal generator may be ac coupled and the low termination resistance you used (low) may cause it to "sag" at the low frequency.
it's distorted even unloaded, that's why I need a duty cycle adjustment circuit in there somewhere, to make sure I can get the square wave at the desired duty cycle

If your mind is made up to use the op amp let me know and I'll see what I can come up with for the conversion to a square wave.

PS. Couldn't get the bmp files to open---maybe save as a .png file
The divider chip I use will have a schmidt trigger on the
input, I don't need the op amp to convert it to square, just amplify and set up for adjustable duty cycle, ideally it would still be a sine wave being fed into the chip

(uploaded pngs :))
 

Attachments

ronv

Joined Nov 12, 2008
3,770
The data sheet says 50 ns to recover. So at 10 Mhz. nothing would happen. Well, something would probably happen, but I'm not sure what.:eek: Below that it would probably just look funny.
Looking at the data sheet it recommends 12 volt supplies the schematic still shows 15 volts, but you should use +/-12.
Here is my best shot at a schematic. It looks like from your pictures that with a load both frequencies are around 200 mv peak to peak so I used that. What the circuit does is the first stage has a gain of 5 and the second 10. For a total of 50. So the output should never go above +/- 10 volts. The diodes just clamp the voltage for you logic. One of the remaining drawbacks is that the thresholds for the logic will be around 2.5 volts so you can't adjust the offset to far before the logic won't work. (see waveform) Whereas the comparator only needs a few millivolts so you can put the duty cycle just about anywhere you want to. But maybe this is enough. I didn't have your op amp in spice so I just used a fast one I had.
 

Attachments

Thread Starter

magnet18

Joined Dec 22, 2010
1,227
dahum, just looked at the datasheet again and realized the ad8099 can only go to ±5 for supply, so I'm definitely saturating things with the current circuit

that lt1222 looks pretty darn good though
I have a question, what is the point of c2 in the circuit?
does it help prevent the chip from going into oscillation?

could you please upload that spice file so I can play with it?
(I'd rather not build it from scratch if I don't need to :p)

Thanks!
 

#12

Joined Nov 30, 2010
18,224
I have a question, what is the point of c2 in the circuit?
does it help prevent the chip from going into oscillation?
I thought we had this conversation already. That 1/2 pf in the negative feedback circuit is there because of the parasitic capacitance of the amplifier's input pin. You have to figure that capacitance into your circuit at high frequencies.

R3 (510 ohms) forms a frequency point with the parasitic capacitance. The feedback capacitor changes that frequency point.

Exactly which way and how much exceed my educational level. Fortunately, we have people on this site that can do that sort of thing properly.
 

ronv

Joined Nov 12, 2008
3,770
Yes, C2 & C3 are there for stability. As you can see they are tiny. That is why circuit layout is critical. If your going to change parts Please think again about the comparator. It does the job you want to do. You no what they say. Don't send an op amp to do a comparator's job.:rolleyes:

The LT part runs out of gas around 5 mhz. I think it is the slew rate is to low for the 2nd stage.
Anyway, here is the file. I changed a couple of values to match the lt part.
 

Attachments

Thread Starter

magnet18

Joined Dec 22, 2010
1,227
Thanks!!
and not to sound like a total noob, but whats the practical difference between an opamp and a comparator?
 

ronv

Joined Nov 12, 2008
3,770
The comparator has a huge gain so it turns the sine wave into a square wave with only a few millivolts difference at the inputs. (It compares the inputs) It is made to be a switch so it is built to be overdriven, whereas; the amplifier is made only to make the input bigger but not go all the way to the supply voltage. Much, much better for your application.
 

Attachments

#12

Joined Nov 30, 2010
18,224
Many op-amps "hang" at the rail until internal charges in saturated junctions are discharged. It can slow them down quite a bit compared to a MHz. (Some op-amps are designed not to do this.) If this one hangs, you will probably end up using it just to get a larger amplitude sine wave with variable gain and duty cycle.
 

Thread Starter

magnet18

Joined Dec 22, 2010
1,227
The comparator has a huge gain so it turns the sine wave into a square wave with only a few millivolts difference at the inputs. (It compares the inputs) It is made to be a switch so it is built to be overdriven, whereas; the amplifier is made only to make the input bigger but not go all the way to the supply voltage. Much, much better for your application.
Many op-amps "hang" at the rail until internal charges in saturated junctions are discharged. It can slow them down quite a bit compared to a MHz. (Some op-amps are designed not to do this.) If this one hangs, you will probably end up using it just to get a larger amplitude sine wave with variable gain and duty cycle.
Thanks a lot ronv, your comparator circuit (attached since no screenshot was previously uploaded) looks like it will work for my desired frequencies for getting a square wave

it should feed into my divider chip no problem

now, how do I get a variable amplitude and offset output?
I would say a good range is probably 0-5Vpp, ±5V offset

I think the schematic #12 and I worked out (read as schematic #12 gave me, also attached), still looks good, but what chip should I use?

it needs to be an amplifier, since I want variable gain and offset, (unless I attenuated the output?)

any suggestions?
 

Attachments

#12

Joined Nov 30, 2010
18,224
now, how do I get a variable amplitude and offset output?

I think the schematic #12 and I worked out (read as schematic #12 gave me, also attached), still looks good, but what chip should I use?

any suggestions?
Are you asking about how to make the comparator do variable gain and offset? I don't think you can do that. You would use the op-amp circuit, then feed that output to the comparator.

I hope I haven't lost track of how this is progressing, considering I am too lazy to read the whole thread unless you catch me making a mistake.:rolleyes:
 

Thread Starter

magnet18

Joined Dec 22, 2010
1,227
no, i don't need the comparator to do variable gain and offset directly
I have the comparator to feed into my division chip, now how do i get the output of a 5volt 74hc series chip into variable amplitude variable offest?

the shcematic from before works theoretically, but I don't think i can find an opamp with -15 to +15 volt output that works for a 10MHz square wave (huge slew rate)

I might try to come up with something discreet, resistors and potentiometers
I just hate discreet stuff :p

edit, i guess the opamp only needs to go +- 10 on the output amplitude, but I also want +- 5volt offset
 
Top