# How to generate 3 PWM signals

I have 2560 mega, and I Want to generate 3-phase PWM signal at 62.5khz, synced and shifted 120 degrees apart.

I need that for 3-phase split-coil boost converter (or even isolated flyback converter), with 3 phase transformer coupled inductor. So I dont need sine wave table like here, but actually, a direct square wave PWM output, from 3 synced digital pins, with chosen duty cycle. How can I do that?

• How accurate the phase difference has to be? Is (0°, ±119.53°) good enough? If not, would a frequency of 62.745 kHz be OK? What duty cycle do you want? Apr 29, 2020 at 15:43
• @EdgarBonet Hello. Probably, its better to stick with 2 phase or 4 phase, as it's easier to divide. Oh, and let's omit 2phase case, as it could be solved with h/w inverting (no software phase offset). All I want is a way to set up a phase offset in arduino, and question is about it. Everything other better fits as a topics for ee.se. Consider it is driving a transistors' gates, (no matter what is further), to focus only software question May 2, 2020 at 22:44

• That seems to be nice solution. However, I am not very familiar with low level things of arduino. Can you extend your answer with simple small example, please? It could be as simple as if you given 4 pins: `pin[0,1,2,3]`, and 4 duty cycles: `dc[0,1,2,3]`. Frequency is fixed at 62.5khz (or 31khz, not matters), and pins must provide synced PWM signal, with given dutycycles, and phase offsets of 0, 90, 180 and 270 degrees respectively. Like `for(i=0; i<4; i++) { analogWrite(pin[i], dc[i]); }`, but for synced pins. Can you give such how to sync pins, with fixed phase offsets and frequency?? May 5, 2020 at 5:10