Chage phase of a square wave

Discussion in 'General Electronics Chat' started by wildarms, Aug 2, 2013.

  1. wildarms

    Thread Starter New Member

    Aug 2, 2013
    6
    0
    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: Aug 2, 2013
  2. BillB3857

    Senior Member

    Feb 28, 2009
    2,400
    348
    You might try this circuit........
     
  3. wildarms

    Thread Starter New Member

    Aug 2, 2013
    6
    0
    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!
     
  4. BillB3857

    Senior Member

    Feb 28, 2009
    2,400
    348
    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: Aug 2, 2013
    wildarms likes this.
  5. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    656
    Same circuit, but it's a little easier to see the phases in the attached drawing.

    The circuit is called a Johnson counter.
     
    wildarms likes this.
  6. LDC3

    Active Member

    Apr 27, 2013
    920
    160
    wildarms likes this.
  7. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    656
    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.
     
  8. LDC3

    Active Member

    Apr 27, 2013
    920
    160
    I put together a circuit that will give you the 3 phases on the 3 outputs.
     
  9. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    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.
     
  10. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    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?
     
  11. wildarms

    Thread Starter New Member

    Aug 2, 2013
    6
    0
    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: Aug 2, 2013
  12. LDC3

    Active Member

    Apr 27, 2013
    920
    160
    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.
     
    wildarms likes this.
  13. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    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.
     
  14. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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.
     
  15. LDC3

    Active Member

    Apr 27, 2013
    920
    160
    Because I'm slow and I didn't think about optimizing the circuit. ;)
     
  16. wildarms

    Thread Starter New Member

    Aug 2, 2013
    6
    0
    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: Aug 3, 2013
  17. LDC3

    Active Member

    Apr 27, 2013
    920
    160
    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).
     
  18. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    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.
     
  19. wildarms

    Thread Starter New Member

    Aug 2, 2013
    6
    0
    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.
     
  20. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    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.
     
Loading...