# Circuit to produce variable phase shift up to 180 degrees of a square signal

#### mleka

Joined May 27, 2008
15
I have built 1 simple square wave generator circuit using a 555 timer and wanted to add another circuit to be able to shift the signal as necessary to bring two signals in phase. I have another 555 timer circuit that generates same square waves and wanted signals to be used in phase with each other. These circuits generate signals in the range of 0.15Hz to 800KHz. I needed a phase shift circuit that can take the signal of FG1 (frequency generator 1) and shift it by 180 degrees max to be in phase with the FG2. Kind of like this

SQIN____|-----|____|-----|

OUT__|-----|____|-----|____

The idea is to mechanically control the phase shift through 1or 2 variable resistor(s). Any idea how to do this. I have searched in the internet and only came up with 1 circuit which could not understand...Any help would be appreciated. I would settle for less phase shift (up to 90degrees)if it is simple solution.

#### Papabravo

Joined Feb 24, 2006
15,515
I don't know of any "simple" circuits that will do what you want. My thinking involves some kind of an analog or digital delay line that takes one of the signals in and delays it for some fixed amount of time up to and including one half a cycle or 180 degrees. With two independent signal sources, even if you could get them in phase momentarily you can't keep them in phase unless the phase error can adjust the frequency of one of the sources thereby phase locking one signal source to the other. One or two resistors ain't gonna do jack for ya

#### tom66

Joined May 9, 2009
2,595
I'm thinking of a phase locked loop and some kind of adjustable phase shift oscillator, but I wouldn't know how to implement this. The problem is, any phase shift I can imagine is affected by frequency...

#### SgtWookie

Joined Jul 17, 2007
22,221
Give this a try:

#### Attachments

• 24.3 KB Views: 1,130

#### Papabravo

Joined Feb 24, 2006
15,515
A phase locked loop is a useful circuit for controlling a VCO and generating a higher frequency or a lower frequency than that of a reference frequency. The OPs problem is that he wants a circuit that takes two independent sources and attempts to line them up so that they have the same phase. This also requires the two frequencies to be harmonically related. We used to do this with sine wave oscillators using a scope in XY mode to produce Lissajous figures.

http://en.wikipedia.org/wiki/Lissajous_curve

It can be difficult to make a stable display, with simple oscillators, as anyone who has tried this will attest.

If I understand the problem correctly this is kinda like nailing jelly to a tree. In order for this to work both sources must have the identical frequency. An error measured in parts per billion just won't work for very long. Next you need a variable delay so you can apply it to one of the signals and match up the edges. Small frequency errors will require that this process be repeated continuously.

#### Papabravo

Joined Feb 24, 2006
15,515
So Sgt. Wookie's RC delay is going to have a very sensitive response around 0 degrees and pretty insensitive response toward 180 degrees. This is due to the exponential charging and discharging of the capacitor; unless there is some cleverness that I missed. I think choosing a linear pot for this application would be suboptimal. I'm not sure if an audio taper would be an improvement because I can't remember which way they go.

#### SgtWookie

Joined Jul 17, 2007
22,221
Yes, it certainly isn't optimal, and it will have to be adjusted for each change of frequency. However, it's pretty simple to build.

Another method might be to use a looped shift register, or series of shift registers, inverting the last output bit to the D in bit, and clocking the registers at some multiple of the desired output frequency. Multiple D-type FF's could also be used.

#### Papabravo

Joined Feb 24, 2006
15,515
Yeah. That would be like a digital delay line; essentially a long shift register. To get the right granularity, as you get with an analog delay line, you need quite a few stages and a high frequency clock. That's not a simple circuit by any means. I'd be interested to find out if the simple threshold adjustment on the LM555's meets the OPs needs.

#### mleka

Joined May 27, 2008
15
Thanks for your responses. I do appreciate taking the time to look into this.
Looking at the circuit posted from SgtWookie:
I do am not quite sure if I understand it correctly. Would this be good for certain frequency only and have to adjusted for other frequencies? If so what would I need to adjust? If it requires changing capacitors values that would not be practical.

Maybe I do not need this circuit after all. Let me explain a bit what I have and why I thought that having something like this would be helpful. I have made 3FG in one box and have a main switch for all 3 of them. Then each of them has a switch of their own. I want to be able to generate different frequencies in phase with each other. For example, if FG1 = 10Hz then FG2=100 Hz and FG3 = 1KHz and all of them must be in phase. Should they be in the phase if I start all FG's with the main switch on? Forgive me for the limited knowledge in circuitry as I am a Mechanical Engineer and still trying to learn. It is something that I really enjoy...
Any feedback is appreciated.

#### SgtWookie

Joined Jul 17, 2007
22,221
In the circuit that I posted, the outputs from both 555 timers will be roughly symmetrical (~= 50% duty cycle), except for the first clock right after power has been applied. Out2 will always be delayed from Out1, depending on the setting of VR2.

VR1 adjusts the frequency or PRT (PRT=1/freq) at Out1. VR2 adjusts the delay time. The delay time is independent of the frequency of Out1. If the delay time exceeds PRT/2, OUT2 will no longer toggle.

As far as your 10Hz/100Hz/1kHz requirement, that would be duck soup to do cascading some /10 counters with shift registers. It would be even easier to do in a microcontroller, as you wouldn't have to re-wire the circuit to change frequencies/ratios/whatever - just feed it some new numbers via switches, serial port, or reprogramming.

Last edited:

#### mleka

Joined May 27, 2008
15
Thanks for the response. It is really tricky to have such circuit. Because my duty cycle is also variable that particular solution would not meet this criteria. I have seen a circuit somewhere about this. I will search for it and post it here so we can discuss it.

#### mleka

Joined May 27, 2008
15
how about this circuit - will it do the job?
I can not quite understand all of it because of how it is made...any feedback would be appreciated...

#### Attachments

• 42.5 KB Views: 171

#### JoeJester

Joined Apr 26, 2005
4,390
According to the 74HC123 data sheet:

1. General description
The 74HC123; 74HCT123 are high-speed Si-gate CMOS devices and are pin compatible with Low-power Schottky TTL (LSTTL). They are specified in compliance with JEDEC standard no. 7A.

The 74HC123; 74HCT123 are dual retriggerable monostable multivibrators with output pulse width control by three methods:

1. The basic pulse is programmed by selection of an external resistor (REXT) and capacitor (CEXT).

2. Once triggered, the basic output pulse width may be extended by retriggering the gated active LOW-going edge input (nA) or the active HIGH-going edge input (nB). By repeating this process, the output pulse period (nQ = HIGH, nQ = LOW) can be made as long as desired. Alternatively an output delay can be terminated at any time by a LOW-going edge on input nRD, which also inhibits the triggering.

3. An internal connection from nRD to the input gates makes it possible to trigger the circuit by a HIGH-going signal at input nRD as shown in the function table.

Schmitt-trigger action in the nA and nB inputs, makes the circuit highly tolerant to slower input rise and fall times.

The 74HC123; 74HCT123 are identical to the 74HC423; 74HCT423 but can be triggered via the reset input.
It will be difficult to shift variable signals 180 degrees using the 'HC123.

They are good when you have multiple triggers for the same event .... like using a lighning detector's output to trigger an alarm.

#### mleka

Joined May 27, 2008
15
It is ok if it is not possible to shift to 180degrees. I would be happy with small shifts of phase angles. In terms of time maybe from 0.000001s to 0.1s? Can we look at this from the delay time of signal only...

#### Papabravo

Joined Feb 24, 2006
15,515
I think you are completely missing the point of a monostable multi-vibrator also known as a one-shot. The leading edge of a one-shot is always synchronous with a trigger event with some small finite delay usually measured in nanoseconds. The trailing edge is determined by the RC components and is not related to any clock or the trigger. This part will not help you achieve phase shifting of any signal by any stretch of the imagination.

You should be looking at an analog delay line if such a thing still exists

Last edited: