Using Arduino as PWM signal generator for 3 phase inverter


I've been reading up on Arduino's PWM capabilities but I'm still not sure if it can do what I need, so I was wondering if anyone can point me in the right direction?

Basically this is what I'm trying to do: 3 phase inverter requires three logic-level PWM signals applied to the inverter gates. The PWM signals need to be in phase (pulses all start at the same time) with a frequency of around 50kHz (give or take 10kHz). The pulse width for each PWM signal would be individually controlled by a separate control system. The control system outputs 3 0-5V signals (updated every ms) that correspond to 0-100% pulse widths, this would then go into the Arduino board and regulate the generated pulse width. Currently currently I'm generating the PWM signals with an SG3525 IC, but its far from ideal.

From what I've read it's possible to output 3 PWM signals simultaneously at up to 32kHz using the analogwrite function. What I'm not sure of is if there is any way to increase the frequency (perhaps by using the Due board?), can the all PWM signals be in phase at that frequency and how difficult is it to use an external voltage signal to adjust the pulse width?

Many thanks for any assistance!


I need the same software as you. did you finde any help topics ? If yes would you please post it

Thanks in advance

an analogWrite takes a lot of time, you need to byass the wiring libraries and then You will definitely be able to reach speeds nearby 40khz as analogWrite as mentioned puts out 32Khz frequency PWM signals with analogWrite().

Hi I would like to make it with Arduino DUE. Do you have any codes or topics for it ?

I can now make 3 PWM signals with different duty cycle and frequency.

void setup() {

// PWM Pulsbreite eingeben uint32_t pwm_duty_u= 0.75*65536;//2^16 =65536 also maximaler Wert fuer duty cycle ist 65536-1 uint32_t pwm_duty_v= 0.75*65536; uint32_t pwm_duty_w= 0.75*65536;

// PWM Frequenz in HZ eingeben

uint32_t pwm_freq1 = 10000;

//PWM Auflösung


//Hardware Ausgabe

pwm_setup( 7, pwm_freq1, 2); //pwm_setup (pin,freq,iclock 2 ist Clock B) pwm_setup( 8, pwm_freq1, 2); pwm_setup( 9, pwm_freq1, 2);

pwm_write_duty( 7, pwm_duty_u ); // pin, duty_cycle_pro_phase pwm_write_duty( 8, pwm_duty_v ); pwm_write_duty( 9, pwm_duty_w );

// Verzögerung in uS


// PWM Stop

// pwm_stop( 7 ); //pwm_stop( 8 ); //pwm_stop( 9 );


void loop() { }

how can I mask my PWM to a sine wave and how can I make the three sine waves 120 degree phase shifted to each other

Hi, nice project. I just ordered a new arduino due to start a similar project, where i need 3phase sine pwm. I will definetely try your first few lines as a start up. Have you done any further progress regarding the sine generation? I assume that at one point you will need to look at a sine table for generation of the waveform. If you have three separat tables with the phase shift already considered, you should be able to see the 120 degree at the output.

Hi Bejamin

Well im still working on the the same project if you have any questions or any progress lease let me know