Raise your driver's PWM prescaler to kill the whine, and you might quietly double how hot the board runs. This piece breaks down the two switching modes hiding behind that one register, and how to pick on purpose.
CALIBRATION

You kill the coil whine by cranking your driver's PWM frequency, and it works. Most builders stop right there, prescaler set, whine gone, job done. Except the driver runs warmer than it did before, at the same duty cycle and the same current, and "quieter" doesn't explain where that heat came from. That's because raising the prescaler on Timer1 or Timer2 doesn't just change a number. It can silently swap you from Phase Correct mode to Fast PWM mode, and those two modes cost you differently. Here's what actually changes at 31.25 kHz versus 62.5 kHz, and how to pick instead of stumbling into it.
If switching loss and duty cycle still feel like fuzzy terms, motor driver heat and current basics covers the ground this post builds on.
Same Prescaler, Two Different Modes
On a 16 MHz ATmega328 (the Uno and Nano-class boards most line follower firmware runs on), setting Timer1 or Timer2's prescaler bits to 1 gives no clock division at all. What frequency that actually produces depends on a register most tutorials skip: the Waveform Generation Mode, or WGM.
The Arduino core's stock analogWrite() runs Timer1 and Timer2 in Phase Correct mode by default. That mode counts up to 255, then back down to 0, so one full cycle takes twice as long as a straight count-up would. At prescaler 1, that's 16,000,000 ÷ (2 × 256), or 31.25 kHz.
Fast PWM counts up to 255 and snaps straight back to 0, no descent. Same prescaler, same 8-bit resolution, but the cycle is half as long: 16,000,000 ÷ 256, or 62.5 kHz. Get to 62.5 kHz and you didn't just raise a number. You changed the WGM bits too, whether you meant to or not. Call it the mode trap: two builders can set the identical prescaler value and land on two different frequencies, because the mode bit next to it decided which one they got. The ATmega328P documentation lays out both modes side by side in the Timer/Counter section, worth the read once.
Resolution doesn't move between the two. Both modes still count across the same 256 steps, so you're not trading duty-cycle precision for frequency here. What you're trading is heat and edge shape, which the next two sections cover.
Neither number produces a whine you can hear, which matters more than it sounds like.
Neither One Whines
Most people can't hear much past 20 kHz. The stock Arduino PWM rate, around 490 Hz to 976 Hz depending on the pin, sits well inside hearing range, which is exactly why it whines through motor windings. Both 31.25 kHz and 62.5 kHz clear that bar by a wide margin. There's no audible difference to chase between them.
If silence was your whole reason for raising the frequency, you already won before you picked a mode. The real difference between 31.25 kHz and 62.5 kHz shows up somewhere your ears can't check: in the driver itself, and in the current waveform hitting your motor.
The Switching Loss You Just Doubled
Every time a MOSFET in your driver flips on or off, it spends a few dozen nanoseconds with both voltage and current present at once, and that overlap burns power as heat. Think of it as a toll booth: each switching event pays a fixed toll, and the toll doesn't change with frequency. What changes is how often you drive through. Switching loss scales linearly with frequency, so doubling it roughly doubles the heat the driver's MOSFETs dump for the exact same motor current and voltage.
Move from 31.25 kHz to 62.5 kHz and you've doubled the toll traffic for the same trip. On small hobby drivers with no heatsink, that shows up as a board that runs noticeably warmer at idle-adjacent duty cycles, not as a faster or smoother bot. You paid for nothing you asked for.
Edge-Aligned vs Center-Aligned
Fast PWM is edge-aligned: it counts one direction and snaps back, so every pulse starts at the same instant in the cycle. Phase Correct is center-aligned: because it counts up and down symmetrically, the pulse sits centered in the middle of the period instead of jammed against one edge.
That symmetry is why Phase Correct is the traditional default for motor control and H-bridge driving (a circuit that flips current direction through the motor using two switch pairs). Symmetric switching means both halves of the bridge transition in a matched, predictable way, which keeps current ripple lower and cuts the harmonic content an asymmetric edge throws into your wiring. N20-class motors have low winding inductance, so they respond fast to every edge. That makes edge symmetry matter more here than it would on a bigger, higher-inductance motor that naturally smooths the ripple out on its own.
An asymmetric edge on a low-inductance motor doesn't just add noise on a spectrum analyzer you don't own. It shows up as a slightly rougher current draw at the same average speed, which on a line follower reads as extra jitter in your sensor readings the moment the motor current spikes. You won't always catch it by eye. You'll catch it as a corner that scatters slightly more than it should, for no reason your PID tuning explains.
Which One Actually Fits Your Bot
For most line follower work at N20 current levels, 31.25 kHz Phase Correct is the boring, correct default. Half the switching loss, symmetric edges, and already silent. Reach for 62.5 kHz Fast PWM only if you've measured real current ripple you need to shave down and your driver's datasheet confirms it has thermal headroom for double the switching loss. Check the driver IC's own rated maximum switching frequency before you push it there. It isn't a spec Techgeeks publishes for you to guess at.
Check It Tonight
You don't need a scope for this. Set your firmware to 31.25 kHz, run one motor at a fixed 50 percent duty cycle against light resistance (wheel touching the desk, chassis lifted) for 60 seconds, then feel the driver IC. Repeat at 62.5 kHz, same duty cycle, same load, same 60 seconds. The Fast PWM run should read noticeably warmer to the touch. That's the switching loss showing up exactly where the math said it would.
Watch the driver while you do this. A minute of resistance-loaded current will heat the IC faster than free-spinning ever does, so stop the test the moment it gets too hot to hold a finger on.
Got a scope on hand instead? Put it on the motor terminal and look at the edges directly. Fast PWM shows a flat top that cuts off square. Phase Correct shows the pulse sitting centered with a slightly rounded, symmetric rise and fall. You're looking at the same thing the touch test measured indirectly, just faster to confirm.
Conclusion
The frequency was never the setting worth obsessing over. The mode underneath it was. Same prescaler, two different waveforms, and the one you land on decides how much heat your driver eats and how clean your current looks on a motor that reacts to every edge. Neither one buys you quiet you didn't already have.
Which one is your firmware actually running right now, and did you choose it, or did the library choose it for you?
Open the Mark 2 LFR Code and check what your Timer1 registers are actually set to. Then tell the Community what you find.
Done reading? Return to the field notes index or keep exploring TechGeeks robotics parts.


