# Simple phase-shifter?

Discussion in 'Electronic Basics' started by eromlignod, Feb 24, 2008.

1. ### eromlignodGuest

Hi guys:

I know there must be a super-simple way to do this, but I keep getting
caught up in PLL stuff.

I have a simple square wave in the audio-frequency range. I would
like to simply shift its phase for experimental purposes. The output
would be a square wave at the same frequency, but with the phase
shifted X-degrees. I would like for the shift angle to be variable if
possible. It seems to me there should be an easy way to do this with
some sort of passive R-L-C setup, but I can't seem to find
specifically what I want in any books.

Don

2. ### JamieGuest

Assuming that the freq is fixed, a dual 555 timer.
first unit, a time on delay for the shift. Second
unit, a one shot equal to the fixed square wave.

for variable frequency, something like a shift register
would work. You can simply vary the clock rate to adjust the
offset how ever, there would be an error in frequency reproduction
due to the bit res and clock rate..

Other option, use a uC (microchip) like PIC's, AVR's etc and
use a hardware timer event that inputs the signal from your existing
square wave and shifts it through a pack of bytes using the bits of each
byte as the value as circular buffer that gets output to an IO as the
phase offset.
the rate can be adjusted via one of the ADC inputs which would simply

Many solutions.

--
"I'd rather have a bottle in front of me than a frontal lobotomy"

"Daily Thought:
that's just it, too much smoke for that!

http://webpages.charter.net/jamie_5"

3. ### John LarkinGuest

A simple RC lowpass filter, followed by a comparator, will work. Vary
the R to vary phase shift. You can reasonably get up to, say, 45 to
maybe 90 degrees of lag (more if the comparator has hysteresis), and
you can cascade stages to get more. Phase shift will vary with
frequency.

PLLs can do a lot more, lead and lag, but are more work.

You could also pipe it into a clocked shift register, and vary the
clock frequency to directly add delay. But that would introduce a
1-clock jitter.

John

4. ### John PopelishGuest

Strictly speaking, phase shift applies only to sine waves,
and a square wave is made up of many different sine wave
components. What you are needing is not a phase shift, but
a variable time delay, that is independent of frequency
(equal time shift for many frequencies). But the time delay
for a 10 degree phase shift for the fundamental frequency in
the square wave is a 30 degree phase shift for the third
harmonic, and a 50 degree phase shift for he fifth harmonic,
etc. So an analog circuit that does what you want must
produce a phase shift that is proportional to frequency,
with a variable proportionality constant. A tall order.

Variable time delays are usually performed with a sampled
representation of he waveform passed through a shift
register with variable speed clocking. The signal
representation may be analog (voltage samples stored in a
bucket brigade analog delay line) or digital (binary numbers
made by an analog to digital converter that are shifted
through a multi bit shift register, the output converted
back to voltage samples by a digital to analog converter).

DSP (Digital Signal Processor) chips have all the stuff
needed for the second case, except, possibly for memory to
hold the shift register.

The analog delay lines are getting really hard to find
because DSP chips have gotten so good and so cheap.

You might find some on eBay:
or from surplus places electronics sellers.

5. ### John FieldsGuest

---
View in Courier:

HC123A
+------+
Vcc-----+-----------+--|1B |
| | | _ | Vcc
[Rt]<-+ +-O|1R | |
| | | | | |K
+---+--+----|--|1RC | [1N4148]
| | | | _ _| |
SQIN>---|------|-+--|-O|1A 1Q|--[10nF]--+------+
| | | | +------+ | |
| | | | [10K] |
| | | | HC123B | A
| | | | +------+ GND NOR Y-+--OUT>
[Ct] | +--|--|2B | +-B |
| | | | _ | Vcc | A-+
| | +-O|2R | | +-Y NOR
| | | | |K B
| +-------|2RC | [1N4148] |
| | _ _| | |
GND>----+-------------O|2A 2Q|--[10nf]--+---------+
+------+ |
[10K]
|
GND

________________ __________
SQIN___| |________________|

Tdr-->| |<-- -->| |<--Tdf
________________ _______
OUT_______| |________________|

Tdr = Tdf = 0.45 RtCT

6. ### Bob MastaGuest

The RC approach that others have described is probably as close as
you're going to get to "super simple". But just to toss another idea
into the pot, you can integrate the square wave into a triangle, then
use comparators to set the trigger points. The simplest way to do
that is probably to run your original square wave at twice the
frequency you really want, with a single comparator that triggers
at the desired level (which is now linearly proportional to phase).
Its output will be a pulse of variable width, namely only as wide as
the portion of the triangle wave that is above the threshold. But
the output of the flip-flop will give you a clean square wave, at the
desired frequency.

Note that this approach is best with a fixed frequency. If you vary
the frequency, the triangle out of the integrator will change its
amplitude.

Best regards,

Bob Masta

DAQARTA v3.50
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, FREE Signal Generator

7. ### eromlignodGuest

I'm intrigued by the low-pass filter idea. I'm using a comparator to

Now, do I have to be close to the cut-off to get the phase lag, or do
I get the lag even if I'm well below it? In other words, can I make
the filter with a cut-off far above my working frequency and still get
an appreciable phase lag?

Thanks for all the ideas so far.

Don

8. ### Don A. GilmoreGuest

I'm intrigued by the low-pass filter idea. I'm using a comparator to

Now, do I have to be close to the cut-off to get the phase lag, or do
I get the lag even if I'm well below it? In other words, can I make
the filter with a cut-off far above my working frequency and still get
an appreciable phase lag?

Thanks for all the ideas so far.

Don

9. ### whit3rdGuest

Alas, the easy ways are either very limited or require sinewaves.
you could feed those to a pair of balanced mixers that accept
low-frequency local oscillator input, sum the outputs, and get

cos(phi)sin(wt) + sin(phi)cos(wt) = sin(wt + phi)

where some trickery with custom potentiometers makes the
constants cos(phi) and sin(phi)...

For square waves, you could generate with a PLL a signal
at 20*f, then use a CD4017 to generate ten staggered output pulses.
A toggle flip/flop on any of those pulses will have a characteristic
phase (you
might want to reset all flip/flops with (Q #0 .and. pulse# 0)
to ensure repeatable phase). Between the Q and /Q outputs of
ten flip-flops, you'd have twenty phases of the same square wave to
choose from.

10. ### Bob MastaGuest

If you tell us more about how the whole system is supposed to work,
perhaps we can come up with an optimized approach. For example,
are you generating the initial square wave yourself? Does the phase
shifter have to work across varying input frequencies automatically,
or can you readjust when the frequency changes?

Best regards,

Bob Masta

DAQARTA v3.50
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, FREE Signal Generator