# Phase shift a square wave

I have an application where I would like to derive a secondary square wave from a primary one but with a continuously variable phase shift. I would like to know if this is possible to achieve in a relatively simple manner, ideally without an FPGA or Arduino etc. I'm open to the idea of a PLL chip if these are approximately as inexpensive as, say, 741s or 555s and that the implementation does not imply a long settling time. However, if there is absolutely no other way of doing it then I'm open to more complicated suggestions.

The specifications for the primary square wave are not yet set in stone but the following can be taken as guidance:

• fixed frequency at some convenient rate (say 1MHz)
• 50% duty cycle
• 0-5V or 0-3.3V p-p or similar to suit any logic requirements

Specifications of the secondary derived square wave:

• phase shift from primary of 0-360 degrees
• not discrete steps but continuously variable (analogue control eg potentiometer, voltage input or similar)
• ideally an instantaneous phase shift (minimal settling time)

The other question (Phase Shift Square Wave) with the same title as this one is different in that the OP wanted to produce 6 x 60 degree fixed sub-multiples of his original frequency. I want to be able to vary my shift continuously over one full cycle.

• Comments are not for extended discussion; this conversation has been moved to chat. Jan 7, 2021 at 16:20

took a crack at it. this isn't it, goes from 0 to less than 90 deg shift.

principle along the lines of @hacktastical's comment.

pot makes two symmetrical control currents, and diode bridge steers, steering controlled by input clock. output of steered current bridge makes variable slope ramps out of the input clock's rising and falling edges. then comparator vs mid supply produces output.

falstad original here ... note "resistance" slider on the right that controls the pot. changes take a few cycles to settle (in case it is not ramping rail to rail, because of action of the 20k resistor to center it. but at that point the phase shift is maxed out anyway)

• thanks for posting. This is an interesting way of doing it but I think the settling time is going to be a problem. Jan 7, 2021 at 9:27
• @DaveLowe how so? You didn't specify anything like that! Jan 7, 2021 at 9:40

another half finished concept via the PLL route (e.g. with inexpensive 74hc4046 PLL chip). I have no idea what I'm doing with these things but hey.

Concept:

fake-like live action here (falstad simulation) -- note PHASE CONTROL slider on the right of screen. Gets almost 0-180 deg. If adjusted too abruptly it can get funky, but input could be filtered.

The XOR detector probably not the best one. Here the range of phase adjust is limited to a little under 180 degrees. But this time, we have the option (not shown) to divide both the CLK_IN and CLK_OUT down before putting into phase compr ... that way if for example clk/2 is shifted 0-180, then clk/1 should come out shifted 0-360. hopefully.

Again, to be totally clear, this is a long way from "real life", just an illustration of the principle