# Motor whines or hums with analogWrite: Arduino PWM frequency

> Why a motor whines on Arduino analogWrite PWM and how to change the frequency: Uno default 490 Hz and 980 Hz, timers and driver limits.

Canonical: https://roboticsengineering.in/fix/arduino-pwm-motor-whine-frequency/ | Published: 2026-11-03 | Updated: 2026-11-04

**Low PWM frequency makes small motors whine because you can hear it.** The Arduino Uno gives about 490 Hz on most PWM pins and about 980 Hz on pins 5 and 6.

## What the message means

The motor coil and the driver switch at the PWM frequency. In the audio range this is heard as a hum or whine, and low frequencies also make the motor run less smoothly at low speed.

## Fix it in this order

1. Note which pin you use. On an Uno, pins 5 and 6 run near 980 Hz and the others near 490 Hz.
2. Raise the frequency by changing the timer prescaler, or use a library made for your board. Changing a timer can disturb millis(), delay() and Servo on that timer.
3. Check the driver datasheet for its maximum PWM frequency, and stay below it.
4. On an ESP32 set the frequency in ledcSetup or ledcAttach; frequencies above the audible range are easy there.
5. Add a small capacitor across the motor terminals if the noise is electrical rather than acoustic.

## Why it happens

The default analogWrite() frequency on an Uno is about 490 Hz on pins 3, 9, 10 and 11 and about 980 Hz on pins 5 and 6. That is in the audible range, so the motor whines. A higher PWM frequency moves the sound above hearing.

On pins 9 and 10 (Timer 1) you can raise the frequency to about 31 kHz with one line in setup(). Do not change Timer 0, because millis() and delay() depend on it. Check that your motor driver accepts the higher frequency.

```
void setup() {
  TCCR1B = (TCCR1B & 0xF8) | 0x01;   // Timer 1 prescaler 1: about 31 kHz on pins 9 and 10 (Uno)
}
```

Example sketch: change pins and values for your own wiring. It has not been bench-tested on your hardware.

## If you see this, do this

| You see | Do this |
| --- | --- |
| Whine at low speed only | Raise the PWM frequency. |
| Servo or delay() breaks after timer change | You changed the timer they use. |

## Related

[Arduino Uno pinout for robotics](https://roboticsengineering.in/arduino-uno-pinout-for-robotics/), [motor runs one direction](https://roboticsengineering.in/fix/dc-motor-only-runs-one-direction/).

Last reviewed: November 2026. These are the usual causes and the order that finds them fastest. Test on your own board; clones and cables differ.

## Why this happens

The Uno has three timers that generate PWM, and each runs at a different default rate. Timer 0 drives pins 5 and 6 in fast PWM at 16 MHz / 64 / 256, which is 976.6 Hz. Timer 1 (pins 9 and 10) and Timer 2 (pins 3 and 11) run phase-correct PWM at 16 MHz / 64 / 510, which is 490.2 Hz. Both rates sit inside the range the ear hears best.

A motor winding is an inductor, and the pulse train makes the windings and the frame vibrate at the switching frequency. Raising the frequency above about 20 kHz moves the sound out of hearing. Higher frequency also gives a smoother current, but the driver switches more often and loses more energy in each switch, so the driver’s maximum PWM frequency is the real limit.

## How to confirm the cause

- Swap the motor’s PWM wire from a 490 Hz pin (such as 9) to a 980 Hz pin (such as 6) and listen. The pitch should rise by about an octave. That proves the whine follows the PWM frequency.
- Run the motor at different duty values. A whine that is loudest at low duty and fades at high duty is typical of PWM noise.
- If you have an oscilloscope, probe the PWM pin and read the period. Frequency is 1 divided by the period, so 2.04 ms means about 490 Hz.
- Check the driver datasheet for its maximum input frequency before you raise it.
- If the noise stays when the motor spins freely with the PWM held at 100 percent, it is not PWM noise. Look at brush noise or a mechanical fault.

## Worked example

Setting the Timer 1 prescaler to 1 changes the rate to 16 MHz / 1 / 510, which is about 31.4 kHz. The line below does it for pins 9 and 10.

```
void setup() {
  pinMode(9, OUTPUT);
  TCCR1B = (TCCR1B & 0xF8) | 0x01;   // Timer 1 prescaler = 1
}
void loop() {
  analogWrite(9, 128);               // about 50 percent duty
}
```

The Servo library also uses Timer 1 on the Uno, so do not combine this change with servos on the same board.

## Common mistakes

- Changing Timer 0, which breaks millis(), delay() and anything that depends on them.
- Raising the frequency past what the driver supports, so the motor gets weak or the driver runs hot.
- Assuming a quieter motor needs a different value in analogWrite(); the duty value changes speed, not pitch.
- Using this code on an ESP32 or Uno R4, which use different timers and set frequency in a different way.

## If this did not fix it

- Mechanical hum: loose gearbox or mounting, which a PWM change will not cure.
- Electrical noise from brushes: a small capacitor across the motor terminals can help.
- Whine only at start: a low duty value may be too low for the motor to turn, so check the minimum PWM that starts rotation.
