Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Square Wave Frequency Doubler using Op-Amps

  1. Mar 9, 2009 #1
    Hello All,

    Here is my challenge. I have an idea to build a square wave frequency doubler circuit using nothing but op-amps. The idea is to make a circuit that can exactly double the frequency of a 50% duty cycle square wave input of variable frequency, and produce a 50% duty square wave of twice the input frequency.

    I want to do this without using some of the more common approaches like delay lines and HF clock division stuff. Here is my thought: I know that if the input waveform was a triangle wave that I could use a comparator to detect when the voltage is 1/2 VMax and trigger a waveform from that set point. I am thinking that If I can have the circuit produce a triange wave from the variable input square wave that I can use that as reference to create the doubled-frequency square wave. But the challenge is how to make the slope of the triangle wave match the hi and low times of the input square wave?

    I know that op-amps were commonly used to do math calculations back in the day, so I'm trying to come up with a cricuit that can 'calculate' and generate an appropriate slew rate to match the input square wave's period. My initial thought is to use an op-amp integrator to create the linear ramp, but I need some way to dynamically adjust the R and C value to change the slope rate. So if I could have, say one (or both) components emulated with other op-amps, perhaps I could dynamically control the slew rate in response to changes in the input square wave's frequency.

    However, I haven't taken any classes on feedback so this, at the moment, seems like a nightmare to even determine how to start doing this. Anyone have any thoughts on this?

    Thanks,
    Jason O
     
  2. jcsd
  3. Mar 9, 2009 #2

    berkeman

    User Avatar

    Staff: Mentor

    Sounds like fun, Jason. Don't want to use the PLL approach either, I guess?

    I don't think you have to worry about matching the slew rates to anything. Just be sure that the slew rates are low enough so that you don't run your circuit out of voltage compliance before the triangle wave turns around.

    I'd do something to center up the tri wave (like with a low-frequency bleed path to keep the tri centered around ground or whatever you want your center reference voltage to be), and then all you need to do is a zero-crossing detection (or reference-crossing detection, if you're doing it all with a single-ended power supply). The peak amplitude of the tri doesn't matter, I don't think.
     
  4. Mar 9, 2009 #3

    berkeman

    User Avatar

    Staff: Mentor

    BTW, Quiz Question -- To get the most accurate zero-crossing detection point, and still have hysteresis on that detection (so it doesn't buzz), you will need to do something special with the positive feedback on that comparator circuit. Can you think of what it will be?
     
  5. Mar 9, 2009 #4

    Averagesupernova

    User Avatar
    Science Advisor
    Gold Member

    Not related to Berkemans question, but I have one clue for you. Absolute value circuit.
     
  6. Mar 9, 2009 #5
    Hi Berkeman,

    You make a good point about the slew rate thing. My only concern with that approach is that the signal amplitude might get very low at higher frequencies and I'm trying to see how wide a bandwidth I could get out of a setup like this. The idea I have is to make it independent of RC constants so that everything is dynamically balanced using the Op-amps (believe it or not, this was a thought experiment I was mulling over :redface:). I wonder if there is a way to dynamically adjust the triangle wave so that it is constant and can go as fast as the limitations of the op-amps in the circuit?

    As for your quiz question, I honestly have no idea what I would do (my first thought was hysteresis but you said that already). Could it be something with a Diode maybe to stop ringing?

    Thanks,
    Jason O
     
  7. Mar 9, 2009 #6
    Hi Averagesupernova,

    I did look that up and found an interesting PDF file showing some interesting circuits for an absolute value circuit here: http://focus.ti.com.cn/cn/lit/an/sboa068/sboa068.pdf

    The only trouble is that it 'looks' like that would only work with sine waves and not square waves. Is there something I'm missing here?

    - Jason O
     
  8. Mar 9, 2009 #7

    Averagesupernova

    User Avatar
    Science Advisor
    Gold Member

    Convert incoming square to triange, I'm pretty sure you know how. I can understand why it wouldn't be so good for your application with square waves. Do you know why? I don't want to give you too many hints ya know. :)
     
  9. Mar 9, 2009 #8
    Well, I'm actually stuck at the creating of the triangle wave. I know that I can use a simple Op-amp integrator circuit but I'm trying to figure out a way to make the circuit frequency independent, as in no fixed RC value that only gives a fixed bandwidth. I suppose this is really the essence of what I want to figure out since the rest is pie once I convert the square waves into triangle ones.

    Ultimately, I want to generate a triangle wave that won't be attenuated as the input frequency is increased, which I know will happen if using a simple integrator circuit with fixed RC values. I remember seeing a circuit using an op-amp that simulated a capacitor so I'm wondering if I could use that somehow to have the range change dynamically with the input frequency. If I can pull this off, then I can make an analog circuit that has a bandwidth approaching that of the op-amps themselves.

    - Jason O
     
  10. Mar 9, 2009 #9

    Averagesupernova

    User Avatar
    Science Advisor
    Gold Member

    It's a bit of a tall order to build a frequency doubler that will work over the range of the the op-amp itself. You need to pick some numbers first. Decide what kind of bandwidth you want.
    -
    My original thinking was to convert to a triangle wave and then active full wave rectify with the absolute value circuit. Then, run that into a schmitt trigger to get the square wave back. As long as the triangle wave doesn't run out of head room (too low of an input frequency) and the the input frequency doesn't get too high (end up with a triangle wave too small to drive the schmitt trigger) it should work.
    -
    Now, how to convert from square to triangle: Nothing to it. I'll assume the input has no DC offset. You will need a split supply to run the op-amp with this. Ground the non-inverting input of the op-amp. Use a capacitor from the output to the inverting input. Then, run the square wave into the inverting input through a resistor. You pick the values of R and C based on the slope of the ramp in your triangle. If you use an op-amp that can tolerate 15 volt supplies you should be able to get a triange wave up to 25 volts peak to peak. Most op-amps that tolerate this high of a supply voltage do not have rail to rail outputs. If you can find one that does, so much the better.
    -
    If you know the slope of the triangle wave you can figure the frequency range from this. I picked .25 volt trip points out of the air. If your signals aren't noisy you can go below this easily.
    -
    If you want to just output a triangle wave with a constant amplitude, build an AGC circuit instead of the schmitt trigger. If you ultimately want a triangle output, why did you say in your first post you want to output a square? Just curious.
    -
    Incidentally, what's this for?
     
    Last edited: Mar 9, 2009
  11. Mar 9, 2009 #10
    Hi Averagesupernova,

    This whole idea started out with me wondering if there is a simple way to make a wide banded frequency doubler circuit that can operate from a few Hz up to a few MHz without needing to switch different components in and out for different frequency ranges. I figured that going the Op-amp route would be an interesting challenge since I haven't really seen anyone take this approach to the problem. Where the challenge really gets interesting is in the slope of the triangle wave.

    I definitely see what you are talking about, but part of the challenge I wanted to find is if there is a way to make the circuit dynamically scale the triangle wave's slope to match the on time of the input square wave. If I could do even this, it would make for a very nice square wave to triangle wave converter. Now, in this specific case, the ultimate goal is to just do frequency division, but if I can solve the attenuating triangle wave problem, that could give my circuit much wider bandwidth than just fixed values.

    - Jason O
     
  12. Mar 9, 2009 #11

    Averagesupernova

    User Avatar
    Science Advisor
    Gold Member

    You can easily change the slope of the triangle wave by amplifying or attenuating it. As I said in the previous post, use an AGC circuit.
    -
    There was a frequency doubler thread a week or 2 back. I didn't think it was practical for the OP to build something. This would have been one way to solve that problem. Probably a bit more technical than what the OP would have wanted to deal with considering it was automotive (single supply, etc.)
     
  13. Mar 9, 2009 #12
    Hmmm yeah it's funny you mention that, I was just doing some Googling to learn more about AGC circuits. But unfortunately, I'm having a hard time finding a simple circuit that 'works' well. At the moment, I'm using this online java circuit simulator here: and Multisim in attempts to simulate something to see it working, but so far I'm not having any luck. Is it possible to simulate an AGC using only Op-Amps?? So far the circuits I've been finding have all had either, transistors or JFETs in them which all seem to be crashing and burning in the simulator, which doesn't seem to like them too much. Would you happen to know of a good, simple circuit that might work for this case? Here's a couple of circuits I found so far:

    http://www.microst.it/Progetti/images/flash_8.jpg

    http://electronicdesign.com/Files/29/6272/Figure_01.gif [Broken]

    The first one looks simplest but I can't seem to get it to work.

    - Jason O
     
    Last edited by a moderator: May 4, 2017
  14. Mar 10, 2009 #13

    Averagesupernova

    User Avatar
    Science Advisor
    Gold Member

    Most AGC circuits you find published will be for audio or something that is alot more dynamic than a simple triangle wave. If I were to build an AGC for this circuit I would actively peak to peak detect the triangle wave. Filter it out to get a DC voltage that represents the peak to peak voltage. Then run this through an op-amp that drives a small LED. One input on this op-amp can be used as a reference. Use a cadmium sulfide cell (CDS photo cell) as part of the feedback path in the op-amp stage that actually varies the gain. Couple this CDS cell up with the LED using some heat shrink or something to keep ambient light out. Is this making sense? I've built a circuit like this and it worked fairly well with audio frequencies. I don't recall the dynamic range exactly but it seems like it could handle a range from 100:1 while keeping the output fairly constant. I'm not sure what the CDS cell does when the frequency gets up into RF. They might have alot of capacitance when you get into higher frequencies.
     
  15. Mar 11, 2009 #14
    Hey Averagesupernova,

    Great idea there! I was just simulating the peak detector circuit in the java circuit simulator here: http://www.falstad.com/circuit/ (forgot to post the link the first time).

    If you open the simulator and go to File --> Import, then paste this in and you can see the circuit I made:

    $ 1 5.0E-6 1.1685319768402522 50 5.0 50
    a 160 144 256 144 1 15.0 -15.0
    a 352 160 448 160 1 15.0 -15.0
    d 256 144 320 144 1 0.805904783
    w 320 144 352 144 0
    w 352 176 352 208 0
    w 352 208 448 208 0
    w 448 208 448 160 0
    w 160 160 160 192 0
    w 320 144 320 192 0
    c 320 192 320 288 0 1.0E-5 3.3096875926687934
    g 320 288 320 320 0
    w 160 192 256 192 0
    w 256 192 320 192 0
    O 448 160 512 160 0
    r 256 192 256 288 0 10000.0
    w 256 288 320 288 0
    v 112 288 112 128 0 3 3000.0 1.5 1.5 0.0 0.5
    w 112 128 160 128 0
    g 112 288 112 320 0
    o 16 1 0 35 5.0 9.765625E-5 0 -1
    o 13 64 0 34 5.0 9.765625E-5 1 -1

    For some reason, the graph showing the output of the op-amp wont show up when I import the above code so after loading the circuit, if you right click on the "out" marker and goto "View in Scope" you'll be able to see it.

    I am still playing with the resistor to set the adjustment speed but is this what you were referring to? Also, about the LED and CDS cell, that sounds like a simple way to make a voltage controlled resistor for the gain stage. Though, just out of curiosity, is there a way to make something that behaves the same way using Op-amps?

    Thanks!
    Jason O
     
    Last edited: Mar 11, 2009
  16. Mar 11, 2009 #15
    Your thinking along the lines of how I'd do it. I presume you can use Diodes. I'd convert from integral to square using differentiation or integration. If You split the rising and falling part of the sine wave into two parts and bias them so the mid point of each part is around zero then taking the absolute value will give double the frequency.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Square Wave Frequency Doubler using Op-Amps
  1. Frequency Doubler. (Replies: 18)

  2. Op-amp use (Replies: 8)

Loading...