<?xml version="1.0" encoding="UTF-8"?>        <rss version="2.0"
             xmlns:atom="http://www.w3.org/2005/Atom"
             xmlns:dc="http://purl.org/dc/elements/1.1/"
             xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
             xmlns:admin="http://webns.net/mvcb/"
             xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
             xmlns:content="http://purl.org/rss/1.0/modules/content/">
        <channel>
            <title>
									What exactly is PWM resolution ? - Hardware/Schematic				            </title>
            <link>https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/</link>
            <description>Hi,
Welcome to the eTechnophiles forum. 
Got a question like, \&#039;What resistor value to choose for your simple LED project\&#039; OR \&#039;Where is the resistor connected to the inbuilt LED in Arduino UNO\&#039;s schematic\&#039; - All will be answered here. 
Feel free to check out the topics below.</description>
            <language>en-US</language>
            <lastBuildDate>Sun, 12 Apr 2026 14:08:30 +0000</lastBuildDate>
            <generator>wpForo</generator>
            <ttl>60</ttl>
							                    <item>
                        <title>RE: What exactly is PWM resolution ?</title>
                        <link>https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-344</link>
                        <pubDate>Sat, 08 Feb 2025 06:43:29 +0000</pubDate>
                        <description><![CDATA[@FullBridgeRectifier Thanks for clarifying this. To summarize, there’s a subtle but important distinction here between “how many counts the hardware timer cycles through” (which is indeed 2^...]]></description>
                        <content:encoded><![CDATA[@FullBridgeRectifier Thanks for clarifying this. To summarize, there’s a subtle but important distinction here between “how many counts the hardware timer cycles through” (which is indeed 2^n counts) versus “how you usually compute the duty‑cycle fraction” (which typically uses 2^n − 1 in the denominator so that the maximum register value maps to 100 %). I have edited my answer and added the explanation for this as well.]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/hardware-arduino/">Hardware/Schematic</category>                        <dc:creator>Admin</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-344</guid>
                    </item>
				                    <item>
                        <title>Answer to: What exactly is PWM resolution ?</title>
                        <link>https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-218</link>
                        <pubDate>Wed, 20 Nov 2024 05:09:07 +0000</pubDate>
                        <description><![CDATA[To put this PWM resolution concept into a practical context: If you’re dimming an LED with an Arduino UNO’s 8-bit PWM, you might see noticeable brightness steps when changing the duty cycle....]]></description>
                        <content:encoded><![CDATA[<p>To put this PWM resolution concept into a practical context: If you’re dimming an LED with an Arduino UNO’s <strong>8-bit PWM</strong>, you might see noticeable brightness steps when changing the duty cycle. This is because each step is about <strong>0.4%</strong> of the total brightness.</p>
<p>With the ESP32’s <strong>16-bit PWM</strong>, each step is only <strong>0.0015%</strong>, so the LED brightness change is much smoother and almost imperceptible. This is crucial if you’re working on projects that require precise control, like <strong>mood lighting</strong> or <strong>audio signal modulation</strong>.</p>
<p>But keep in mind, that the lower frequency at higher resolutions might introduce visible flicker in LEDs, so you’ll need to find a balance between resolution and frequency depending on your application.</p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/hardware-arduino/">Hardware/Schematic</category>                        <dc:creator>catElectronics</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-218</guid>
                    </item>
				                    <item>
                        <title>RE: What exactly is PWM resolution ?</title>
                        <link>https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-210</link>
                        <pubDate>Thu, 14 Nov 2024 05:35:52 +0000</pubDate>
                        <description><![CDATA[Good point by @FullBridgeRectifier . Just to clarify for anyone new to this: when we say “divide by 255 instead of 256,” it’s because we’re looking at the maximum value the PWM can take, not...]]></description>
                        <content:encoded><![CDATA[Good point by @FullBridgeRectifier . Just to clarify for anyone new to this: when we say “divide by 255 instead of 256,” it’s because we’re looking at the maximum value the PWM can take, not the total count of values. 
This way, your duty cycle calculations always correctly reach 100%.]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/hardware-arduino/">Hardware/Schematic</category>                        <dc:creator>Sebastian</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-210</guid>
                    </item>
				                    <item>
                        <title>RE: What exactly is PWM resolution ?</title>
                        <link>https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-183</link>
                        <pubDate>Wed, 23 Oct 2024 07:05:50 +0000</pubDate>
                        <description><![CDATA[@ankunegi The answer is on point but I think there&#039;s a mistake in your calculation. To calculate the duty cycle, we have to divide it by 255(the maximum value) and not 256(The total no. of s...]]></description>
                        <content:encoded><![CDATA[@ankunegi The answer is on point but I think there's a mistake in your calculation. To calculate the duty cycle, we have to divide it by 255(the maximum value) and not 256(The total no. of steps). 
For example: A 2-bit PWM signal has 4 possible steps: 0,1,2 and 3 corresponding to 0%, 33.33%, 66.67% and 100% duty cycle. You get this by dividing by 3, not 4. If you divide it by 4, you will get 25%. Which means 0%, 25%, 50% and 75%. See, you are not getting 100% duty cycle in this case.]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/hardware-arduino/">Hardware/Schematic</category>                        <dc:creator>FullBridgeRectifier</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-183</guid>
                    </item>
				                    <item>
                        <title>RE: What exactly is PWM resolution ?</title>
                        <link>https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-66</link>
                        <pubDate>Tue, 16 Jul 2024 05:10:43 +0000</pubDate>
                        <description><![CDATA[The microcontroller uses a timer to generate the PWM signal. The timer counts up from 0 to a maximum value. When it reaches the maximum, it resets to 0 and starts counting again. The duty cy...]]></description>
                        <content:encoded><![CDATA[The microcontroller uses a timer to generate the PWM signal. The timer counts up from 0 to a maximum value. When it reaches the maximum, it resets to 0 and starts counting again. The duty cycle is determined by the value at which the timer output switches from low to high.

For 8-bit resolution (UNO): The timer counts from 0 to 255. To achieve the maximum PWM frequency, the timer should overflow as quickly as possible. So, the maximum PWM frequency is the clock frequency divided by the maximum count: 16 MHz / 256 = 62.5 kHz.
For 16-bit resolution (ESP32): The timer counts from 0 to 65,535. Using the same logic, the maximum PWM frequency is 16 MHz / 65,536 = 244 Hz.
In essence, higher resolution requires the timer to count to a larger number before overflowing, which takes more time. This directly limits the maximum possible PWM frequency.]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/hardware-arduino/">Hardware/Schematic</category>                        <dc:creator>Admin</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-66</guid>
                    </item>
				                    <item>
                        <title>RE: What exactly is PWM resolution ?</title>
                        <link>https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-63</link>
                        <pubDate>Sat, 13 Jul 2024 03:54:05 +0000</pubDate>
                        <description><![CDATA[@ankunegi Thank you for explaining in detail. Although I don&#039;t really get the last part: &quot;The maximum possible PWM frequency&quot; section.]]></description>
                        <content:encoded><![CDATA[@ankunegi Thank you for explaining in detail. Although I don't really get the last part: "The maximum possible PWM frequency" section.]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/hardware-arduino/">Hardware/Schematic</category>                        <dc:creator>Divyam</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-63</guid>
                    </item>
				                    <item>
                        <title>Answer to: What exactly is PWM resolution ?</title>
                        <link>https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-52</link>
                        <pubDate>Sat, 06 Jul 2024 06:49:14 +0000</pubDate>
                        <description><![CDATA[Hey,
Note: UNO R3 supports 8-bit PWM resolution, not 10. 
Higher resolution means the PWM output can be more finely tuned, resulting in a smoother signal. This is particularly important in...]]></description>
                        <content:encoded><![CDATA[<p>Hey,</p>
<p>Note: UNO R3 supports 8-bit PWM resolution, not 10. </p>
<p>Higher resolution means the PWM output can be more finely tuned, resulting in a smoother signal. This is particularly important in applications like motor control, LED dimming, and audio signal generation.</p>
<p>8-bit resolution means there are 256 possible duty cycle values (from 0 to 255). That's why the analogWrite(PWM pin, PWM value) takes values bw 0 and 255.  In this case, increasing the duty cycle step by step corresponds to a change of approximately 0.4% (1/256) of the full-scale value.</p>
<p>Whereas the 16-bit resolution means there are 65,536 possible duty cycle values (from 0 to 65,535).<br />Each step in the duty cycle corresponds to a change of approximately 0.0015% (1/65,536) of the full-scale value.</p>
<p>As much as the resolution is important, so does the frequency of the PWM signal. The increase in PWM resolution decreases the maximum PWM frequency possible for the same clock frequency.</p>
<p>if UNO and ESP32 have the same clock frequency i.e., 16 MHZ. The maximum possible PWM frequency(16-bit) for ESP32 will only be 244 Hz. Whereas for UNO(8-bit), it is 62.5 KHz. </p>
<p>For example, </p>
<pre contenteditable="false">16 MHz / 256 and 16 MHz / 65,536.</pre>
<p><span style="font-size: 14pt"><strong>EDIT:</strong></span></p>
<p>Hey everyone! Let’s clear up the confusion regarding PWM resolution and the difference between dividing by <span class="katex"><span class="katex-mathml">2^n</span></span> versus <span class="katex"><span class="katex-mathml">2^n - 1</span></span></p>
<p><strong>The Hardware Timer Perspective</strong></p>
<p>In <em>fast PWM</em> mode, the timer counts from 0 up to a “TOP” value and then overflows back to 0.</p>
<ul>
<li>For <strong>8-bit PWM</strong>, TOP = 255. This gives you a counter range of 0–255 = 256 distinct counts.</li>
<li>For <strong>2-bit PWM</strong>, TOP = 3. This gives you a counter range of 0–3 = 4 distinct counts.</li>
</ul>
<p>Thus, in terms of raw timer ticks, there are <span class="katex"><span class="katex-mathml">2^n</span></span> counts per cycle.</p>
<p><strong>The Duty Cycle Perspective</strong></p>
<p>When calculating duty cycle, we typically use:</p>
<pre contenteditable="false">Duty Cycle (%)= (Compare Register Value/TOP) ×100.</pre>
<ul>
<li>For 8-bit PWM, you divide by 255 (TOP = 255), so the highest compare value <strong>255</strong> yields 100 % duty cycle.</li>
<li>For 2-bit PWM, you divide by 3 (TOP = 3), so a compare value of <strong>3</strong> yields 100 % duty cycle.</li>
</ul>
<p>If you were to divide by <span class="katex"><span class="katex-mathml">2^n</span></span> directly (e.g., 256 for 8-bit), the maximum compare value (255) would give (255/256)x 100 =~ 99.6% which <em>technically</em> matches clock ticks but doesn’t align with the usual definition of 100 % on hardware PWM outputs.</p>
<p><strong>Why It Matters</strong></p>
<ul>
<li><strong>0 % duty cycle:</strong> Compare Register = 0.</li>
<li><strong>100 % duty cycle:</strong> Compare Register = TOP (which is <span class="katex"><span class="katex-mathml">2^n - </span><span class="katex-html" aria-hidden="true"><span class="base"><span class="mord">1</span></span></span></span>).</li>
<li>Users generally expect that the maximum compare setting translates to the output being <em>fully ON</em> (i.e., 100 %).</li>
</ul>
<p><strong>Summary</strong></p>
<ol>
<li>The timer truly counts <span class="katex"><span class="katex-mathml">2^n</span></span> steps (from 0 to <span class="katex"><span class="katex-mathml">2^</span><span class="katex-html" aria-hidden="true"><span class="base"><span class="mord"><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist"><span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">n</span></span></span></span></span></span></span></span><span class="mspace"></span><span class="mbin">−</span><span class="mspace"></span></span><span class="base"><span class="strut"></span><span class="mord">1</span></span></span></span>).</li>
<li>However, to get a duty cycle percentage from 0 % to 100 %, you divide the compare value by <span class="katex"><span class="katex-mathml">2^n - 1</span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut"></span><span class="mspace"></span><span class="mspace"></span></span><span class="base"><span class="strut"></span></span></span></span>.</li>
<li>That’s why for 8-bit PWM, you’ll see many references to dividing by <strong>255</strong>, not 256.</li>
</ol>
<p> </p>
<p> </p>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/hardware-arduino/">Hardware/Schematic</category>                        <dc:creator>Admin</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-52</guid>
                    </item>
				                    <item>
                        <title>What exactly is PWM resolution ?</title>
                        <link>https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-50</link>
                        <pubDate>Tue, 02 Jul 2024 06:02:38 +0000</pubDate>
                        <description><![CDATA[Hey there everyone,
I&#039;ve been reading up on PWM and came across something I&#039;m a bit confused about. What exactly is PWM resolution?
I noticed that the UNO R3 has a PWM resolution of 10 bit...]]></description>
                        <content:encoded><![CDATA[<div class="flex flex-grow flex-col max-w-full">
<div class="min-h- text-message flex flex-col items-start whitespace-pre-wrap break-words :mt-5 juice:w-full juice:items-end overflow-x-auto gap-2" dir="auto" data-message-author-role="assistant" data-message-id="5a1924e6-5fdd-4210-87ab-0d7499b98e79">
<div class="flex w-full flex-col gap-1 juice:empty:hidden juice:first:pt-">
<div class="markdown prose w-full break-words dark:prose-invert light">
<p>Hey there everyone,</p>
<p>I've been reading up on PWM and came across something I'm a bit confused about. What exactly is PWM resolution?</p>
<p>I noticed that the UNO R3 has a PWM resolution of 10 bits, whereas the ESP32 has a 16-bit PWM resolution. I understand that more bits mean a more accurate dummy DAC signal, but how exactly does this work? Can someone explain the details behind PWM resolution and how it affects the signal quality?</p>
<p>Thanks in advance!</p>
</div>
</div>
</div>
</div>]]></content:encoded>
						                            <category domain="https://forum.etechnophiles.com/hardware-arduino/">Hardware/Schematic</category>                        <dc:creator>Divyam</dc:creator>
                        <guid isPermaLink="true">https://forum.etechnophiles.com/hardware-arduino/what-exactly-is-pwm-resolution/#post-50</guid>
                    </item>
							        </channel>
        </rss>
		