Arduino MKR Zero, max RPM 70 rad/sec

I have a general question about the maximum RPMs I should expect on a relatively fast Arduino MKR Zero with an iPower GM3506 Brushless Gimbal Motor with AS5048A sensor with PWM output. Things seem to be working well in all control modes (open loop, position, velocity, torque), as far as I can tell, but the maximum speed we can see is never above 70 rad / sec. Is this a limit of the microcontroller loop() speed? Or is there some fine tuning that might help?

My guess is, the sensor in PWM mode slows down the main loop alot.
Can’t you try SPI mode?

Yeah, for sure call sensor.enableInterrupt so the communication doesn’t block the CPU. But even so, PWM mode is so slow that the angle is out of date by the time the communication finishes. Try running it through SmoothingSensor. I did my best to make it predict the true angle by recording the timestamp at the beginning of the communication pulse, near the time it was actually sampled. But I don’t have the hardware to test it, so it would be good to know how well it actually works :slight_smile:

Great, thanks for the suggestions. We’ll try soldering up the SPI interface on the same encoder and see if it helps.

The specs of the motor claim about 2000rpm but you are getting about 600. Might be worth checking that there aren’t any voltage constraint limiting speed e.g power supply is full 12v and driver.voltage_limit=12v

Gimbals don’t normally go 2000rpm but this gimbal has resistance of 3ohms (compared to 10-25ohms typical for gimbals) so that ‘high speed’ does seem believable.