# Phase shift square wave

Is it possible to shift the phase of a square wave (which is generated by an Arduino) with passive components?

I have a 0 to 12V square wave that I would like to split into several phases. The idea is to send the original square wave to load 1, and a 60° shift to load 2, an additional 60° shift to load 3, and so on until I've got 360°.

I also have a 0 to -12 square wave that I would like to apply this to as well.

• fixed or varying frequency? What kind of load(s)? And what are you trying to achieve? Commented Mar 16, 2017 at 12:02
• How much current (power) are we talking about? Are you trying to drive some sort of motor? If you give us some context about your application, you'll probably get better answers. If you are still trying to drive electromagnets, then you'll want to synthesize the phase-shifted signals in your Arduino, and use a separate driver transistor for each one. Commented Mar 16, 2017 at 12:19
• A PLL might be a good starting point Commented Mar 16, 2017 at 12:27
• @MarkoBuršič: In what sense is a PLL a passive component? Commented Mar 16, 2017 at 12:29
• Do you mean delay the square wave?
– Chu
Commented Mar 16, 2017 at 12:35

Use a 6 bit Johnson counter and drive that with a frequency 12x higher than what you want. The counter will generate 6 equally spaced, phase shifted, divided output square waves.

You could use a "Delay-Line" chip, but you still need active components to do the actual switching.

However, you have not stated whether your frequency is fixed or variable, and I suspect the latter is much more likely.

If so, you need to generate the signals from the MICRO individually, possibly with the addition of a multiplexer chip external to the micro if you need more outputs.

• Thank you @Trevor. I apologize. The frequency is currently unknown. It will depend on the placement of the electromagnets and the number of turns in the coil, I'm sure. I don't know how to do the math on that. If successful then a secondary coil should pick up trace voltage. I'll adjust the frequency to the highest trace voltage. A lot of testing to do. moving the electromagnets around, trying different coils, etc. Eventually it will be a fixed frequency, I'm guessing somewhere between 2 and 3 hz. Commented Mar 16, 2017 at 14:20
• @JohnMuggins It rather sounds like whatever this is, you should be integrating some devices or coils or whatever into the mechanism to "FEED-BACK" the position of the moving object to the micro so that it knows when to "COMMUTATE" the coils. Just delaying the signal will not be sufficient for that. Commented Mar 16, 2017 at 14:24
• oh, just ot clarify, a "multiplexer" chip would simply give me more outputs that I can code from the Arduino, correct? Good answer, Trevor. Thank you for the help. Commented Mar 16, 2017 at 14:24
• Yes on the multiplexer... Commented Mar 16, 2017 at 14:25

Rather than shifting a square wave, you could generate a faster square wave and frequency divide it. If you start each divider in a different state, they will have different phases once up and running. Here, you'd likely be best off with a fundamental at 6x the intended frequency, three divide-by-6 circuits to get the 0, 60 and 120 phases, then three not gates to get the other three phases. Be careful to make sure the div6 circuits keep a 50% duty cycle, if that's important for your application. Doing div3 then div2 would probably be a good approach.

It's not based on passives, but it only requires a few fairly basic logic chips. It should work for a very wide range of frequencies, and it will keep the phase angles very accurate.

• That is amazing. I didn't know we have frequency dividers. After briefly researching I see that f-out = f-in/N. At 60° phase shift each time then N should equal to .167? Commented Mar 16, 2017 at 16:44

You can generate adjustable phase shifted square waves using Arduino Uno, Nano or Mega2560 16-bit timers. The phase-shift range is 180 degrees.

The Nano-Uno boards can output only 2 channels (Timer-1) while the Mega2560 can do 3 channels (Timers 1,3,4 and 5).

There's a demo project at Runtime Micro covering parts, diagram and code listing (and video).

BTW, if you set a 2560's timer channels for 0, 60, 120 and add inverters, it might be possible to generate a 6 phase (BLDC motor?) series. I haven't tried it -- just a thought.

full-disclosure: I'm the author of the demo project.

• Thanks Stockvu. At this late date I'm not even sure which project I was working on at the time. I'm sure it had something to do with my simulated electric generator run by pulsed electromagnets. So the reason I needed passive components was to conserve energy. Running several Uno or PI boards won't work. Also running SSR's rquires extra voltage so was trying to avoid them as well. It was an AC system to fire a string of electromagnets in timed order to induce voltage on a secondary winding. Commented Aug 26, 2022 at 16:13