Trying to use arduino for first time to control the speed of a motor. The speed controller being used needs a PWM input with a frequency of 10-25 kHz. Will an arduino mega be able to accomplish that? If not, what could?
Is that max. frequency input. I think then PWM base frequency has to be 1/256th of that. Post a link to the speed controller. Leo..
Will an arduino mega be able to accomplish that?
Yes but the controller will not use the PWM frequency to determine the speed of the motor it will use the PWM duty cycle.
I always find this somewhat confusing.
A motor driver or CC LED driver states a max input frequency of say 25Khz.
Default ~500hz PWM has ~8u sec steps (~2000u/256).
A “value 1” PWM signal has half the sinewave of a 125khz frequency.
That drops to <=25khz if you write value 5 or more to the PWM pin.
So if you use default PWM, and only write “0 or 5-250 or 255” to the pin, it should stay under 25khz.
Maybe those drivers need to specify a minimum pulse duration. e.g 40usec.
Well, the PWM out is not a sine wave, it is (may we call it ) a square wave.
So, I can't see any association to the specs, and what the PWM provides. Probably will have to test it, and I suspect 94% of them will work just fine. Just my thoughts.
You are confusing the frequency of the PWM with the duration of the pulse. The frequency is the whole cycle. The reciprocal of twice the pulse duration is not a very useful concept in this situation.
I think I understand PWM and pulse duration very well, and therefor I asked the question. With 8-bit PWM (if OP wants that granularity), and a base frequency of ~20Khz, you quickly run into the problem of very short pulse durations. Each step is ~200nsec. Difficult or impossible for motor driver hardware. But let's wait for the link to the driver. Leo..
here is the link requested for the "speed controller" in question, in reality it will be run in current mode but the control is the only part I'm worried about (pwm).
its by advanced motion controls, part# AZBDC60A8
You will see that the motor speed is controlled by the PWM duration not by the frequency. That PWM has to be in the range of 10KHz to 25KHz at a fixed frequency. So all you need to do is to alter the frequency of the PWM pin you want to use. Google :- Arduino PWM frequency For how to do this.