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

Variable frequency phase shifter

  1. May 2, 2007 #1
    Hello All,

    I am designing a three-channel pulse circuit with a range of 1Hz to 1MHz. It only puts out square waves and I'm trying to think of the simplest way to allow the phase of the outputs to be adjusted between 0 and 180 degrees. I found a simple Op-amp circuit to do it but I'm not sure how that would work when the input frequency can be changed. Is there any kind of circuit (or IC) which can do this but can do the shift proportional to the frequency?

    Thanks,
    Jason O
     
  2. jcsd
  3. May 3, 2007 #2

    berkeman

    User Avatar

    Staff: Mentor

    What resolution do you need in the phase shift? The most straightforward way to do this would be to have a higher frequency base clock (say 40MHz), and use digital divigers and counters, etc., to generate the base signal and the phase-shifted signal.
     
  4. May 3, 2007 #3
    That's a tough one to implement. Those pulse generators have to be triggered by a master oscillator, once they are triggered at the same time they will have 0 phase. Then to change the phase of one generator you need to delay the triggering on one, then you will have a phase shift with respect to the master oscillator.
     
  5. May 4, 2007 #4
    Old fashion:

    Integrate your square wave, and trigger another square wave (flip-flop) on a (freely chosen) level within this ramp (use a comparator). This might well be packaged on a single IC today.
     
  6. May 4, 2007 #5

    berkeman

    User Avatar

    Staff: Mentor

    Although he will probably need to have decade-range switches to change the rate of integration. Like 1Hz, 10Hz, 100Hz, 1kHz, 10kHz, 100kHz, 1MHz.
     
  7. Jun 20, 2007 #6
    Hello All,

    It looks like I'm back to the phase shift issue. I like the idea of using a range selector to get the delay ranges I need, but what kind of chip would you suggest I use? To give you a better idea of my circuit setup, I have three signal inputs from the same clock frequency that will drive some 74HC423 ICs to regulate the pulse width of the input frequency and from there, it goes into three MOSFET driver chips.

    I'm guessing that I would want to insert the phase shift circuitry between the function generator and the 74HC423 chips. What do you suggest I use as the simplest implementation to smoothly vary the phase shift?

    Thanks,
    Jason O
     
  8. Jun 21, 2007 #7

    xez

    User Avatar

    Well a phase shifter that generates a constant phase
    retardation over a range of frequencies is called an allpass
    filter, and it has a linear delay versus frequency relationship.

    I wouldn't personally be in favor of using an analog phase
    shifter for this, especially over a 10^6:1 range of
    frequencies.

    I don't know what function your master circuit performs.
    I also don't know how responsive the phase shifter has
    to be e.g. if it can have an initial setup time or
    pipeline delay during which it doesn't operate.

    If I needed a black box circuit that'd take what's
    guaranteed to be a logic level piecewise constant
    frequency (i.e. the input frequency remains the same for
    long times relative to how often it changes)
    square wave in, and produce a phase delayed square wave
    of the same frequency out, I'd do this --

    * Take the input signal, feed it into a small single
    chip microcontroller that has an input timer function
    that can sufficiently accurately measure the frequency
    (e.g. high-time, low-time) of the input signal relative to
    some acceptably fast local clock e.g. 50MHz = 1/50th of
    your 1MHz maximum frequency signal, so 360/50=7.2
    degrees accuracy; use 100 MHz for 3.6 degrees accuracy,
    etc.

    * Have the microcontroller simply measure the high-time
    and/or low-time of the input signal; since the input is a
    semi-constant frequency square wave, the high time will
    match the low time, and once it's measured once
    it's going to be a repetetive timing pattern forever until
    the input frequency changes.

    * Now the input signal frequency is precisely measured.
    Specifically the input period is known relative to your
    microcontroller's local high speed clock rate in terms of the
    high speed clock cycles that correspond to 360
    degrees of the input clock rate.

    * Multiply that measured high speed counter value that
    corresponds to 360 degrees of input cycle time by whatever
    fractional phase shift value you want, e.g.
    0/360 * high_speed_counter_ticks_per_input_cycle =
    zero degrees phase shift, similarly
    36/360 * high_speed_counter_ticks_per_input_cycle =
    thirty six degrees phase shift, etc.

    * Now whenever the input signal rises (e.g. a new
    input cycle has started and the input is at zero degrees)
    start a delay counting down from the counter value that
    corresponds to the desired phase shift between input and
    output.

    * When the phase delay counter has expired, simply toggle
    the state of the output I/O bit that goes to
    the output pin on which you want to generate a
    phase-delayed output signal corresponding to that
    input signal.

    * Repeat this same logic block independently
    for each of the three inputs you wish to phase delay.
    You now have an arbitrarily accurate digitally stable
    low cost probably single-chip phase shifter that can
    accept and phase shift numerous signals
    (how many input signals do you want?
    all you need is about 32 bits each for two counters,
    one input pin, and one output pin per in<--->out block).

    * Find some nice chip like one of the AVR or single
    chip controller 8051 parts or something like that that
    will do this all and require no other chips/glue logic,
    and it'll probably be something like a single 20 pin $4
    digital chip that you can easily buy from digi-key.
    The program is trivial so you'd have maybe a couple of
    dozen instructions in either C or assembler for the whole
    thing.

    * Obviously feel free to add something like a serial port
    or whatever that you can use to communicate the phase
    delay desired to the microcontroller.

    * Alternatively just add three decade switches or something
    like that to a few of the unused input pins to dial in
    a phase value from 000 to 360 if that's easier for you
    than pre-programming the delay or communicating the
    value through a serial port from your PC or whatever.

    * Instead of a microcontroller of course you could use
    something like a CPLD or tiny FPGA to do the same thing
    in circuitry and logic. I'm sure one of the smallest
    cheapest (couple dollars) CPLDs or FPGAs from Altera,
    Xilinx or similar company would easily implement the
    same logic.

    * The algorithm would be self-adaptive to frequency
    changes since within a delay of 180 degrees of the
    input signal it would have updated its precise measurement
    of the input half-period and then it'd use the newly
    measured value for the phase delay counter, so you'd
    have at most 180 degrees of the new input frequency of
    'lag' while the thing figures out the new time. This would
    be as good as you can possibly do given an arbitrary
    and unknown changable input frequency.

    * Of course I'd consider to look at what the REST of your
    circuitry is doing that's GENERATING these input
    frequencies and see if you can't just do more of that
    logic and processing with such a microcontroller or
    programmable logic chip since it's a bit odd to have
    such a seemingly simple input signal (three square waves
    of some chosen frequency) and not be able to integrate
    even that function into this more complete subsystem.

    Oh my, I just noticed that you're going FROM the phase
    shifter INTO 423 multivibrators to control pulse width.

    That's way too much circuitry for some simple digital
    logic. Just add a programmable output pulse width
    into the microcontroller or FPGA and you won't need the
    multivibrators at all either...
     
  9. Jun 21, 2007 #8

    xez

    User Avatar

    I'm not sure what level of technology it's easy for you to
    work with, e.g. if you're able to make simple PC-boards
    for this, if you can work with surface-mount SOIC / TSSOP /
    TQFP type parts, if you have any basic programming knowledge in C or assembler or VHDL or whatever.

    If you want to do phase shift as well as pulse width
    control in a very simple microcontroller you could use
    something like the MSP430F2xx series parts from
    Texas Instruments. They run the processor and timers
    at frequencies up to 16MHz which can be
    internally generated unless you have cause to want to
    clock them externally. At 16MHz you'll have 16 steps
    or 360/16 = 22.5 degree resolution phase control of
    a 1MHz signal or simply 1/16000000 = 62.5ns timing
    resolution when you're controlling pulse timings and
    widths. Obviously the output relative resolution just
    gets better and better as your desired output frequency
    goes down from 1MHz into the kHz and Hz ranges.
    It'd be trivial to program these to replace a function
    generator in the sense that they'd generate not only
    the phase delay between outputs, but also the pulse
    width control, and also the master clock frequency as
    well if desired.

    You could use something like a couple of the
    MSP430F2234 parts available in quantity 1 from DigiKey
    for $5.50 or so per piece, and available in 38 pin TSSOP
    surface mount chip packages which aren't too hard to work
    with manually with only a moderately good hobbyist level
    PCB and soldering capability.

    A couple of those would give you enough I/O pins to
    do things like add a numeric keypad or whatever similar
    switch/interface mechanism you may want to to set
    the timings, if desired, or you could just use the serial
    port and do it from a control PC.

    Or for a simpler construction you could use something like
    three MSP430F2012 / MSP430F2013 chips,
    one for each output channel, and those are available in
    14 pin through-hole DIP packages that could be used
    with wire-wrap, perf-board, breadboard, or dead bug
    type manual assembly and construction techniques.
    They're between $2.70 to $3.83 a piece from digikey
    depending on the part/package.

    For $20 you can get the whole MSP430 programming
    hardware and software for their basic series of parts:
    http://www.ti-estore.com/Merchant2/merchant.mvc?Screen=PROD&Product_Code=EZ430-F2013

    and for $10 you can get *three* of the MSP430F2012
    chips attached to little test/prototype PC-boards that
    give you access to all their signals as well as which
    plug right into the programming tool I mentioned just
    above:
    http://www.ti-estore.com/Merchant2/merchant.mvc?Screen=PROD&Product_Code=EZ430-T2012

    They're programmable in C or their own assembly
    language, and, as I said, the amount of programming
    is literally trivial if you're just doing things like setting
    up the built in timers to generate / measure various
    pulse widths and frequencies etc.

    Now if you wanted really *excellent* phase resolution
    at 1Mhz, e.g. in the 1 degree range or fractions thereof,
    you could use something like an Altera EP1C
    Cyclone FPGA or similar with an internal digital PLL
    clock synthesizer to generate a multi-phase 100-200MHz
    range clock, program a few 28 bit divider counters
    to set the phase and pulse width of your various outputs
    and measure the input signals, etc. I'm sure the chips
    are pretty inexpensive like under $20ish quantity one,
    but you'd need to be comfortable programming them,
    soldering surface mount packages with fair numbers of
    pins, etc. etc. and if that was all easy for you you probably
    wouldn't be asking the question and using analog
    phase shifters and timers....

    In between those ranges of performance you could
    get like 40MHz, 50Mhz, 80Mhz type microcontrollers
    that could give you better timing resolution, also pretty
    cheap and relatively easy to program, but not quite
    as easy/cheap as something like the MSP430 or PIC
    microcontrollers, so it all depends on your cost/time
    budget and capabilities / requirements.


    a CoolRunner CPLD or something like that to
     
  10. Jun 21, 2007 #9

    chroot

    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    All of these answers are remarkably complex. What's wrong with just using a variable RC filter to slow down your signal transitions, followed by an inverter to restore them to square waves?

    - Warren
     
  11. Jun 21, 2007 #10

    xez

    User Avatar

    It wasn't very clear if the three input sources had
    a common frequency or not. If they're trying to get
    three variously delayed copies of the same input
    then over a certain range of frqeuencies you could use
    three RC delays without too much problem.
    Calibrating the RC value vs. phase vs frequency would
    need a graph though since the phase change of a delay would be proportional to the 'unknown' input frequency,
    so you couldn't just have three pot dials labeled in
    0-180 degree increments, they'd be more like 0-500ms
    and you'd have to do the math from there based on your
    input.

    If there are three different frequency inputs that each
    need to be delayed by a certain time relative to their
    own frequencies, I'd think that calibrating various
    RC banks to all match a given phase offset relative to
    the different inputs frequencies would be a nightmare
    relative to user friendliness.

    If they are three output versions of a COMMON input
    frequency, they might as well just use two
    cascaded astable multivibrators per output --
    the first multivibrator triggers on the input master
    frequency clock and causes an RC variable pulse width
    of X time (500ns - 500ms) before its output pulse falls.
    The second multivibrator could clock off the falling
    pulse edge of the first one and generate a variable
    pulse width pulse every time it's triggered.

    However one would still be adjusting two pots labeled,
    at best, in 500ns-500ms values per channel to get
    a variable delay variable pulse width output, and one
    would have to calculate with graphs or measure
    with an o-scope the right settings to correspond to a given
    phase vs frequency and given duty cycle vs frequency.
    And one would have to set the timing right or one
    could have entirely inappropriate pulse widths so that
    they'd be far longer than the master frequency period
    unless they were calibrated / operated in the narrow
    range of values that'd correspond to 0-180 degrees for
    a given input frequency. And of course there'd be analog
    variability so some degree of temperature / vibration /
    tolerance variation sensitivity on the whole setup.

    If they just want an "idiot proof" "0-180" dial that'll
    work perfectly and repeatably over any frequency
    in the range with no other manual calibrations required,
    the digital uC / FPGA phase shifter is the way to go.

    Though the other poster's suggestion of an analog
    integrator followed by a 0-100% level comparator
    would self-adjust its operation relative to the input
    frequency, which is nice, though you'd need to have
    a good low leakage very linear 500ms integrator,
    and schmitt trigger, and well level regulated input, etc.

    I'd think that a couple cheap programmable
    digital logic/uC ICs is usually preferable to wiring up
    several more quantity of analog multivibrators, op amps,
    R, C components, pots, etc. even for a hobbyist; the
    analog would likely cost more (just for the good
    20 turn pots alone!) and be just as hard or worse to
    construct.
     
  12. Jul 5, 2007 #11
    Hey guys,

    Awesome ideas here for the phase shifter circuit! Ultimately I do plan on using some sort of programed approach such as a micro-controller to make things very precise, but for now, I'm just looking for a quick and dirty solution that will work for some preliminary testing. You all have presented marvelous approaches and I'll have to take some more time and read through it all and comment. Thank you all again for the great tips and ideas!

    - Jason O
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Variable frequency phase shifter
Loading...