PWM frequency change

Hello !

I am using a geared DC motor and control its speed changing the PWM duty cycle values of pin D11 which is associated in Timer0 which has frequency of 976Hz, but the motor is loud (not only gears sound but also when i apply low value of PWM), so my question is :

if i change the Timer frequency to 62KHz for example, will that make the geared motor quieter ? and if i change the frequency, how can i use the AnalogWrite() function which uses the same Timer ?

thanks in advance !

if i change the Timer frequency to 62KHz for example, will that make the geared motor quieter ?

There is only one way to KNOW. Try it. You won't hurt the Arduino.

and if i change the frequency, how can i use the AnalogWrite() function which uses the same Timer ?

If you change the timer from Tick.......Tock.........Tick.........Tock, to TickTockTickTock, why would that have any bearing on how analogWrite() turns the pin on after so many ticks and off after so many more ticks?

Increasing the frequency above 20 kHz may silence the motor whining (for all but youths and dogs). But, some motors, transistors, or motor driver chips are unable to switch on and off that quickly.

You'll need to experiment to select the correct frequency for your particular motor.

analogWrite() works if you just change the prescaler.

If you need to change the timer WGM to get more precise control over frequency, you may have problems with analogWrite(), since it caps the input at 255.