I am using 4500 RPM motor.To be specific,this is the motor I am using https://www.robomart.com/4500-rpm-high-torque-dc-motor. I am using Cytron MD10C motor driver to drive it.The PWM source is Raspberry pi.What is the range of frequency for PWM that I can use for this setup? Both the motor driver and the motor gets heated when a little amount of load is given.I have tried 50 to 300 Hz.
For highest efficiency and lowest vibration the motor wants a high PWM frequency. However for lowest switching losses the controller wants a low frequency. Therefore the 'best' PWM frequency is often a compromise.
The motor has inductance which opposes current variations. At very low frequencies it has little effect so the motor current follows the PWM voltage. This causes extra heating in the motor because the rms (heating) current is higher than the average (torque) current. As PWM frequency is increased the current has less time to increase and decrease, so rms current approaches average current and the motor runs cooler.
Below are some oscilloscope traces of a small brushed DC motor at different PWM frequencies (upper trace in each image is voltage, lower trace is current). At 50Hz the PWM current follows the voltage, so the peak current is twice the average current and loss in the motor's internal resistance is doubled compared to constant DC. At 500Hz the current rise and fall is exponential, but still peaks at twice the average current and drops to zero between PWM pulses. At 1KHz it is continuous but with large variations.
At 3KHz the ripple is finally flattening out enough to get the rms current close to the average current. Motor efficiency is now not much worse than it would be on pure DC. However, switching spikes (which increase controller heating) are starting to become apparent.
You have an iron-cored motor with relatively high inductance. Most iron-cored motors need at least 2-3KHz to get reasonably smooth PWM current (coreless motors have much less inductance, so they need 20-30Khz or higher). The motor may also produce audible noise at the PWM frequency which can be annoying, so a frequency which is outside human hearing range is often desirable. The MD10C is rated for up to 20Khz so I would start at that frequency, and only consider reducing it if the controller runs too hot.