# Re: Phase shifter

• posted

>

>>Hi guys, >>I'm trying to do a simulation of 90 degree phase shift to my square wave >>signal. Before this I tried to use an integrator and a comparator. But this >>circuit is only capable to have 90 degree phase shift for a definite >>frequency. That's mean for other frequencies it will have different phase >>shift. >> >>So, anyone can help me with this? How to do a 90 degree phase shift for >>square wave with any frequency? I heard there is a digital phase shifter. >>But I'm not very sure about that. >> >>Thanks:) >> > >How about an integrator followed by a zero-crossing >detector? The integrator output will be a triangle wave >with peaks aligned with the square wave edges. The zero >crossings of the triangle will be at 90 degrees. (That >assumes the input square was symmetrical about zero. If >not, you will need to set the threshold of the comparator to >an appropriate level.) > >It wouldn't have a huge frequency range, since on the low >end the integrator would saturate and on the high end its >output would get low enough to make noise and DC offset an >issue. A little hysteresis in the comparator could reduce >the noise issue, at the expense of exact 90 degree phase >shift. > >But might be fine over a limited range, depending on what >it's needed for. > >Best regards, > > >Bob Masta > > DAQARTA v6.01 > Data AcQuisition And Real-Time Analysis >
>Scope, Spectrum, Spectrogram, Sound Level Meter > Frequency Counter, FREE Signal Generator > Pitch Track, Pitch-to-MIDI > Science with your sound card!

I think that's what he did. It should work over a pretty wide range,

100:1 or so, if the details are handled right.

The integrator has to be kept from railing - you've gotta fix the drift and constant-of-integration problems - which implies some DC negative feedback, which limits the low-frequency accuracy. And the amplitide does drop with frequency, so the HF signal gets too small eventually and the comparator gets into trouble. You can do range switching and such to extend the range, if you can tolerate the gear-switching glitches.

You can do a form of hysteresis that adds no phase shift. Arrange for the comparator to always switch at zero, and push the positive-slope and negative-slope offsets away from that.

Another way to do this is to have three comparators: positive, zero, and negative, and do a little logic on them.

Hey, this should work with a single comparator: use the transitions of the square wave to arm a state machine - that will be at the triangle peaks - and fire it based on zero-crossing transitions of the comparator.

I guess one could use multiple integrators to span a wide range, and use a state machine to select the best one at any given frequency. That could be done glitchlessly.

Of course, it could be done digitally, PLL or some sort of DSP thing.

We had a similar thought a while back: one could, in an FPGA, make a huge-range DDS frequency synthesizer, microHertz to megaHertz. Then - the tricky part - close a servo loop to set the DDS to exactly track some external input, like the square wave in this case. Once it's sync'd up, you can synthesize any waveform at any frequency or phase.

I suppose the very exact definition of "90 degree phase shift" is debatable for a time-varying square wave. Sampling theorem and all that. Even an ideal integrator+comparator gets weird when the input frequency changes.

John