# Arduino PWM frequency change

**URL:** <https://forum.arduino.cc/t/arduino-pwm-frequency-change/1322244>\
**Category:** General Guidance\
**Created:** [November 15, 2024, 12:37pm UTC](https://forum.arduino.cc/t/arduino-pwm-frequency-change/1322244 "2024-11-15T12:37:11Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![DaveX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/davex/32/751443_2.png) [@DaveX](https://forum.arduino.cc/u/DaveX)\
**Post date:** [November 15, 2024, 2:20pm UTC](https://forum.arduino.cc/t/arduino-pwm-frequency-change/1322244/4 "2024-11-15T14:20:09Z")

</div>

I see: `log(8182)/log(2)=12.998` is your 13 bit resolution. And 8182 gets you to `16000000/8182=1956Hz`

> [@5cotor](#):
>
> Also it fluctuates for some reason.

Fluctuates by how much? And how much fluctuation is acceptable?

As per [forum guidelines](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966), please post your full code, a schematic, and which Arduino you are using.

You can make the frequency adjustable by adjusting ICR1. And then set duty cycle as a fraction of ICR1. This is a good reference:

> **[Timers and counters - Gammon Forum](https://www.gammon.com.au/forum/threads/11504.html?id=11504)**

Or there's the excellent [Timer1 library](https://github.com/PaulStoffregen/TimerOne)

---

_[View the full topic](https://forum.arduino.cc/t/arduino-pwm-frequency-change/1322244)._
