Arduino analogWrite PWM Frequency Too Low
DodaTech
Updated 2026-06-26
1 min read
In this tutorial, you'll learn about Arduino analogWrite PWM Frequency Too Low. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
The Problem
The PWM frequency from analogWrite is too low for the application.
Quick Fix
Wrong
analogWrite(9, 128); // Default ~490 Hz PWM
Motor hums or LED flickers at 490 Hz.
Right
// Change Timer1 PWM frequency on pin 9,10
void setup() {
pinMode(9, OUTPUT);
// Set Timer1 to fast PWM, prescaler 8
TCCR1B = (TCCR1B & 0xF8) | 0x02; // ~3.9 kHz on pin 9,10
analogWrite(9, 128);
}
PWM output at ~3.9 kHz — no audible hum.
Prevention
Default PWM frequency of 490/980 Hz is audible in motors. Increase the frequency by reducing the timer prescaler. Higher frequency reduces torque on motors — adjust accordingly. Use libraries like TimerOne for easy frequency control.
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
FAQ
← Previous
How to Fix Aqua Security Scanner / Image Scan Failure
Next →
Arduino analogWrite Value Out of Range
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro