Chage phase of a square wave

Thread Starter

wildarms

Joined Aug 2, 2013
6
Hi everyone, was lurking around trying to find what i need, which is a way to control a square wave's phase output, i have only worked with sinusoidal waves and i know that circuits like RC oscillator can be used to change it's phase, but suddenly i was asked to do it directly for a square wave and after a while searching around i'm kinda at a loss of what to do (use).

First things first, let me explain my objective, i am doing this in order to do a multiplexer, i'm going to to have 3 different waves that im going to need to take samples of, and put them all together, so, in order to do the sampling, i need the 3 square wave signals with 3 phases, one with 0° other with 120° and the other with 240° , and i will be generating the square wave directly from a wave generator, so i pretty much just have to do 2 circuits to change it to 120° and other to 240° since the 0° is just the original one.

After that im already investigating how to use the 4066 to do the multiplexing part, but before that i need to be able to do this or i won't be able to get nowhere.
And i found this thread that has a close question to what im wondering http://forum.allaboutcircuits.com/showthread.php?t=11725 specifically, the reply that got my attention was SgtWookie's http://forum.allaboutcircuits.com/showpost.php?p=71323&postcount=5 , there, using a 4093 he seems to post exactly what i -think- i need.

So, i would like to hear everyone's opinion in how to do this, like, what i would need to get in order to do it (since i have to do it in physical), of course i have multisim so i dont mind examples using that, and also, if someone understands better SgtWookie's image, i would like to know how to calculate the phase i want the output to be, since that is the only problem i have with that image, i need to have these specific phases in order to be able to multiplex without problems and be able to recover the original 3 signals later, of course, i imagine is related to the resistor and capacitor's value but im not sure how specifically to take out the phase i want...

Thanks a lot for the help in advance :)
 
Last edited:

Thread Starter

wildarms

Joined Aug 2, 2013
6
You might try this circuit........
Thanks for reply, umm, it seems it does the work but,could you tell me what did you use to change the phase? What component is that o.o? Would be hard to know what component to get just like this :eek: And is there a way to control the change of phase? Since i specifically need a phase of 120° and 240°.

Thanks again!
 

BillB3857

Joined Feb 28, 2009
2,570
The circuit uses clocked D type flip flops. It is sort of like a counter with three stages. As you can see from the timing diagram, the clock will need to be 6X faster than the output frequency required. The 120 and 240 degree spacings are controlled by the digital logic so no matter what frequency you put in for the clock, the spacing of the three outputs will maintain proper phase relationship.

On edit.... CD4013 is one example of a clocked D-type FF.
 
Last edited:

Ron H

Joined Apr 14, 2005
7,063
His idea will give you 3 phases (you may need to use some gates), but since it relies on RC networks, there will be a slight difference in time between the 3 phases. You can use 3 D-type flip flops to do the same (with a clock signal).
http://www.hitequest.com/Hardware/a120.htm
http://frontenddesign-iq.blogspot.com/
I think the divide-by-six Johnson counter is the simplest and most precise, and uses less hardware than the proposed solutions in your link.
Using the rising and falling edges of clock generally means that a divide-by-2 would be needed to get the required 50% clock duty cycle.
 

WBahn

Joined Mar 31, 2012
30,057
The problem thus far is that a square wave (i.e., a 50% duty cycle rectangular wave) won't do what you want since you want only one signal to be HI at any given time. You want a 33% duty cycle waveform.

You can achieve this using two DFFs and a single NOR gate.

Since this is pretty clearly a class assignment of some kind, you will need to show some effort towards a solution before I can help you much more.
 

WBahn

Joined Mar 31, 2012
30,057
I put together a circuit that will give you the 3 phases on the 3 outputs.
1) Why are we just working people's homework for them?

2) What is the purpose of NOR'ing the two outputs together to get the third signal, and then NOR'ing the two outputs together again to get the D input for the first FF? Why not just use Output C?
 

Thread Starter

wildarms

Joined Aug 2, 2013
6
The circuit uses clocked D type flip flops. It is sort of like a counter with three stages. As you can see from the timing diagram, the clock will need to be 6X faster than the output frequency required. The 120 and 240 degree spacings are controlled by the digital logic so no matter what frequency you put in for the clock, the spacing of the three outputs will maintain proper phase relationship.

On edit.... CD4013 is one example of a clocked D-type FF.
Thanks a lot, this clarified a lot of things, with WBahn's picture too, thankfully i will be generating the square wave from the generator so putting the frecuency 6X faster of what i want shouldn't be any problem.


Once again, thanks a lot, everyone helped me a lot so much, been 2 days and was still having problems in finding exactly what to do.

edit:
Umm... Seems some people are arguing a bit about just doing homework for me... Im sorry if this seemed to be like that, i was just at a point that no matter how much i search i couldn't find what i need, i had to ask to someone that has more experience in this area, and i thought this was a good place for that. I wasn't definitely expecting people to do the things for me, i am grateful for the options and i've analyzed all of them, it helped me to know to what direction i have to walk, and now i know about more components that can help me in things like these in the future.

I mean, this is the first time i hear about Johnson Counter, is really interesting, who could had thought i could do it this way was the first thing i thought of, i was already starting to think that i would just have to find a way to delay the square signal somehow and kinda change the phases but basing it in time, dont know if it would had worked, saying 360 is one period of time, so how much time should 120 be, and then i would have to do to delay the signal for the total time minus that... etc,etc,etc..
 
Last edited:

LDC3

Joined Apr 27, 2013
924
1) Why are we just working people's homework for them?

2) What is the purpose of NOR'ing the two outputs together to get the third signal, and then NOR'ing the two outputs together again to get the D input for the first FF? Why not just use Output C?
First, I wasn't aware that this is homework. Sorry for the oversight. Second, he had access to a circuit that would do what he wanted, except for the timing of the RC networks.
To answer your second question, because the circuit I saw used Qbar, which I didn't have on the FFs in my drawing.
 

WBahn

Joined Mar 31, 2012
30,057
First, I wasn't aware that this is homework. Sorry for the oversight. Second, he had access to a circuit that would do what he wanted, except for the timing of the RC networks.
To answer your second question, because the circuit I saw used Qbar, which I didn't have on the FFs in my drawing.
It can be hard to tell sometimes. The key here was the remark concerning having to do it physically and not just in simulation.

I think all of the prior solutions produce overlapping square waves, which can't be used as the multiplexing signals without further processing (decoding).

My question about your solution has nothing to do with Qs or Qbars. You have a NOR gate that uses Q1 and Q2 as inputs to produce Output C. Then you have two NOT gates and an AND gate, which form a NOR gate, that uses Q1 and Q2 as inputs to produce the D input to the first FF. Why not just send Output C to the D input of the first FF and get rid of three gates?

As an exercise for the OP, show that this circuit will self recover should it ever find itself in the the one state that is not used.
 

THE_RB

Joined Feb 11, 2008
5,438
Maybe you could change the problem at the source?

If you can live with the "square wave" having an ON duty of 33% and an OFF duty of 66%, you can just run the signal generator at 3x the required frequency, and use a 4017 sequential counter set to 3 steps in its sequence.
 

LDC3

Joined Apr 27, 2013
924
My question about your solution has nothing to do with Qs or Qbars. You have a NOR gate that uses Q1 and Q2 as inputs to produce Output C. Then you have two NOT gates and an AND gate, which form a NOR gate, that uses Q1 and Q2 as inputs to produce the D input to the first FF. Why not just send Output C to the D input of the first FF and get rid of three gates?
Because I'm slow and I didn't think about optimizing the circuit. ;)
 

Thread Starter

wildarms

Joined Aug 2, 2013
6
This might be a bit crazy way... but isn't it possible that instead of using logic gates, delay the signals with the new phase using a 555 timer?

Pretty much what i explained before, at the end, it's the same square signal but it starts later in the time domain, and if i just set it up to start when the time of a 120 grades and a 240 grades should be.

for example if its a 2k frequency square wave, it's 50ms per cycle, and 360 grades its one cycle, so if i want the 120 time value, it would be (120x50ms)/360, then i use this time with the timer delay equation and set it to start there...

Can this be done? Wouldn't this technically be the same thing at the end?

Tho i doubt it would as exact of course...

Also, i can't seem to find where to edit the thread, just realized that i wrote "chage" instead of "change"
 
Last edited:

LDC3

Joined Apr 27, 2013
924
This might be a bit crazy way... but isn't it possible that instead of using logic gates, delay the signals with the new phase using a 555 timer?

Pretty much what i explained before, at the end, it's the same square signal but it starts later in the time domain, and if i just set it up to start when the time of a 120 grades and a 240 grades should be.

for example if its a 2k frequency square wave, it's 50ms per cycle, and 360 grades its one cycle, so if i want the 120 time value, it would be (120x50ms)/360, then i use this time with the timer delay equation and set it to start there...

Can this be done? Wouldn't this technically be the same thing at the end?
Yes, it can be done that way. But how many resistors and capacitors are you going to check for the 2 RC networks to get the time delays that you need? Also, what happens on a hot day when your components heat up (or age) and change values? Will it be ok to overlap 4ms? Or no signal for 12ms?

And the biggest problem comes when the specification now says that the clock can be variable (from 962Hz to 3.43kHz).
 

WBahn

Joined Mar 31, 2012
30,057
This might be a bit crazy way... but isn't it possible that instead of using logic gates, delay the signals with the new phase using a 555 timer?

Pretty much what i explained before, at the end, it's the same square signal but it starts later in the time domain, and if i just set it up to start when the time of a 120 grades and a 240 grades should be.

for example if its a 2k frequency square wave, it's 50ms per cycle, and 360 grades its one cycle, so if i want the 120 time value, it would be (120x50ms)/360, then i use this time with the timer delay equation and set it to start there...

Can this be done? Wouldn't this technically be the same thing at the end?

Tho i doubt it would as exact of course...

Also, i can't seem to find where to edit the thread, just realized that i wrote "chage" instead of "change"
Please tell use WHAT you are going to do with these three SQUARE waves. You aren't going to just use them to turn on and turn off three analog switches by tying each squarewave to one gate control input. That won't work for the reasons stated previously.

Think about what is important. You want to turn on ONE signal at a time. If you ever have more than one signal at a time, you are going to, at the least, have a meaningless signal. If you are going to sync at the other end, you also need signals that have reliable timing.

You want the signals that control your switches (or however your signals are mux'ed) to be slaved to ONE signal -- a clock. And you don't want the timing to depend on the interaction of a half dozen components, especially in such a way that bits and pieces of the timing vary in different ways depending on which components drift for whatever reason.
 

Thread Starter

wildarms

Joined Aug 2, 2013
6
Please tell use WHAT you are going to do with these three SQUARE waves. You aren't going to just use them to turn on and turn off three analog switches by tying each squarewave to one gate control input. That won't work for the reasons stated previously.

Think about what is important. You want to turn on ONE signal at a time. If you ever have more than one signal at a time, you are going to, at the least, have a meaningless signal. If you are going to sync at the other end, you also need signals that have reliable timing.

You want the signals that control your switches (or however your signals are mux'ed) to be slaved to ONE signal -- a clock. And you don't want the timing to depend on the interaction of a half dozen components, especially in such a way that bits and pieces of the timing vary in different ways depending on which components drift for whatever reason.
Yes, i imagined it wouldn't work, but i wanted someone that knows about this more than me to tell me why since it was just something that occurred to me. So i guess i will have to use the logic gates after all. I remember this part was really sensible when i did it the TDM with labview.
 

WBahn

Joined Mar 31, 2012
30,057
The simplest way (arguable) would be to use a microcontroller. If this is all it is doing, you can use something like an 8-pin PIC. But, of course, you have some costs associated with getting the programmer, downloading the software, and learning how to program a PIC (or whatever you end up using). But these are not difficult and are skills well worth knowing.
 
Top