Arduino Nano gets slow with 6 High Frequency PWM Outputs

Hi there,

so, have a issue with my Nano. I am controlling two brushless motors via 3 PWM Pins per motor. Now, to keep the motors silent I increased the PWM Frequency to the maximum with this code . But now, when I set that Frequency also for the second motor (without doing any code modifications and not even staring to control the second motor, just setting the frequency), the nano slows down massively, making it basically not usable. Unfortunately I can not switch to a bigger arduino for this project.

Is there a way to work around this? All help is welcome.


What do you mean by “the nano slows down” - what happens that is slower?

Post your complete program.

And when posting code please use the code button </>so your code looks like thisand is easy to copy to a text editor See How to use the Forum


With slow I mean that the speed the motor turns slow down from like 200rpm to 1rpm or so (did not meassure the exact speed, just roughly).

Can not post the code here, due to the 9000 character limit.

I notice the huge array with sine wave data. Is that required to run the 3 phase motors?

if(micros() - loop_timer > 4000)

It seems to me you are expecting to be able to do an awful lot of stuff in less than 4 millisecs.

I suggest you measure how long different parts of your code take to execute.


So these are PMAC motors, not BLDC, since you are using sinusoidal drive?

Do you know how to generate proper 3-phase PWM? It needs synchronized timers to 3 PWM signals in sync on the Uno.

Unless your motor has 6 wires rather than 3 for the windings you require proper 3-phase PWM or trapezoidal drive (the same motor would be called BLDC under trapezoidal drive!)

You might want to look at my posting #33 in