<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Low-Power Embedded Design Archives | DMC, Inc.</title>
	<atom:link href="https://static.dmcinfo.com/blog/category/embedded-development-programming/low-power-embedded-design/feed/index.xml" rel="self" type="application/rss+xml" />
	<link></link>
	<description></description>
	<lastBuildDate>Thu, 20 Aug 2026 16:30:00 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.2</generator>

<image>
	<url>https://static.dmcinfo.com/wp-content/uploads/2025/04/site-icon-150x150.png</url>
	<title>Low-Power Embedded Design Archives | DMC, Inc.</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Power Profiling Embedded Systems: Tools, Techniques, and Real-World Results</title>
		<link>https://static.dmcinfo.com/blog/42943/power-profiling-embedded-systems/</link>
		
		<dc:creator><![CDATA[Thomas Panek Gonzalez]]></dc:creator>
		<pubDate>Tue, 14 Apr 2026 19:53:37 +0000</pubDate>
				<category><![CDATA[Embedded Development & Programming]]></category>
		<category><![CDATA[Low-Power Embedded Design]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/?p=42943</guid>

					<description><![CDATA[<p>Batteries have brought us into a cordless era, from electric vehicles with 75KWh batteries to handheld devices powered by 0.66Wh coin cells. Regardless of the use case (hand warmers aside), the customer wants the most efficient system, thus the longest battery life. To improve battery life, designers need to understand where power is being consumed [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/42943/power-profiling-embedded-systems/">Power Profiling Embedded Systems: Tools, Techniques, and Real-World Results</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Batteries have brought us into a cordless era, from <a href="https://static.dmcinfo.com/industries/automotive/">electric vehicles with 75KWh batteries</a> to <a href="https://static.dmcinfo.com/our-work/category/industry/consumer-goods/">handheld devices</a> powered by 0.66Wh coin cells. Regardless of the use case (hand warmers aside), the customer wants the most efficient system, thus the longest battery life. To improve battery life, designers need to understand where power is being consumed so they can reduce it. One of the best ways to do that is to measure current over time with a power profiler.</p>



<h2 id="h-what-is-a-power-profiler" class="wp-block-heading">What Is a Power Profiler?</h2>



<p class="wp-block-paragraph">A power profiler precisely measures the power a device consumes over a given period of time. Often, a graph is generated with the data so one can examine consistency and anomalies. Typically, the power profiler supplies power to the device, so all power flows through the profiler, enabling better measurement. In contrast, one would need to place a digital multimeter (DMM) in line with the device to measure current, and have the voltage measured with a separate instrument. An engineer would then use this data to observe how changes in hardware and software are affecting the device’s power consumption.</p>



<h2 id="h-devices-used" class="wp-block-heading">Devices Used</h2>



<p class="wp-block-paragraph">We typically use two main power profilers when working on low-power Embedded systems:</p>



<ul class="wp-block-list">
<li><a href="https://www.nordicsemi.com/Products/Development-hardware/Power-Profiler-Kit-2" target="_blank" rel="noreferrer noopener">Nordic Power Profiler Kit II</a>. It is usually referred to as PPK2 (Power Profiler Kit 2) and is a USB device that plugs into a computer and uses Nordic’s software to view the power characteristics of the device in question.</li>



<li><a href="https://www.qoitech.com/otii-ace/" target="_blank" rel="noreferrer noopener">Qoitech Otii Ace Pro</a>. The Otii does the same thing as the PPK2, though with a more comprehensive feature set. It offers a wider range of voltage and current, better read resolutions, and other features. It is worth noting that this tool is more expensive.</li>
</ul>



<h2 id="h-lower-power-techniques" class="wp-block-heading">Lower Power Techniques</h2>



<p class="wp-block-paragraph">It is one thing to know a device&#8217;s power draw; it&#8217;s another to know how to lower its average draw. In the simplest terms, the best way to reduce power draw is to turn off as many things as possible. LEDs, Integrated Circuits (ICs), and the microcontroller (MCU) can all be powered on, off, or put to sleep via smart decisions made in hardware and software. Adding a Metal-Oxide-Semiconductor Field-Effect Transistor (MOSFET) or specialized power switches allows subsystems to be turned on and off as needed. Most MCUs support various sleep modes, which can reduce average power by orders of magnitude.</p>



<p class="wp-block-paragraph" style="padding-bottom:var(--wp--preset--spacing--40)">As an example, the ESP32, a popular MCU, provides a table in its datasheet that shows various sleep modes and their power consumption in those modes. Looking at these tables (see Figures 1 and 2 below), it&#8217;s seen that a maximum of 240 mA can be reduced to 5 µA by changing the power mode, a ~48,000-fold difference.</p>



<figure class="wp-block-image aligncenter size-full" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--50)"><img fetchpriority="high" decoding="async" width="624" height="250" src="https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-1.png" alt="Power modes and consumption for ESP32." class="wp-image-42944" srcset="https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-1.png 624w, https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-1-300x120.png 300w" sizes="(max-width: 624px) 100vw, 624px" /><figcaption class="wp-element-caption"><em>Figure 1: Power modes and consumption for ESP32</em></figcaption></figure>



<figure class="wp-block-image aligncenter size-full" style="margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--60)"><img decoding="async" width="624" height="187" src="https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-2.png" alt="Active RF power consumption." class="wp-image-42945" srcset="https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-2.png 624w, https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-2-300x90.png 300w" sizes="(max-width: 624px) 100vw, 624px" /><figcaption class="wp-element-caption"><em>Figure 2: Active RF power consumption</em></figcaption></figure>



<h2 id="h-examples" class="wp-block-heading">Examples</h2>



<p class="wp-block-paragraph">Out of simplicity, I will provide some data and examples using the Arduino Nano R4. This is Arduino’s smallest microcontroller development kit board and can be used for simple projects, including low-power applications. I’ll recreate the same setup in two different ways, both of which will result in a simple blinky program.</p>



<p class="wp-block-paragraph">For hardware, a Nano R4 will be plugged into a breadboard along with an LED and a resistor. The LED will blink at 2Hz in both software setups, though the second will include power-saving logic. Figures 3 and 4 below show a large drop in power when the CPU is put to sleep with nothing happening. In normal operation, the MCU idles and consumes power doing nothing, whereas in the sleep code, it can sleep and consume much less power.</p>



<p class="wp-block-paragraph">Figure 3 shows an average power draw of 24.3 mA in the 20s window, while the low-power version shown in Figure 4 has an average draw of 13.4 mA, nearly half the current used. These numbers can mean very little without some context. If the system were powered by a single CR2032 3V coin cell battery with a capacity of 225 mAh, the runtime would range from 225 mAh / 24.3 mA = 9.25 h to 16.8 h.</p>



<p class="wp-block-paragraph">This is roughly double the runtime under ideal situations. The true benefits of low power come from using a device with ultra-low-power saving modes, as seen in Figure 1 for the ESP32. If the same rough calculations are done with the modem off vs hibernation, we see a runtime range of 225mAh/25mA = 9hours to 225mAh/5uA =45000h = 1875days = 5.13years.</p>



<p class="wp-block-paragraph" style="padding-bottom:var(--wp--preset--spacing--40)">This is a perfect-world situation and is highly unlikely to happen, especially as it assumes the device would be asleep for the entire time, doing nothing productive. Though systems can be optimized to last for months or years, depending on their use case and the amount of power-saving logic applied.</p>



<figure class="wp-block-image aligncenter size-full" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--60)"><img decoding="async" width="925" height="519" src="https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-3-2.jpg" alt="Average power draw of 24.3 mA in the 20s window." class="wp-image-42974" srcset="https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-3-2.jpg 925w, https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-3-2-300x168.jpg 300w, https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-3-2-768x431.jpg 768w" sizes="(max-width: 925px) 100vw, 925px" /><figcaption class="wp-element-caption"><em>Figure 3: Simple Blinky</em></figcaption></figure>



<figure class="wp-block-image aligncenter size-full" style="margin-top:var(--wp--preset--spacing--40);margin-bottom:var(--wp--preset--spacing--60)"><img decoding="async" width="925" height="520" src="https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-4.jpg" alt="Low-power version, average draw of 13.4 mA." class="wp-image-42976" srcset="https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-4.jpg 925w, https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-4-300x169.jpg 300w, https://static.dmcinfo.com/wp-content/uploads/2026/04/hardware-embedded-devices-power-profiling-figure-4-768x432.jpg 768w" sizes="(max-width: 925px) 100vw, 925px" /><figcaption class="wp-element-caption"><em>Figure 4: Low Power Blinky</em></figcaption></figure>



<h2 id="h-code" class="wp-block-heading">Code</h2>



<p class="wp-block-paragraph">Below are the two sketches used for the measurements above:</p>



<ul class="wp-block-list">
<li>A baseline 2 Hz blinky</li>



<li style="padding-bottom:var(--wp--preset--spacing--50)">A low-power version that uses <strong>__WFI()</strong> to sleep between timer ticks</li>
</ul>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>//Baseline 2Hz Blinky
const int LED_PIN = 3;      // Built-in LED on Arduino Nano
const unsigned long TOGGLE_MS = 250;

unsigned long lastToggle = 0;
bool ledState = false;

void setup() {
  pinMode(LED_PIN, OUTPUT);
}

void loop() {
  unsigned long now = millis();

  if (now - lastToggle >= TOGGLE_MS) {
    lastToggle = now;
    ledState = !ledState;
    digitalWrite(LED_PIN, ledState);
  }
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #6A9955">//Baseline 2Hz Blinky</span></span>
<span class="line"><span style="color: #569CD6">const</span><span style="color: #D4D4D4"> </span><span style="color: #4FC1FF">int</span><span style="color: #D4D4D4"> LED_PIN = </span><span style="color: #B5CEA8">3</span><span style="color: #D4D4D4">;      </span><span style="color: #6A9955">// Built-in LED on Arduino Nano</span></span>
<span class="line"><span style="color: #569CD6">const</span><span style="color: #D4D4D4"> </span><span style="color: #4FC1FF">unsigned</span><span style="color: #D4D4D4"> long TOGGLE_MS = </span><span style="color: #B5CEA8">250</span><span style="color: #D4D4D4">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #9CDCFE">unsigned</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">long</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">lastToggle</span><span style="color: #D4D4D4"> = </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #9CDCFE">bool</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">ledState</span><span style="color: #D4D4D4"> = </span><span style="color: #569CD6">false</span><span style="color: #D4D4D4">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">void</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">setup</span><span style="color: #D4D4D4">() {</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">pinMode</span><span style="color: #D4D4D4">(</span><span style="color: #4FC1FF">LED_PIN</span><span style="color: #D4D4D4">, </span><span style="color: #4FC1FF">OUTPUT</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">void</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">loop</span><span style="color: #D4D4D4">() {</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">unsigned</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">long</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">now</span><span style="color: #D4D4D4"> = </span><span style="color: #DCDCAA">millis</span><span style="color: #D4D4D4">();</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4"> (</span><span style="color: #9CDCFE">now</span><span style="color: #D4D4D4"> - </span><span style="color: #9CDCFE">lastToggle</span><span style="color: #D4D4D4"> &gt;= </span><span style="color: #4FC1FF">TOGGLE_MS</span><span style="color: #D4D4D4">) {</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">lastToggle</span><span style="color: #D4D4D4"> = </span><span style="color: #9CDCFE">now</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">ledState</span><span style="color: #D4D4D4"> = !</span><span style="color: #9CDCFE">ledState</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">digitalWrite</span><span style="color: #D4D4D4">(</span><span style="color: #4FC1FF">LED_PIN</span><span style="color: #D4D4D4">, </span><span style="color: #9CDCFE">ledState</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">JavaScript</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>// Low Power 2Hz Blinky
#include &lt;Arduino.h>
const uint8_t LED_PIN = 3;
volatile bool tick = false;
extern "C" void SysTick_Handler(void)
{
  tick = true;
}

void setup()
{
  pinMode(LED_PIN, OUTPUT);
  digitalWrite(LED_PIN, LOW);

  // Configure SysTick for 250 ms ticks
  SysTick_Config(SystemCoreClock / 4);  // 1/4 second = 250 ms
}

void loop()
{
  // Wait in low-power idle until interrupt fires
  while (!tick) {
    __WFI();   // Wait For Interrupt (CPU sleeps until an interrupt occurs)
  }
  tick = false;

  // Toggle LED each tick
  digitalWrite(LED_PIN, !digitalRead(LED_PIN));
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #6A9955">// Low Power 2Hz Blinky</span></span>
<span class="line"><span style="color: #D4D4D4">#</span><span style="color: #9CDCFE">include</span><span style="color: #D4D4D4"> &lt;</span><span style="color: #9CDCFE">Arduino</span><span style="color: #D4D4D4">.</span><span style="color: #9CDCFE">h</span><span style="color: #D4D4D4">&gt;</span></span>
<span class="line"><span style="color: #569CD6">const</span><span style="color: #D4D4D4"> </span><span style="color: #4FC1FF">uint8_t</span><span style="color: #D4D4D4"> LED_PIN = </span><span style="color: #B5CEA8">3</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #9CDCFE">volatile</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">bool</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">tick</span><span style="color: #D4D4D4"> = </span><span style="color: #569CD6">false</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #9CDCFE">extern</span><span style="color: #D4D4D4"> </span><span style="color: #CE9178">&quot;C&quot;</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">void</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">SysTick_Handler</span><span style="color: #D4D4D4">(</span><span style="color: #569CD6">void</span><span style="color: #D4D4D4">)</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">tick</span><span style="color: #D4D4D4"> = </span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">;</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">void</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">setup</span><span style="color: #D4D4D4">()</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">pinMode</span><span style="color: #D4D4D4">(</span><span style="color: #4FC1FF">LED_PIN</span><span style="color: #D4D4D4">, </span><span style="color: #4FC1FF">OUTPUT</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">digitalWrite</span><span style="color: #D4D4D4">(</span><span style="color: #4FC1FF">LED_PIN</span><span style="color: #D4D4D4">, </span><span style="color: #4FC1FF">LOW</span><span style="color: #D4D4D4">);</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #6A9955">// Configure SysTick for 250 ms ticks</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">SysTick_Config</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">SystemCoreClock</span><span style="color: #D4D4D4"> / </span><span style="color: #B5CEA8">4</span><span style="color: #D4D4D4">);  </span><span style="color: #6A9955">// 1/4 second = 250 ms</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">void</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">loop</span><span style="color: #D4D4D4">()</span></span>
<span class="line"><span style="color: #D4D4D4">{</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #6A9955">// Wait in low-power idle until interrupt fires</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #C586C0">while</span><span style="color: #D4D4D4"> (!</span><span style="color: #9CDCFE">tick</span><span style="color: #D4D4D4">) {</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #DCDCAA">__WFI</span><span style="color: #D4D4D4">();   </span><span style="color: #6A9955">// Wait For Interrupt (CPU sleeps until an interrupt occurs)</span></span>
<span class="line"><span style="color: #D4D4D4">  }</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">tick</span><span style="color: #D4D4D4"> = </span><span style="color: #569CD6">false</span><span style="color: #D4D4D4">;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #6A9955">// Toggle LED each tick</span></span>
<span class="line"><span style="color: #D4D4D4">  </span><span style="color: #DCDCAA">digitalWrite</span><span style="color: #D4D4D4">(</span><span style="color: #4FC1FF">LED_PIN</span><span style="color: #D4D4D4">, !</span><span style="color: #DCDCAA">digitalRead</span><span style="color: #D4D4D4">(</span><span style="color: #4FC1FF">LED_PIN</span><span style="color: #D4D4D4">));</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<h2 id="h-conclusion" class="wp-block-heading" style="padding-top:var(--wp--preset--spacing--50)">Conclusion</h2>



<p class="wp-block-paragraph">Power profiling turns battery life from a guessing game into a measurable target for engineers. By capturing current over time, you can quickly spot spikes, reduce idle waste, and validate that firmware and hardware changes actually improve energy use. Even small changes, like sleeping between periodic tasks, can meaningfully reduce average current, and deeper optimizations can extend runtime further.</p>



<div class="wp-block-group alignwide has-custom-light-blue-background-color has-background is-layout-flow wp-container-core-group-is-layout-dbd34961 wp-block-group-is-layout-flow" style="border-radius:20px;margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50);padding-top:var(--wp--preset--spacing--50);padding-right:0;padding-bottom:var(--wp--preset--spacing--50);padding-left:0">
<div class="wp-block-columns alignwide are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-43efaee5 wp-block-columns-is-layout-flex" style="padding-right:var(--wp--preset--spacing--60);padding-left:var(--wp--preset--spacing--60)">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:85%">
<h3 class="wp-block-heading has-text-align-left" id="h-have-an-upcoming-project-dmc-can-help-you-take-the-next-step"><strong>Want to optimize the power consumption of your embedded device?</strong> Ask DMC.</h3>



<p class="has-text-align-left wp-block-paragraph" id="h-need-help-turning-ideas-into-outcomes-automation-project-to-the-next-level-contact-us-today-to-learn-more-about-our-solutions-and-how-we-can-help-you-achieve-your-goals">Power profiling can improve the battery life of your embedded project. Learn more about DMC&#8217;s <a href="https://static.dmcinfo.com/services/embedded-development-and-embedded-programming/" data-type="page" data-id="431">embedded</a> expertise and our <a href="https://static.dmcinfo.com/services/test-and-measurement-automation/battery-pack-and-bms-test-systems/" data-type="page" data-id="611">battery life</a> optimization capabilities</p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:15%">
<div class="wp-block-buttons is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-2236275c wp-block-buttons-is-layout-flex">
<div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-base-contrast-color has-text-color has-link-color wp-element-button" href="https://static.dmcinfo.com/contact/">Contact Us</a></div>
</div>
</div>
</div>
</div>
<p>The post <a href="https://static.dmcinfo.com/blog/42943/power-profiling-embedded-systems/">Power Profiling Embedded Systems: Tools, Techniques, and Real-World Results</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Battery Life Calculator</title>
		<link>https://static.dmcinfo.com/blog/41922/battery-life-calculator/</link>
		
		<dc:creator><![CDATA[Tim Jager]]></dc:creator>
		<pubDate>Thu, 05 Mar 2026 13:00:00 +0000</pubDate>
				<category><![CDATA[Embedded Development & Programming]]></category>
		<category><![CDATA[Low-Power Embedded Design]]></category>
		<category><![CDATA[Product Development]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/?p=41922</guid>

					<description><![CDATA[<p>As engineers who design electronic products, maximizing battery life is a constant challenge. Devices keep getting smaller while their feature sets continue to grow, forcing us to carefully manage power consumption across multiple operating modes, batteries, and power conversion stages. This calculator helps explore those tradeoffs by letting you tune system parameters and compare different [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/41922/battery-life-calculator/">Battery Life Calculator</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">As engineers who design electronic products, maximizing battery life is a constant challenge. Devices keep getting smaller while their feature sets continue to grow, forcing us to carefully manage power consumption across multiple operating modes, batteries, and power conversion stages.</p>



<p class="wp-block-paragraph">This calculator helps explore those tradeoffs by letting you tune system parameters and compare different battery and power architecture options. Unlike many simple online calculators, it breaks power usage down by operating mode and accounts for conversion efficiency so you can better see where energy is going and how design choices affect battery life.</p>



<style>
    /* Root layout */
    .dmc-calc-root {
      margin: 2rem auto;
      padding: 1.5rem;
      border: 1px solid #ccc;
      border-radius: 8px;
      background-color: #fff;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .dmc-calc-root h1 {
      margin-top: 0;
      margin-bottom: 0.25rem;
      font-size: 1.6rem;
    }

    .dmc-calc-root p.dmc-calc-subtitle {
      margin-top: 0;
      color: #555;
      font-size: 0.95rem;
    }

    .dmc-calc-section {
      margin-top: 1.75rem;
    }

    .dmc-calc-section h2 {
      margin: 0 0 0.75rem 0;
      font-size: 1.25rem;
      border-bottom: 1px solid #ddd;
      padding-bottom: 0.25rem;
    }

    .dmc-calc-section h3 {
      margin: 1rem 0 0.5rem 0;
      font-size: 1.05rem;
    }

    /* Battery configuration */
    .dmc-calc-battery-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 0.75rem 1rem;
    }

    .dmc-calc-field {
      display: flex;
      flex-direction: column;
      font-size: 0.9rem;
    }

    .dmc-calc-field label {
      margin-bottom: 0.15rem;
      font-weight: 600;
    }

    .dmc-calc-field input,
    .dmc-calc-field select {
      padding: 0.3rem 0.4rem;
      border: 1px solid #ccc;
      border-radius: 4px;
      font-size: 0.9rem;
    }

    .dmc-calc-field input.dmc-calc-readonly {
      background-color: #f4f6fb;
      border-color: #cdd6e4;
      color: #394255;
      cursor: not-allowed;
    }

    .dmc-calc-field input.dmc-calc-readonly:focus {
      outline: none;
      box-shadow: none;
    }

    .dmc-calc-field span.dmc-calc-unit {
      font-size: 0.8rem;
      color: #666;
      margin-top: 0.15rem;
    }

    .dmc-calc-example-links {
      margin: 0;
      padding-left: 1.05rem;
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }

    .dmc-calc-example-links li {
      line-height: 1.3;
    }

    .dmc-calc-example-links a {
      color: #0057b8;
      text-decoration: underline;
      text-underline-offset: 2px;
    }

    .dmc-calc-example-links a:hover,
    .dmc-calc-example-links a:focus-visible {
      color: #003f84;
    }

    .dmc-calc-example-blurb {
      margin: 0.1rem 0 0 0;
      color: #666;
      font-size: 0.78rem;
    }

    /* Rails and modes tables */
    .dmc-calc-table-wrapper {
      overflow-x: auto;
    }

    .dmc-calc-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.85rem;
      min-width: 760px;
    }

    .dmc-calc-table th,
    .dmc-calc-table td {
      border: 1px solid #ddd;
      padding: 0.3rem;
      text-align: left;
      vertical-align: middle;
      white-space: nowrap;
    }

    .dmc-calc-table thead {
      background-color: #f7f7f7;
      position: sticky;
      top: 0;
      z-index: 1;
    }

    .dmc-calc-table th {
      font-weight: 600;
    }

    .dmc-calc-table input,
    .dmc-calc-table select {
      width: 100%;
      box-sizing: border-box;
      font-size: 0.8rem;
      padding: 0.2rem 0.25rem;
    }

    .dmc-calc-rails-table input[data-rail-field="name"] {
      max-width: 6rem;
    }

    .dmc-calc-rails-table input[data-rail-field="voltage"] {
      max-width: 4.75rem;
    }

    .dmc-calc-rails-table input[data-rail-field="efficiency"],
    .dmc-calc-rails-table input[data-rail-field="eff-low-pct"],
    .dmc-calc-rails-table input[data-rail-field="eff-high-pct"] {
      max-width: 3.5rem;
    }

    .dmc-calc-rails-table input[data-rail-field="iq-ua"] {
      max-width: 6rem;
    }

    .dmc-calc-rails-table select[data-rail-field="parent"] {
      max-width: 8rem;
    }

    .dmc-calc-rails-eff-mode-hidden:disabled {
      color: transparent;
      text-shadow: none;
      -webkit-text-fill-color: transparent;
    }

    .dmc-calc-rails-table {
      min-width: 640px;
    }

    .dmc-calc-loads-table {
      min-width: 640px;
    }

    .dmc-calc-modes-table {
      min-width: 1000px;
    }

    .dmc-calc-modes-table input[data-load-id] {
      width: 4.5rem;
      min-width: 4.5rem;
      max-width: 4.5rem;
    }

    .dmc-calc-modes-table input[data-mode-field="period"] {
      width: 4.5rem;
      min-width: 4.5rem;
    }

    .dmc-calc-input-with-unit {
      display: inline-flex;
      align-items: center;
      gap: 0.15rem;
    }

    .dmc-calc-input-with-unit > input,
    .dmc-calc-input-with-unit > .dmc-calc-computed-field {
      box-sizing: border-box;
      height: 1.95rem;
      line-height: 1.2;
    }

    .dmc-calc-input-with-unit select {
      width: auto;
      min-width: 4.9rem;
      padding: 0.2rem 0.2rem;
      padding-right: 1.45rem;
      border: 1px solid #ccc;
      border-radius: 4px;
      font-size: 0.85rem;
      color: #111;
      background-color: #fff;
      flex: 0 0 auto;
      -webkit-appearance: menulist;
      appearance: auto;
    }

    .dmc-calc-unit-label {
      width: 4.9rem;
      min-width: 4.9rem;
      box-sizing: border-box;
      height: 1.95rem;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0.2rem 0.2rem;
      border: 1px solid #ccc;
      border-radius: 4px;
      background-color: #f7f7f7;
      color: #394255;
      font-size: 0.85rem;
      font-weight: 600;
      user-select: none;
    }

    .dmc-calc-modes-table input[data-mode-field="name"] {
      width: 9rem;
      min-width: 9rem;
    }

    .dmc-calc-computed-field {
      display: inline-block;
      padding: 0.3rem 0.4rem;
      background-color: #f4f6fb;
      border: 1px solid #cdd6e4;
      border-radius: 4px;
      font-size: 0.9rem;
      color: #394255;
      font-variant-numeric: tabular-nums;
      text-align: right;
      min-width: 4.5rem;
    }

    .dmc-calc-modes-table .dmc-calc-mode-period-value {
      width: 4.5rem;
      min-width: 4.5rem;
    }

    .dmc-calc-modes-table .dmc-calc-mode-active-value {
      width: 5.5rem;
      min-width: 5.5rem;
    }

    .dmc-calc-modes-table input[data-mode-field="active"] {
      width: 5.5rem;
      min-width: 5.5rem;
    }

    .dmc-calc-modes-table .dmc-blc-duty,
    .dmc-calc-modes-table .dmc-blc-avg-power,
    .dmc-calc-modes-table .dmc-blc-contrib {
      font-variant-numeric: tabular-nums;
      text-align: right;
      display: inline-block;
      min-width: 2.2rem;
    }

    .dmc-calc-modes-table th.dmc-calc-narrow-col,
    .dmc-calc-modes-table td.dmc-calc-narrow-col {
      width: 3.2rem;
      min-width: 3.2rem;
      max-width: 3.5rem;
      white-space: normal;
      line-height: 1.3;
      text-align: right;
    }

    .dmc-calc-modes-table td[role="button"] {
      padding: 0.3rem 0.15rem;
      width: 2rem;
      min-width: 2rem;
    }

    .dmc-calc-modes-table .dmc-calc-delete-col {
      width: 2rem;
      min-width: 2rem;
      padding: 0.3rem 0.15rem;
      text-align: center;
    }

    .dmc-calc-rails-eff-cell {
      white-space: normal;
    }

    .dmc-calc-rails-eff-cell input[data-rail-field="efficiency"],
    .dmc-calc-rails-eff-cell {
      white-space: normal;
    }

    .dmc-calc-rails-eff-rows {
      display: grid;
      gap: 0.2rem;
      align-items: center;
    }

    .dmc-calc-rails-eff-row {
      display: grid;
      grid-template-columns: auto 3.25rem auto 4rem auto;
      align-items: center;
      gap: 0.2rem;
    }

    .dmc-calc-rails-eff-row input[type="number"] {
      width: 100%;
      min-width: 3rem;
    }

    .dmc-calc-rails-eff-row span {
      color: #555;
      font-size: 0.85rem;
      white-space: nowrap;
    }

    .dmc-calc-rails-eff-label {
      display: inline-block;
      min-width: 2.6rem;
      text-align: right;
    }

    .dmc-calc-rails-eff-rows .dmc-calc-rails-eff-simple-only {
      grid-template-columns: 1fr;
      gap: 0;
    }

    /* Topology diagram */
    .dmc-calc-topology {
      margin: 1rem 0 1.25rem 0;
      padding: 0.75rem;
      border: 1px solid #e0e0e0;
      border-radius: 6px;
      background: linear-gradient(120deg, #fafafa 0%, #f5f7fa 100%);
    }

    .dmc-calc-topology {
      position: relative;
    }

    .dmc-calc-topology svg {
      width: 100%;
      height: 100%;
      min-height: 360px;
      max-height: 600px;
      display: block;
    }

    .dmc-calc-modes-actions {
      margin-top: 0.5rem;
      display: flex;
      gap: 0.5rem;
    }

    /* Concept tiles */
    .dmc-calc-concepts-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 0.9rem;
      margin-top: 0.75rem;
    }

    .dmc-calc-concept-card {
      border: 1px solid #e0e0e0;
      border-radius: 6px;
      padding: 0.6rem 0.75rem;
      background: #fcfcff;
    }

    .dmc-calc-concept-name {
      font-weight: 600;
      margin: 0 0 0.35rem 0;
    }

    .dmc-calc-concept-detail {
      margin: 0.15rem 0;
      font-size: 0.86rem;
    }

    .dmc-calc-concept-detail em {
      font-style: normal;
      font-weight: 600;
      display: block;
      margin-bottom: 0.05rem;
    }

    .dmc-calc-2pt-demo {
      margin-top: 0.5rem;
      padding: 0.45rem 0.55rem;
      border: 1px solid #d8dee8;
      border-radius: 6px;
      background: #ffffff;
    }

    .dmc-calc-2pt-demo svg {
      display: block;
      width: 100%;
      height: 122px;
    }

    .dmc-calc-2pt-rules {
      margin: 0.4rem 0 0 0.95rem;
      padding: 0;
      color: #4a4a4a;
      font-size: 0.79rem;
      line-height: 1.35;
    }

    /* Results cards */
    .dmc-calc-results-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 0.75rem;
    }

    .dmc-calc-card {
      border: 1px solid #ddd;
      border-radius: 6px;
      padding: 0.75rem 0.9rem;
      background-color: #fafafa;
    }

    .dmc-calc-card h3 {
      margin: 0 0 0.3rem 0;
      font-size: 0.95rem;
    }

    .dmc-calc-card-value {
      font-size: 1.1rem;
      font-weight: 600;
      margin-bottom: 0.15rem;
    }

    .dmc-calc-card-sub {
      font-size: 0.8rem;
      color: #666;
    }

    /* Mode contribution bars */
    .dmc-calc-mode-bars {
      margin-top: 1rem;
      font-size: 0.85rem;
    }

    .dmc-calc-mode-bars h3 {
      margin: 0 0 0.5rem 0;
      font-size: 0.95rem;
    }

    .dmc-calc-mode-bars-body {
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }

    .dmc-calc-mode-bar-row {
      display: grid;
      grid-template-columns: minmax(100px, 140px) 1fr minmax(56px, 68px);
      align-items: center;
      gap: 0.5rem;
    }

    .dmc-calc-mode-bar-label {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .dmc-calc-mode-bar-track {
      position: relative;
      height: 10px;
      border-radius: 999px;
      background-color: #eee;
      overflow: hidden;
    }

    .dmc-calc-mode-bar {
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      border-radius: 999px;
      background-color: #0074d9;
    }

    .dmc-calc-mode-bar-value {
      text-align: right;
      font-variant-numeric: tabular-nums;
      color: #444;
    }

    /* Sticky summary banner */
    #dmc-blc-summary-banner-container {
      display: flex;
      justify-content: flex-end;
      margin-bottom: 20px;
      position: sticky;
      top: 170px;
	  z-index: 60;
    }
    .dmc-calc-summary-banner {
      width: calc(100% - 1.4rem);
      margin: 0;
      padding: 0.45rem 0.7rem 0.55rem 0.7rem;
      border: 2px solid #0b5fc6;
      border-radius: 12px;
      background: linear-gradient(180deg, #f7fbff 0%, #edf4ff 100%);
      box-shadow: 0 8px 18px rgba(11, 95, 198, 0.18);
      display: flex;
      flex-direction: column;
      gap: 0.35rem 0.6rem;
      align-items: stretch;
      transition: transform 220ms ease, box-shadow 220ms ease;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-down {
      transform: translate(0, -8px);
      box-shadow: 0 4px 10px rgba(11, 95, 198, 0.14);
    }

    .dmc-calc-summary-banner-head {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .dmc-calc-summary-banner-title {
      flex: 1 1 auto;
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #0b4a92;
      margin: 0;
      line-height: 1.15;
    }

    .dmc-calc-summary-toggle {
      flex: 0 0 auto;
      border: 1px solid #8fb3e0;
      border-radius: 999px;
      background: #ffffff;
      color: #225392;
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.02em;
      padding: 0.18rem 0.55rem;
      cursor: pointer;
      line-height: 1.2;
    }

    .dmc-calc-summary-toggle:hover,
    .dmc-calc-summary-toggle:focus-visible {
      border-color: #0b5fc6;
      color: #0b4a92;
      outline: none;
    }

    .dmc-calc-summary-banner-content {
      display: grid;
      grid-template-columns: repeat(3, minmax(220px, 1fr));
      gap: 0.35rem 0.6rem;
      align-items: center;
    }

    .dmc-calc-summary-pill {
      display: flex;
      flex-direction: column;
      gap: 0.08rem;
      background-color: #ffffff;
      border: 1px solid #d5deec;
      border-radius: 9px;
      padding: 0.28rem 0.45rem;
    }

    .dmc-calc-summary-pill-label {
      font-size: 0.74rem;
      color: #4f5f78;
      font-weight: 600;
    }

    .dmc-calc-summary-pill-value {
      font-size: 0.98rem;
      font-weight: 700;
      font-variant-numeric: tabular-nums;
      color: #1f2c42;
    }

    .dmc-calc-summary-pill-primary {
      border: 2px solid #ea8a15;
      background: linear-gradient(180deg, #fff9ef 0%, #fff2dc 100%);
      box-shadow: 0 2px 8px rgba(234, 138, 21, 0.18);
    }

    .dmc-calc-summary-pill-primary .dmc-calc-summary-pill-label {
      color: #8b4b00;
    }

    .dmc-calc-summary-pill-primary .dmc-calc-summary-pill-value {
      font-size: clamp(1.08rem, 2vw, 1.3rem);
      line-height: 1.1;
      color: #7a2e00;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed {
      transform: translate(0, 0);
      width: max-content;
      max-width: calc(100vw - 1.3rem);
      padding: 0.2rem 0.28rem;
      gap: 0.16rem;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed .dmc-calc-summary-banner-title {
      display: none;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed .dmc-calc-summary-banner-content {
      grid-template-columns: 1fr;
      gap: 0.25rem;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed .dmc-calc-summary-pill-secondary {
      display: none;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed .dmc-calc-summary-pill-primary {
      border-width: 1px;
      box-shadow: none;
      padding: 0.12rem 0.34rem;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed .dmc-calc-summary-pill-primary .dmc-calc-summary-pill-label {
      display: none;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed .dmc-calc-summary-pill-primary .dmc-calc-summary-pill-value {
      font-size: 0.86rem;
      color: #4f2b00;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed .dmc-calc-summary-toggle {
      font-size: 0.68rem;
      padding: 0.1rem 0.42rem;
    }

    .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed.dmc-calc-summary-banner-down {
      transform: translate(0, -8px);
    }

    /* Share section */
    .dmc-calc-share-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5rem;
      align-items: center;
    }

    .dmc-calc-share-row button {
      white-space: nowrap;
    }

    .dmc-calc-share-row input[type="text"] {
      flex: 1 1 220px;
      min-width: 0;
      padding: 0.3rem 0.4rem;
      border: 1px solid #ccc;
      border-radius: 4px;
      font-size: 0.85rem;
    }

    .dmc-calc-share-status {
      font-size: 0.8rem;
      color: #555;
      margin-top: 0.3rem;
    }

    /* Buttons */
    .dmc-calc-button {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
      border: 1px solid #0074d9;
      background-color: #0074d9;
      color: #fff;
      padding: 0.35rem 0.7rem;
      font-size: 0.85rem;
      cursor: pointer;
    }

    .dmc-calc-button.dmc-calc-secondary {
      background-color: #f5f5f5;
      border-color: #ccc;
      color: #333;
    }

    .dmc-calc-button:disabled {
      opacity: 0.6;
      cursor: default;
    }

    /* Explanation details */
    .dmc-calc-explainer {
      font-size: 0.9rem;
    }

    .dmc-calc-explainer summary {
      cursor: pointer;
      font-weight: 600;
    }

    .dmc-calc-explainer p {
      margin-top: 0.4rem;
      margin-bottom: 0.4rem;
    }

    /* Small helpers */
    .dmc-calc-muted {
      color: #666;
      font-size: 0.8rem;
    }

    .dmc-calc-warning {
      color: #a33;
      font-size: 0.85rem;
      margin-top: 0.45rem;
    }

    .dmc-calc-align-right {
      text-align: right;
    }

    .dmc-calc-collapsible {
      border: 1px solid #e0e0e0;
      border-radius: 6px;
      padding: 0.4rem 0.75rem 0.75rem 0.75rem;
      background: linear-gradient(180deg, #fafafa 0%, #fdfdfd 100%);
    }

    .dmc-calc-collapsible summary {
      cursor: pointer;
      list-style: none;
    }

    .dmc-calc-collapsible summary::-webkit-details-marker {
      display: none;
    }

    .dmc-calc-collapsible summary h2 {
      display: inline-block;
      margin: 0 0 0.35rem 0;
    }

    .dmc-calc-chem-curve {
      margin-top: 1.25rem;
      padding: 1rem;
      border: 1px solid #ddd;
      border-radius: 8px;
      background: linear-gradient(180deg, #fcfcfc 0%, #f5f6fa 100%);
    }

    .dmc-calc-chem-curve-header {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: flex-end;
      gap: 0.5rem;
    }

    .dmc-calc-chem-curve-header h3 {
      margin: 0;
      font-size: 1.05rem;
    }

    .dmc-calc-chem-curve canvas {
      display: block;
      width: 100%;
      height: 260px;
      min-height: 220px;
      margin-top: 0.75rem;
      border-radius: 4px;
      background-color: #fff;
      box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
    }

    .dmc-calc-chem-curve-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      font-size: 0.85rem;
      color: #444;
    }

    .dmc-calc-chem-curve-note {
      margin-top: 0.4rem;
      font-size: 0.8rem;
      color: #666;
    }

    .dmc-calc-chem-curve-stats {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 0.5rem 1rem;
      margin-top: 0.75rem;
      font-size: 0.85rem;
      color: #333;
    }

    .dmc-calc-chem-curve-stat-label {
      display: block;
      color: #666;
      font-size: 0.78rem;
      margin-bottom: 0.15rem;
    }

    .dmc-calc-chem-curve-stat-value {
      font-variant-numeric: tabular-nums;
    }

    @media (max-width: 640px) {
      .dmc-calc-root {
        margin: 1rem;
        padding: 1rem;
      }

      #dmc-blc-summary-banner-container {
        top: 90px;
      }

      .dmc-calc-summary-banner {
        width: calc(100% - 1.1rem);
        right: auto;
        bottom: auto;
        padding: 0.45rem 0.55rem 0.5rem 0.55rem;
        grid-template-columns: 1fr;
      }

      .dmc-calc-summary-banner-content {
        grid-template-columns: 1fr;
      }

      .dmc-calc-summary-banner-title {
        font-size: 0.68rem;
      }
      .dmc-calc-summary-banner.dmc-calc-summary-banner-collapsed {
        max-width: calc(100vw - 1rem);
      }
    }
.dmc-calc-section p code {
	padding: inherit;
	background-color: inherit;
	border-radius: inherit !important;
	color: inherit;
	font-size: inherit;
	box-decoration-break: inherit;
	-webkit-box-decoration-break: inherit;
}
  </style>
</head>
<body>
  <div id="battery-life-calculator" class="dmc-calc-root">
    <div id="dmc-blc-summary-banner-container">
      <div id="dmc-blc-summary-banner" class="dmc-calc-summary-banner" aria-label="Key results summary" data-collapsed="false">
        <div class="dmc-calc-summary-banner-head">
          <div class="dmc-calc-summary-banner-title">Final battery life estimate</div>
          <button type="button" id="dmc-blc-summary-toggle" class="dmc-calc-summary-toggle" aria-expanded="true" aria-controls="dmc-blc-summary-content">Collapse</button>
        </div>
        <div id="dmc-blc-summary-content" class="dmc-calc-summary-banner-content">
          <div class="dmc-calc-summary-pill dmc-calc-summary-pill-secondary">
            <span class="dmc-calc-summary-pill-label">Average power</span>
            <span class="dmc-calc-summary-pill-value" id="dmc-blc-summary-avg">&#8212; uW</span>
          </div>
          <div class="dmc-calc-summary-pill dmc-calc-summary-pill-secondary">
            <span class="dmc-calc-summary-pill-label">Usable pack energy</span>
            <span class="dmc-calc-summary-pill-value" id="dmc-blc-summary-energy">&#8212;</span>
          </div>
          <div class="dmc-calc-summary-pill dmc-calc-summary-pill-primary">
            <span class="dmc-calc-summary-pill-label">Life</span>
            <span class="dmc-calc-summary-pill-value" id="dmc-blc-summary-life">&#8212;</span>
          </div>
        </div>
      </div>
      </div>
    <header>
      <h2>Ultimate Online Battery Life Calculator for IoT, Embedded Systems, and Wearable Devices</h2>
      <p class="dmc-calc-subtitle">
        Explore battery life for embedded systems with multiple modes and power rails.
      </p>
    </header>

    <!-- Example configurations -->
    <section class="dmc-calc-section" aria-labelledby="dmc-blc-examples-heading">
      <h2 id="dmc-blc-examples-heading">Example configurations</h2>
      <div class="dmc-calc-field">
        <span class="dmc-calc-unit">Each link reloads this page with that template.</span>
        <p class="dmc-calc-muted">Each example demonstrates a realistic device setup, so the diagram, mode rows, and results cards line up as a teachable reference. After loading one, tweak values to see how assumptions change the life estimate.</p>
        <label id="dmc-blc-example-links-label">Load an example template</label>
        <ul class="dmc-calc-example-links" aria-labelledby="dmc-blc-example-links-label">
          <li>
            <a id="dmc-blc-example-link-coin_tracker_direct" data-example-link="coin_tracker_direct" href="#">Coin-cell tracker (direct battery)</a>
            <p class="dmc-calc-example-blurb">A simple one-cell CR2032 design with no intermediate rails, so the block diagram shows Battery feeding each load directly. Use this to see how tiny idle current and very short, frequent BLE pulses combine, then compare with the rare long beeper event to understand which activity actually dominates life.</p>
          </li>
          <li>
            <a id="dmc-blc-example-link-aa_logger_buckboost" data-example-link="aa_logger_buckboost" href="#">2xAA remote logger (buck-boost)</a>
            <p class="dmc-calc-example-blurb">Two AA alkaline cells feed a 3V3 buck-boost rail in switching 2-point efficiency mode, so the diagram includes one converter stage between battery and loads. This example helps you inspect how light-load efficiency and converter overhead affect average power during long idle windows, short samples, and periodic radio uplink bursts.</p>
          </li>
          <li>
            <a id="dmc-blc-example-link-aaa_beacon_boost" data-example-link="aaa_beacon_boost" href="#">1xAAA sensor beacon (boost)</a>
            <p class="dmc-calc-example-blurb">A single AAA cell powers a 3V0 boost rail with 2-point efficiency, representing a common ultra-low-power beacon architecture. Look at the mode table to compare near-zero idle current, periodic sensing, and brief BLE transmit pulses, then check how boost efficiency at low current impacts the final battery-life estimate.</p>
          </li>
          <li>
            <a id="dmc-blc-example-link-lipo_wearable_multirail" data-example-link="lipo_wearable_multirail" href="#">LiPo wearable (multi-rail)</a>
            <p class="dmc-calc-example-blurb">This model uses a 1S LiPo pack with a 3V3 buck rail and cascaded 1V8 core plus 2V8 sensor rails, so the diagram demonstrates a realistic multi-rail wearable tree. Use it to see how cascaded conversion losses and mixed digital/radio/sensor activity shape average power across continuous sensing and bursty communication modes.</p>
          </li>
          <li>
            <a id="dmc-blc-example-link-smart_lock_motor_boost" data-example-link="smart_lock_motor_boost" href="#">LiPo smart lock (motor boost rail)</a>
            <p class="dmc-calc-example-blurb">A 1S LiPo supply drives low-power logic rails and a separate 5V boost rail for a high-current motor, which makes the block diagram and duty-cycle math more event-driven. This example is useful for learning how rare but heavy actuation pulses can outweigh long standby periods in total energy budget.</p>
          </li>
        </ul>
      </div>
    </section>

    <section class="dmc-calc-section" aria-labelledby="dmc-blc-project-heading">
      <h2 id="dmc-blc-project-heading">Project</h2>
      <div class="dmc-calc-battery-grid">
        <div class="dmc-calc-field">
          <label for="dmc-blc-project-name">Project / device name</label>
          <input id="dmc-blc-project-name" type="text" placeholder="Example: Soil sensor v2" />
          <span class="dmc-calc-unit">Optional, not used in calculations.</span>
        </div>
      </div>
      <div class="dmc-calc-share-row" style="margin-top:0.5rem;">
        <button type="button" id="dmc-blc-copy-link" class="dmc-calc-button" disabled aria-describedby="dmc-blc-share-status">
          Copy shareable link
        </button>
        <input
          id="dmc-blc-share-url"
          type="text"
          placeholder="Project name required to enable sharing."
          readonly
        />
      </div>
      <div id="dmc-blc-share-status" class="dmc-calc-share-status">
        Enter a project name to enable sharing.
      </div>
    </section>

<!-- Battery configuration -->
    <section class="dmc-calc-section" aria-labelledby="dmc-blc-battery-heading">
      <h2 id="dmc-blc-battery-heading">Battery configuration</h2>
      <div class="dmc-calc-battery-grid">
        <div class="dmc-calc-field">
          <label for="dmc-blc-batt-chemistry">Battery chemistry</label>
          <select id="dmc-blc-batt-chemistry">
            <option value="">Generic flat (avg voltage)</option>
            <option value="generic_linear">Generic linear (min/max to 0 V)</option>
            <option value="alkaline">Alkaline (AA/AAA)</option>
            <option value="cr2032">Coin cell (CR2032)</option>
            <option value="liion">Li-ion (4.2-3.0 V)</option>
            <option value="lifepo4">LiFePO4 (3.6-2.5 V)</option>
            <option value="litc">Li-SOCl2 primary (3.6-2.5 V)</option>
          </select>
          <span class="dmc-calc-unit">Chemistry + min/max voltages control derating.</span>
        </div>

        <div class="dmc-calc-field">
          <label for="dmc-blc-num-cells">Number of cells (series)</label>
          <input id="dmc-blc-num-cells" type="number" min="1" step="1" />
          <span class="dmc-calc-unit">cells</span>
        </div>

        <div class="dmc-calc-field">
          <label for="dmc-blc-cell-capacity">Cell capacity</label>
          <input id="dmc-blc-cell-capacity" type="number" min="0" step="1" />
          <span class="dmc-calc-unit">mAh</span>
        </div>

        <div class="dmc-calc-field">
          <label for="dmc-blc-cell-voltage">Average cell voltage</label>
          <input id="dmc-blc-cell-voltage" type="number" min="0" step="0.0001" />
          <span class="dmc-calc-unit">V</span>
        </div>

        <div class="dmc-calc-field" data-chem-advanced>
          <label for="dmc-blc-batt-vmax">Cell max voltage (V)</label>
          <input id="dmc-blc-batt-vmax" type="number" min="0" step="0.01" />
          <span class="dmc-calc-unit">V/cell</span>
        </div>

        <div class="dmc-calc-field" data-chem-advanced>
          <label for="dmc-blc-batt-vmin">Cell min voltage (V)</label>
          <input id="dmc-blc-batt-vmin" type="number" min="0" step="0.01" />
          <span class="dmc-calc-unit">V/cell at cutoff</span>
        </div>
      </div>
      <p class="dmc-calc-muted">
        Pack energy is computed as: Pack_mWh = CellCapacity_mAh * AvgCellVoltage_V * NumCells.
      </p>
      <details open class="dmc-calc-collapsible" aria-labelledby="dmc-blc-chem-curve-summary">
        <summary><h2 id="dmc-blc-chem-curve-summary">Discharge curve &amp; pack stats</h2></summary>
        <div class="dmc-calc-chem-curve" aria-live="polite">
          <div class="dmc-calc-chem-curve-header">
            <div>
              <h3>Discharge curve preview</h3>
              <p class="dmc-calc-muted" style="margin: 0;">
                Normalized capacity (0% = fresh cell, 100% = fully discharged).
              </p>
            </div>
            <div class="dmc-calc-chem-curve-legend">
              <span id="dmc-blc-chem-curve-label">Select a chemistry to view its curve.</span>
              <span id="dmc-blc-chem-curve-stats"></span>
            </div>
          </div>
          <canvas
            id="dmc-blc-chem-curve"
            width="720"
            height="280"
            role="img"
            aria-label="Battery discharge curve visualization"
          ></canvas>
          <p id="dmc-blc-chem-curve-note" class="dmc-calc-chem-curve-note dmc-calc-muted"></p>
          <div class="dmc-calc-chem-curve-stats">
            <div>
              <span class="dmc-calc-chem-curve-stat-label">Pack energy max (mWh / Wh)</span>
              <span id="dmc-blc-pack-energy-full" class="dmc-calc-chem-curve-stat-value">&#8212;</span>
            </div>
            <div>
              <span class="dmc-calc-chem-curve-stat-label">Pack avg voltage</span>
              <span id="dmc-blc-pack-avg" class="dmc-calc-chem-curve-stat-value">&#8212;</span>
            </div>
            <div>
              <span class="dmc-calc-chem-curve-stat-label">Pack max voltage</span>
              <span id="dmc-blc-pack-max" class="dmc-calc-chem-curve-stat-value">&#8212;</span>
            </div>
            <div>
              <span class="dmc-calc-chem-curve-stat-label">Pack min voltage</span>
              <span id="dmc-blc-pack-min" class="dmc-calc-chem-curve-stat-value">&#8212;</span>
            </div>
            <div>
              <span class="dmc-calc-chem-curve-stat-label">Pack energy usable (mWh / Wh)</span>
              <span id="dmc-blc-pack-energy" class="dmc-calc-chem-curve-stat-value">&#8212;</span>
            </div>
            <div>
              <span class="dmc-calc-chem-curve-stat-label">Usable capacity fraction</span>
              <span id="dmc-blc-pack-usable-fraction" class="dmc-calc-chem-curve-stat-value">&#8212;</span>
            </div>
          </div>
        </div>
      </details>
    </section>

    <!-- Rails definition -->
    <section class="dmc-calc-section" aria-labelledby="dmc-blc-rails-heading">
      <details open class="dmc-calc-collapsible" aria-labelledby="dmc-blc-rails-heading">
        <summary><h2 id="dmc-blc-rails-heading">Power rails</h2></summary>
        <p class="dmc-calc-muted">
          Define each rail once, including its voltage, regulator model, and optional parent rail to
          model cascaded conversion. Use <strong>Switching (fixed)</strong> for a single efficiency point, <strong>Switching (2-point)</strong>
          for low/high efficiency versus current, and <strong>Linear (LDO)</strong> to enter quiescent current (Iq).
          Rails are treated as on by demand: Iq is applied only in modes where downstream load current is non-zero.
          The calculator also shows a nominal path efficiency back to the battery.
        </p>

        <div class="dmc-calc-table-wrapper">
          <table class="dmc-calc-table dmc-calc-rails-table" aria-describedby="dmc-blc-rails-heading">
            <thead>
              <tr>
                <th>Parent rail</th>
                <th>Rail name</th>
                <th>Volts</th>
                <th>Regulator</th>
                <th>Params</th>
                <th>Path Efficiency</th>
                <th>Notes</th>
                <th></th>
              </tr>
            </thead>
            <tbody id="dmc-blc-rails-tbody">
              <tr data-rail-row data-rail-id="battery">
                <td><select aria-label="Parent rail" data-rail-field="parent" disabled aria-disabled="true"><option value="">Battery (pack root)</option></select></td>
                <td><input type="text" value="Battery rail" aria-label="Rail name" readonly aria-readonly="true" data-rail-field="name" /></td>
                <td><input type="number" min="0" step="0.01" value="3.0" aria-label="Rail voltage" readonly aria-readonly="true" data-rail-field="voltage" /></td>
                <td>
                  <select id="eff-mode-battery" class="dmc-calc-rails-eff-mode-hidden" data-rail-field="eff-mode" aria-label="Regulator model" disabled aria-disabled="true">
                    <option value="switching-simple" selected></option>
                  </select>
                </td>
                <td class="dmc-calc-rails-eff-cell">
                  <span class="dmc-calc-muted">N/A</span>
                </td>
                <td><span data-rail-effective>&#8212; %</span></td>
                <td><input type="text" placeholder="Direct battery loads" aria-label="Rail notes" readonly aria-readonly="true" data-rail-field="notes" /></td>
                <td></td>
              </tr>
              <tr data-rail-row data-rail-id="sensor">
                <td><select aria-label="Parent rail" data-rail-field="parent"><option value="battery">Battery</option></select></td>
                <td><input type="text" value="Sensor rail" aria-label="Rail name" data-rail-field="name" /></td>
                <td><input type="number" min="0" step="0.01" aria-label="Rail voltage" data-rail-field="voltage" /></td>
                <td>
                  <select data-rail-field="eff-mode" aria-label="Regulator model">
                    <option value="switching-simple" selected>Switching (fixed eff.)</option>
                    <option value="switching-2pt">Switching (2-point eff.)</option>
                    <option value="linear">Linear (LDO)</option>
                  </select>
                </td>
                <td class="dmc-calc-rails-eff-cell">
                  <div class="dmc-calc-rails-eff-rows">
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-simple-only">
                      <input type="number" min="0" max="100" step="1" aria-label="Stage efficiency (%)" inputmode="numeric" data-rail-field="efficiency" />
                      <span>%</span>
                    </div>
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                      <span class="dmc-calc-rails-eff-label">Low</span>
                      <input type="number" min="0" max="100" step="1" aria-label="Low current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-low-pct" />
                      <span>% @</span>
                      <input type="number" min="0" step="0.000001" aria-label="Low current point (mA)" placeholder="mA" data-rail-field="eff-low-current" />
                      <span>mA</span>
                    </div>
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                      <span class="dmc-calc-rails-eff-label">High</span>
                      <input type="number" min="0" max="100" step="1" aria-label="High current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-high-pct" />
                      <span>% @</span>
                      <input type="number" min="0" step="0.000001" aria-label="High current point (mA)" placeholder="mA" data-rail-field="eff-high-current" />
                      <span>mA</span>
                    </div>
                  </div>
                </td>
                <td><span data-rail-effective>&#8212; %</span></td>
                <td><input type="text" placeholder="e.g., ADC, sensor bias" aria-label="Rail notes" data-rail-field="notes" /></td>
                <td>
                  <button type="button" class="dmc-calc-button dmc-calc-secondary" data-remove-rail disabled aria-label="Remove rail">
                    <span aria-hidden="true">&times;</span>
                  </button>
                </td>
              </tr>
            <tr data-rail-row data-rail-id="transmitter">
              <td><select aria-label="Parent rail" data-rail-field="parent"><option value="battery">Battery</option></select></td>
              <td><input type="text" value="Transmitter rail" aria-label="Rail name" data-rail-field="name" /></td>
              <td><input type="number" min="0" step="0.01" aria-label="Rail voltage" data-rail-field="voltage" /></td>
              <td>
                <select data-rail-field="eff-mode" aria-label="Regulator model">
                  <option value="switching-simple" selected>Switching (fixed eff.)</option>
                  <option value="switching-2pt">Switching (2-point eff.)</option>
                  <option value="linear">Linear (LDO)</option>
                </select>
              </td>
              <td class="dmc-calc-rails-eff-cell">
                <div class="dmc-calc-rails-eff-rows">
                  <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-simple-only">
                    <input type="number" min="0" max="100" step="1" aria-label="Stage efficiency (%)" inputmode="numeric" data-rail-field="efficiency" />
                  </div>
                  <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                    <span>Low:</span>
                    <input type="number" min="0" max="100" step="1" aria-label="Low current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-low-pct" />
                    <span>@</span>
                    <input type="number" min="0" step="0.000001" aria-label="Low current point (mA)" placeholder="mA" data-rail-field="eff-low-current" />
                  </div>
                  <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                    <span>High:</span>
                    <input type="number" min="0" max="100" step="1" aria-label="High current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-high-pct" />
                    <span>@</span>
                    <input type="number" min="0" step="0.000001" aria-label="High current point (mA)" placeholder="mA" data-rail-field="eff-high-current" />
                  </div>
                </div>
              </td>
                <td><span data-rail-effective>&#8212; %</span></td>
                <td><input type="text" placeholder="e.g., PA boost" aria-label="Rail notes" data-rail-field="notes" /></td>
                <td>
                  <button type="button" class="dmc-calc-button dmc-calc-secondary" data-remove-rail aria-label="Remove rail">
                    <span aria-hidden="true">&times;</span>
                  </button>
                </td>
              </tr>
              <tr data-rail-row data-rail-id="receiver">
                <td><select aria-label="Parent rail" data-rail-field="parent"><option value="battery">Battery</option></select></td>
                <td><input type="text" value="Receiver rail" aria-label="Rail name" data-rail-field="name" /></td>
                <td><input type="number" min="0" step="0.01" aria-label="Rail voltage" data-rail-field="voltage" /></td>
                <td>
                  <select data-rail-field="eff-mode" class="dmc-calc-rails-eff-mode" aria-label="Regulator model">
                    <option value="switching-simple" selected>Switching (fixed eff.)</option>
                    <option value="switching-2pt">Switching (2-point eff.)</option>
                    <option value="linear">Linear (LDO)</option>
                  </select>
                </td>
                <td class="dmc-calc-rails-eff-cell">
                  <div class="dmc-calc-rails-eff-rows">
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-simple-only">
                      <input type="number" min="0" max="100" step="1" aria-label="Stage efficiency (%)" inputmode="numeric" data-rail-field="efficiency" />
                      <span>%</span>
                    </div>
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                      <span>Low (% @ mA):</span>
                      <input type="number" min="0" max="100" step="1" aria-label="Low current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-low-pct" />
                      <span>@</span>
                      <input type="number" min="0" step="0.000001" aria-label="Low current point (mA)" placeholder="mA" data-rail-field="eff-low-current" />
                    </div>
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                      <span>High (% @ mA):</span>
                      <input type="number" min="0" max="100" step="1" aria-label="High current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-high-pct" />
                      <span>@</span>
                      <input type="number" min="0" step="0.000001" aria-label="High current point (mA)" placeholder="mA" data-rail-field="eff-high-current" />
                    </div>
                  </div>
                </td>
                <td><span data-rail-effective>&#8212; %</span></td>
                <td><input type="text" placeholder="e.g., LNA, RX path" aria-label="Rail notes" data-rail-field="notes" /></td>
                <td>
                  <button type="button" class="dmc-calc-button dmc-calc-secondary" data-remove-rail aria-label="Remove rail">
                    <span aria-hidden="true">&times;</span>
                  </button>
                </td>
              </tr>
              <tr data-rail-row data-rail-id="core">
                <td><select aria-label="Parent rail" data-rail-field="parent"><option value="battery">Battery</option></select></td>
                <td><input type="text" value="Core rail" aria-label="Rail name" data-rail-field="name" /></td>
                <td><input type="number" min="0" step="0.01" aria-label="Rail voltage" data-rail-field="voltage" /></td>
                <td>
                  <select data-rail-field="eff-mode" class="dmc-calc-rails-eff-mode" aria-label="Regulator model">
                    <option value="switching-simple" selected>Switching (fixed eff.)</option>
                    <option value="switching-2pt">Switching (2-point eff.)</option>
                    <option value="linear">Linear (LDO)</option>
                  </select>
                </td>
                <td class="dmc-calc-rails-eff-cell">
                  <div class="dmc-calc-rails-eff-rows">
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-simple-only">
                      <input type="number" min="0" max="100" step="1" aria-label="Stage efficiency (%)" inputmode="numeric" data-rail-field="efficiency" />
                      <span>%</span>
                    </div>
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                      <span>Low:</span>
                      <input type="number" min="0" max="100" step="1" aria-label="Low current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-low-pct" />
                      <span>@</span>
                      <input type="number" min="0" step="0.000001" aria-label="Low current point (mA)" placeholder="mA" data-rail-field="eff-low-current" />
                    </div>
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                      <span>High:</span>
                      <input type="number" min="0" max="100" step="1" aria-label="High current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-high-pct" />
                      <span>@</span>
                      <input type="number" min="0" step="0.000001" aria-label="High current point (mA)" placeholder="mA" data-rail-field="eff-high-current" />
                    </div>
                  </div>
                </td>
                <td><span data-rail-effective>&#8212; %</span></td>
                <td><input type="text" placeholder="e.g., MCU core" aria-label="Rail notes" data-rail-field="notes" /></td>
                <td>
                  <button type="button" class="dmc-calc-button dmc-calc-secondary" data-remove-rail aria-label="Remove rail">
                    <span aria-hidden="true">&times;</span>
                  </button>
                </td>
              </tr>
              <tr data-rail-row data-rail-id="aux">
                <td><select aria-label="Parent rail" data-rail-field="parent"><option value="battery">Battery</option></select></td>
                <td><input type="text" value="Aux rail" aria-label="Rail name" data-rail-field="name" /></td>
                <td><input type="number" min="0" step="0.01" aria-label="Rail voltage" data-rail-field="voltage" /></td>
                <td>
                  <select data-rail-field="eff-mode" class="dmc-calc-rails-eff-mode" aria-label="Regulator model">
                    <option value="switching-simple" selected>Switching (fixed eff.)</option>
                    <option value="switching-2pt">Switching (2-point eff.)</option>
                    <option value="linear">Linear (LDO)</option>
                  </select>
                </td>
                <td class="dmc-calc-rails-eff-cell">
                  <div class="dmc-calc-rails-eff-rows">
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-simple-only">
                      <input type="number" min="0" max="100" step="1" aria-label="Stage efficiency (%)" inputmode="numeric" data-rail-field="efficiency" />
                      <span>%</span>
                    </div>
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                      <span>Low:</span>
                      <input type="number" min="0" max="100" step="1" aria-label="Low current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-low-pct" />
                      <span>@</span>
                      <input type="number" min="0" step="0.000001" aria-label="Low current point (mA)" placeholder="mA" data-rail-field="eff-low-current" />
                    </div>
                    <div class="dmc-calc-rails-eff-row dmc-calc-rails-eff-adv" style="display: none;">
                      <span>High:</span>
                      <input type="number" min="0" max="100" step="1" aria-label="High current efficiency (%)" inputmode="numeric" placeholder="%" data-rail-field="eff-high-pct" />
                      <span>@</span>
                      <input type="number" min="0" step="0.000001" aria-label="High current point (mA)" placeholder="mA" data-rail-field="eff-high-current" />
                    </div>
                  </div>
                </td>
                <td><span data-rail-effective>&#8212; %</span></td>
                <td><input type="text" placeholder="e.g., LEDs, misc" aria-label="Rail notes" data-rail-field="notes" /></td>
                <td>
                  <button type="button" class="dmc-calc-button dmc-calc-secondary" data-remove-rail aria-label="Remove rail">
                    <span aria-hidden="true">&times;</span>
                  </button>
                </td>
              </tr>
            </tbody>
          </table>
        </div>

        <div class="dmc-calc-modes-actions">
          <button type="button" id="dmc-blc-add-rail" class="dmc-calc-button">
            Add rail
          </button>
          <span class="dmc-calc-muted">
            Enter voltage and regulator parameters per rail so the calculator can translate per-mode currents into battery power.
          </span>
        </div>
      </details>
    </section>

    <!-- Loads definition -->
    <section class="dmc-calc-section" aria-labelledby="dmc-blc-loads-heading">
      <details open class="dmc-calc-collapsible" aria-labelledby="dmc-blc-loads-heading">
        <summary><h2 id="dmc-blc-loads-heading">Loads (peripherals)</h2></summary>
        <p class="dmc-calc-muted">
          Define generic loads such as MCU, sensor, transmitter, or receiver. Each load is powered from one of the
          rails above and appears as a column in the modes table.
        </p>

        <div class="dmc-calc-table-wrapper">
        <table class="dmc-calc-table dmc-calc-loads-table" aria-describedby="dmc-blc-loads-heading">
          <thead>
            <tr>
              <th>Load name</th>
              <th>Rail</th>
              <th>Notes</th>
                <th></th>
              </tr>
            </thead>
            <tbody id="dmc-blc-loads-tbody">
              <!-- Initial loads are seeded from rails in JavaScript -->
            </tbody>
          </table>
        </div>

        <div class="dmc-calc-modes-actions">
          <button type="button" id="dmc-blc-add-load" class="dmc-calc-button">
            Add load
          </button>
          <span class="dmc-calc-muted">
          Loads inherit voltage and cascaded efficiency from their rail; change the rail to move a load between rails.
          </span>
        </div>
      </details>
    </section>

    <section class="dmc-calc-section" aria-labelledby="dmc-blc-topology-heading">
      <details open class="dmc-calc-collapsible" aria-labelledby="dmc-blc-topology-heading">
        <summary><h2 id="dmc-blc-topology-heading">Block diagram</h2></summary>
        <div class="dmc-calc-topology">
          <svg id="dmc-blc-topology-svg" role="img" aria-label="Power rails and loads topology"></svg>
          <p class="dmc-calc-muted" style="margin-top: 0.4rem;">
            Diagram auto-generates from your rails (columns) and loads (final column). Parent rails feed child rails and loads.
          </p>
        </div>
      </details>
    </section>

    <!-- Modes and loads -->
    <section class="dmc-calc-section" aria-labelledby="dmc-blc-modes-heading">
      <details open class="dmc-calc-collapsible" aria-labelledby="dmc-blc-modes-heading">
        <summary><h2 id="dmc-blc-modes-heading">Modes, timing, and load currents</h2></summary>
        <p class="dmc-calc-muted">
          The <strong>first row (Idle)</strong> is always on and fills any time not used by other modes.
          Add additional modes such as Sensor sample, Transmitter burst, and Receiver listen by clicking &#8220;Add mode&#8221; below.
          Each mode specifies a current for each load during its active time; loads inherit voltage and efficiency from their rails above.
        </p>

      <div class="dmc-calc-table-wrapper">
        <table class="dmc-calc-table dmc-calc-modes-table" aria-describedby="dmc-blc-modes-heading">
          <thead id="dmc-blc-modes-thead"></thead>
          <tbody id="dmc-blc-modes-tbody"></tbody>
        </table>
      </div>

      <div class="dmc-calc-modes-actions">
        <button type="button" id="dmc-blc-add-mode" class="dmc-calc-button">
          Add mode
        </button>
        <span class="dmc-calc-muted">
          Modes share a single comparison period based on the longest configured period.
        </span>
      </div>
      <div id="dmc-blc-timing-warning" class="dmc-calc-warning" style="display:none;" role="status" aria-live="polite"></div>
      </details>
    </section>

    <!-- Results -->
    <section class="dmc-calc-section" aria-labelledby="dmc-blc-results-heading">
      <h2 id="dmc-blc-results-heading">Results</h2>
      <div class="dmc-calc-results-grid">
        <div class="dmc-calc-card">
          <h3>Average power</h3>
          <div class="dmc-calc-card-value" id="dmc-blc-avg-power-total">&#8212; uW</div>
          <div class="dmc-calc-card-sub">Time-weighted average across all modes.</div>
        </div>

        <div class="dmc-calc-card">
          <h3>Battery life (hours)</h3>
          <div class="dmc-calc-card-value" id="dmc-blc-life-hours">&#8212; h</div>
          <div class="dmc-calc-card-sub">Based on pack energy and average power.</div>
        </div>

        <div class="dmc-calc-card">
          <h3>Battery life (days / years)</h3>
          <div class="dmc-calc-card-value">
            <span id="dmc-blc-life-days">&#8212; days</span>,
            <span id="dmc-blc-life-years">&#8212; years</span>
          </div>
          <div class="dmc-calc-card-sub">Converted from hours for convenience.</div>
        </div>
      </div>
      <p class="dmc-calc-muted">
        Mode duty, average power, and contribution are shown per row in the modes table above. The chart
        below visualizes how much each mode contributes to the overall average power.
      </p>
      <div class="dmc-calc-mode-bars" aria-label="Mode contribution breakdown">
        <h3>Mode contributions</h3>
        <div id="dmc-blc-mode-bars-body" class="dmc-calc-mode-bars-body">
          <div class="dmc-calc-muted">
            Enter timing and currents above to see how each mode contributes to the total average power.
          </div>
        </div>
      </div>
    </section>

    <script id="dmc-blc-debug-payload" type="application/json" hidden></script>

<!-- Explanation -->
    <section class="dmc-calc-section">
      <div class="dmc-calc-explainer">
        <h2>How this calculator works (conceptually)</h2>
        <p><strong>Big picture</strong>: this is an estimator, not a simulator. It gives a defensible, first-order answer for &#8220;how long will my thing run?&#8221; and teaches how duty cycle, rails, and efficiency play together. Measure on hardware once you have a prototype.</p>
        <div class="dmc-calc-concepts-grid" style="margin-top:0.5rem;">
          <div class="dmc-calc-concept-card">
            <p class="dmc-calc-concept-name">1. Pack energy</p>
            <p class="dmc-calc-concept-detail">
              <em>Energy bucket</em> The model converts battery specs into one budget number:
              <code>Pack_mWh = CellCapacity_mAh * AvgCellVoltage_V * NumCells</code>. This is the full bucket before cutoff and
              chemistry derating.
            </p>
            <p class="dmc-calc-concept-detail">
              <em>How usable energy is estimated</em> For named chemistries with valid min/max cell voltage, the model applies a
              chemistry profile to compute a usable fraction and then uses
              <code>UsablePackEnergy_mWh = Pack_mWh * usable_capacity_fraction</code>. If chemistry or cutoff data is missing, it
              falls back to <code>usable_capacity_fraction = 1</code> instead of guessing.
            </p>
            <p class="dmc-calc-concept-detail">
              <em>Philosophy</em> This is a first-order planning model, not an electrochemical simulator. We intentionally keep one
              average-voltage energy bucket so design tradeoffs are easy to compare and assumptions stay visible.
            </p>
            <p class="dmc-calc-concept-detail">
              <em>Example</em> Two 2500 mAh alkaline cells at 1.3 V average give
              <code>Pack_mWh = 2500 * 1.3 * 2 = 6500 mWh</code>. If cutoff/chemistry gives
              <code>usable_capacity_fraction = 0.8</code>, usable energy is <code>5200 mWh</code>.
            </p>
          </div>

          <div class="dmc-calc-concept-card">
            <p class="dmc-calc-concept-name">2. Duty cycle</p>
            <p class="dmc-calc-concept-detail">
              Comparison window = longest non-idle period. Duty = <code>active_ms / (period_s * 1000)</code>. Idle duty is
              whatever time remains after non-idle modes.
            </p>
            <p class="dmc-calc-concept-detail">
              <em>Example</em> If a sensor sample runs for 250 ms every 60 s, then
              <code>Duty_sample = 250 / 60000 = 0.00417 = 0.417%</code>. If uplink runs 1200 ms every 900 s, then
              <code>Duty_uplink = 1200 / 900000 = 0.133%</code>. Idle gets the remaining time.
            </p>
          </div>

          <div class="dmc-calc-concept-card">
            <p class="dmc-calc-concept-name">3. Rail efficiency</p>
            <p class="dmc-calc-concept-detail">
              <em>Switching (fixed)</em> means one fixed efficiency for that rail: <code>efficiency = eff_pct / 100</code>. If you enter 90%,
              the model assumes about 10% of converter input power is lost as heat at all loads. <em>Switching (2-point)</em> means you enter two
              points from the regulator datasheet <em>Efficiency vs Output Current</em> graph at your expected VIN/VOUT:
              <code>(I_low, Eff_low)</code> and <code>(I_high, Eff_high)</code>. Below <code>I_low</code> the model uses
              <code>Eff_low</code>, above <code>I_high</code> it uses <code>Eff_high</code>, and between them it interpolates in
              log(current) so light-load and heavy-load behavior are both represented. Some datasheets use the Greek symbol
              <code>&eta;</code> for efficiency. <em>Linear (LDO)</em> uses <code>VIN/VOUT</code> behavior plus quiescent current:
              <code>P_in = V_in * (I_out + I_q)</code>.
            </p>
            <p class="dmc-calc-concept-detail">
              <em>Why it matters</em> Efficiency loss becomes heat, and that heat comes from your battery budget. A converter that
              is 90% efficient needs about 11% more input power than the load uses. At low currents, many converters get worse, so
              sleep-heavy products can lose more life than expected if you use one optimistic efficiency number.
            </p>
            <div class="dmc-calc-2pt-demo" role="img" aria-label="Two-point efficiency behavior with logarithmic current response">
              <svg viewBox="0 0 300 122" preserveAspectRatio="xMidYMid meet" aria-hidden="true">
                <rect x="0" y="0" width="300" height="122" fill="#ffffff"></rect>
                <line x1="34" y1="16" x2="34" y2="94" stroke="#c9cfdb" stroke-width="1"></line>
                <line x1="34" y1="94" x2="286" y2="94" stroke="#c9cfdb" stroke-width="1"></line>
                <line x1="78" y1="16" x2="78" y2="94" stroke="#e1e6f0" stroke-width="1"></line>
                <line x1="144" y1="16" x2="144" y2="94" stroke="#e1e6f0" stroke-width="1"></line>
                <line x1="212" y1="16" x2="212" y2="94" stroke="#e1e6f0" stroke-width="1"></line>
                <path d="M42 77 C58 77, 67 77, 74 76 C94 72, 116 61, 136 50 C164 37, 192 32, 220 31 C246 31, 265 31, 278 31" fill="none" stroke="#0057b8" stroke-width="2.4"></path>
                <circle cx="74" cy="76" r="4" fill="#0057b8"></circle>
                <circle cx="220" cy="31" r="4" fill="#0057b8"></circle>
                <line x1="74" y1="16" x2="74" y2="94" stroke="#8a94a8" stroke-dasharray="4 3" stroke-width="1"></line>
                <line x1="220" y1="16" x2="220" y2="94" stroke="#8a94a8" stroke-dasharray="4 3" stroke-width="1"></line>
                <text x="54" y="107" font-size="10.5" fill="#4a4a4a">Low current</text>
                <text x="198" y="107" font-size="10.5" fill="#4a4a4a">High current</text>
                <text x="8" y="23" font-size="10" fill="#666">Efficiency (%)</text>
                <text x="204" y="118" font-size="10" fill="#666">Current (mA, log-like)</text>
              </svg>
            </div>
          </div>

          <div class="dmc-calc-concept-card">
            <p class="dmc-calc-concept-name">4. Power per mode</p>
            <p class="dmc-calc-concept-detail">
              <em>Path efficiency</em> Multiply stage efficiencies up the parent chain to get <code>PathEfficiency</code>.
              <em>Per load</em> compute rail power with
              <code>RailPower_uW = RailVoltage_V * LoadCurrent_mA * 1000</code>; battery-side power is
              <code>BatteryPower_uW = RailPower_uW / PathEfficiency</code>. <em>Per mode</em> sum battery-side load powers:
              <code>ModePower_uW = sum(BatteryPower_uW)</code>.
            </p>
            <p class="dmc-calc-concept-detail">
              <em>Why it matters</em> Cascaded regulators stack losses. If one stage is 90% and the next is 90%, the path is
              <code>0.9 * 0.9 = 0.81</code>, so only 81% of battery power reaches the load. This is why “just add another rail”
              can reduce battery life more than expected.
            </p>
            <p class="dmc-calc-concept-detail">
              <em>Analogy</em> Think of power as water moved through hoses. Each regulator is a hose section with a leak. One small
              leak might be fine, but several leaks in series mean much less water reaches the plant at the end.
            </p>
            <p class="dmc-calc-concept-detail">
              <em>Example</em> A 3.3 V rail load at 2 mA is <code>3.3 * 2 * 1000 = 6600 uW</code>. If regulator path efficiency
              is 85%, battery-side power is <code>6600 / 0.85 = 7765 uW</code>.
            </p>
          </div>

          <div class="dmc-calc-concept-card">
            <p class="dmc-calc-concept-name">5. Time weighting &amp; life</p>
            <p class="dmc-calc-concept-detail">
              <em>Weighting</em> <code>ModeAveragePower_uW = ModePower_uW * DutyFraction</code>; total
              <code>TotalAveragePower_uW = sum(ModeAveragePower_uW)</code>. <em>Life</em>
              <code>Life_h = UsablePackEnergy_mWh * 1000 / TotalAveragePower_uW</code>; UI also shows days/years.
            </p>
            <p class="dmc-calc-concept-detail">
              <em>Example</em> If sleep is 100 uW at 99% duty and active is 50,000 uW at 1% duty, then
              <code>TotalAveragePower_uW = (100 * 0.99) + (50000 * 0.01) = 599 uW</code>. With 6000 mWh usable energy,
              <code>Life_h = 6000 * 1000 / 599 = 10017 h</code> (about 417 days).
            </p>
          </div>
        </div>
<div class="dmc-calc-concepts-grid">
        <div class="dmc-calc-concept-card">
          <p class="dmc-calc-concept-name">Battery chemistry &amp; capacity</p>
          <p class="dmc-calc-concept-detail">
            <em>What it is</em>
            The chemistry (alkaline, Li-ion, coin cell, etc.) sets the usable voltage range and how the cell behaves as it discharges.
            Capacity (mAh) tells you how much charge the battery can deliver at a gentle load.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>Why it matters</em>
            The same device can run for weeks on a tiny coin cell or years on a larger primary lithium pack. Chemistry also affects
            self‑discharge, low‑temperature behavior, and how much of the cell’s capacity is usable at higher currents.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>How to use it here</em>
            Pick a chemistry that roughly matches your cell type. Use datasheet or application‑note values for capacity and voltage.
            Remember this tool assumes “average” voltage; it does not simulate detailed discharge curves.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>What to optimize</em>
            For long life, bigger is not always better. A slightly larger cell that lets your converter operate in a sweet spot
            (good efficiency, enough headroom) often buys more life than just stacking cells at random.
          </p>
        </div>

        <div class="dmc-calc-concept-card">
          <p class="dmc-calc-concept-name">Pack voltage &amp; rails</p>
          <p class="dmc-calc-concept-detail">
            <em>What it is</em>
            Pack voltage is the battery side. Rails are the local supply voltages your circuits actually use (3.3 V digital, 5 V sensor
            bias, 1.8 V core, and so on). Regulators connect the pack to each rail.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>Why it matters</em>
            Every time you convert from the pack to a rail you lose some power in the regulator. Cascaded rails multiply those losses.
            A “simple” rail with 90% efficiency wastes 10% of its input power as heat.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>How to use it here</em>
            Define one row per regulated rail. Use <strong>Switching (fixed eff.)</strong> when you only know one converter efficiency,
            <strong>Switching (2-point eff.)</strong> when data sheets give light-load and heavy-load points, and
            <strong>Linear (LDO)</strong> when you know VIN, VOUT, and quiescent current (Iq).
          </p>
          <p class="dmc-calc-concept-detail">
            <em>What to optimize</em>
            Avoid unnecessary rails and unnecessary cascades. For example, powering a low‑current MCU from a linear regulator off a
            switching pre‑regulator can be fine, but putting a linear on top of another linear wastes a lot of energy.
          </p>
        </div>

        <div class="dmc-calc-concept-card">
          <p class="dmc-calc-concept-name">2-point efficiency model</p>
          <p class="dmc-calc-concept-detail">
            <em>What it is</em>
            Real DC‑DC converters are not flat. They are usually less efficient at very light load, peak somewhere in the middle,
            and droop again near the current limit. Measuring or estimating the full curve is hard.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>Why it matters</em>
            Many IoT devices spend most of their life sipping microamps, then wake up to tens of milliamps briefly. A single
            “typical” efficiency value hides how different those regimes are.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>How to use it here</em>
            Enter a “Low” point (efficiency and current) and a “High” point. The calculator interpolates between them on a log
            current axis so you get a reasonable effective efficiency for each mode’s load current without a full curve.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>What to optimize</em>
            When choosing converters, pay attention to efficiency near your dominant operating currents, not just the headline peak.
            A part that is fantastic at 500 mA but poor at 10 µA may be the wrong choice for a sleepy sensor node.
          </p>
        </div>

        <div class="dmc-calc-concept-card">
          <p class="dmc-calc-concept-name">Modes &amp; duty cycle</p>
          <p class="dmc-calc-concept-detail">
            <em>What it is</em>
            A mode is a named behavior: “Idle,” “Sense,” “Transmit,” “OTA update,” and so on. Each mode has a period (how often it
            happens) and an active time (how long it lasts when it happens).
          </p>
          <p class="dmc-calc-concept-detail">
            <em>Why it matters</em>
            Average power is dominated by the product of power and duty cycle. A very expensive‑looking transmit burst that happens
            for 2 ms once per minute can cost less energy than a “tiny” background current that flows all the time.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>How to use it here</em>
            Enter realistic periods and active times for each behavior. You can select timing units per row
            (ms, s, m, h, d), and the duty column is computed for you from the effective values.
            OTA‑style events can be modeled with long periods (hours, days, months) and finite active times.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>What to optimize</em>
            Design your firmware so that the system spends most of its life in the lowest‑power mode possible. Shorten active time,
            reduce how often expensive modes run, and move work into batch operations instead of frequent small bursts.
          </p>
        </div>

        <div class="dmc-calc-concept-card">
          <p class="dmc-calc-concept-name">Idle mode &amp; background current</p>
          <p class="dmc-calc-concept-detail">
            <em>What it is</em>
            “Idle” is the mode where nothing interesting happens: MCU in sleep, radios off, only keep‑alive circuits running.
            The calculator treats idle specially and fills any time that is not used by other modes.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>Why it matters</em>
            In many IoT designs, idle dominates energy use. Shaving microamps off idle current can extend life more than tweaking
            a high‑power burst that only happens occasionally.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>How to use it here</em>
            The first mode row is fixed as Idle and cannot be removed. Put your sleep/background currents in that row;
            its timing is auto-computed as whatever time remains after non-idle modes.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>What to optimize</em>
            Turn off unneeded clocks and peripherals, use deep‑sleep states where possible, and make sure regulators are still
            efficient at your idle currents. Datasheet “off currents” for sensors and radios are often surprisingly high.
          </p>
        </div>

        <div class="dmc-calc-concept-card">
          <p class="dmc-calc-concept-name">Loads &amp; current estimates</p>
          <p class="dmc-calc-concept-detail">
            <em>What it is</em>
            Loads are the things that draw current on each rail: MCU, radio, sensor front‑end, LEDs, USB, buzzers, and so on. Each
            load can be active or mostly off depending on the mode.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>Why it matters</em>
            Mode current is rarely just “one number.” Splitting by load lets you see which pieces dominate energy use, and how
            moving a load to a different rail or changing hardware affects the whole system.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>How to use it here</em>
            Create a load per major block and assign it to a rail. For each mode, enter the current that block draws while the
            mode is active. Use data sheets, evaluation boards, or quick bench measurements as a starting point.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>What to optimize</em>
            Look for loads that are on in many modes but do not always need to be. Can a sensor be duty‑cycled? Can LEDs flash more
            briefly? Can a radio use a lower TX power in some modes?
          </p>
        </div>

        <div class="dmc-calc-concept-card">
          <p class="dmc-calc-concept-name">Estimator vs. real hardware</p>
          <p class="dmc-calc-concept-detail">
            <em>What it is</em>
            A structured way to do the back‑of‑the‑envelope math you would otherwise keep in a spreadsheet or notebook. It does not
            know about temperature, aging, or detailed battery curves.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>Why it matters</em>
            The goal is to be “right enough” to compare designs and guide experiments: choose between chemistries, rail topologies,
            firmware strategies, and component options before you build hardware.
          </p>
          <p class="dmc-calc-concept-detail">
            <em>How to use it here</em>
            Explore “what if?” questions: What if the radio wakes up twice as often? What if I change the sensor regulator from an
            LDO to a buck? How much life do I lose if my idle current doubles?
          </p>
          <p class="dmc-calc-concept-detail">
            <em>What to verify</em>
            Once you have a prototype, measure currents for each mode and update the model. If estimates and measurements disagree
            by a lot, that is a great learning opportunity—look for missing loads, sleep bugs, and efficiency assumptions.
          </p>
        </div>
      </div>
    </section>
  </div>



<div class="wp-block-group alignwide has-custom-light-blue-background-color has-background is-layout-flow wp-container-core-group-is-layout-dbd34961 wp-block-group-is-layout-flow" style="border-radius:20px;margin-top:var(--wp--preset--spacing--50);margin-bottom:var(--wp--preset--spacing--50);padding-top:var(--wp--preset--spacing--50);padding-right:0;padding-bottom:var(--wp--preset--spacing--50);padding-left:0">
<div class="wp-block-columns alignwide are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-43efaee5 wp-block-columns-is-layout-flex" style="padding-right:var(--wp--preset--spacing--60);padding-left:var(--wp--preset--spacing--60)">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:85%">
<h3 class="wp-block-heading has-text-align-left" id="h-have-an-upcoming-project-dmc-can-help-you-take-the-next-step"><strong>Ready to Maximize Battery Performance?</strong> See How DMC Can Get You Started.</h3>



<p class="has-text-align-left wp-block-paragraph" id="h-need-help-turning-ideas-into-outcomes-automation-project-to-the-next-level-contact-us-today-to-learn-more-about-our-solutions-and-how-we-can-help-you-achieve-your-goals">DMC can help optimize battery-powered products with system design. Learn more about how our <a href="https://static.dmcinfo.com/services/embedded-development-and-embedded-programming/" data-type="page" data-id="431">Embedded</a> team can help with your battery functions.</p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:15%">
<div class="wp-block-buttons is-horizontal is-content-justification-center is-layout-flex wp-container-core-buttons-is-layout-2236275c wp-block-buttons-is-layout-flex">
<div class="wp-block-button is-style-fill"><a class="wp-block-button__link has-base-contrast-color has-text-color has-link-color wp-element-button" href="https://static.dmcinfo.com/contact/">Contact Us</a></div>
</div>
</div>
</div>
</div>
<p>The post <a href="https://static.dmcinfo.com/blog/41922/battery-life-calculator/">Battery Life Calculator</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MOSFET Power Loss Calculator</title>
		<link>https://static.dmcinfo.com/blog/17021/mosfet-power-loss-calculator/</link>
		
		<dc:creator><![CDATA[Tim Jager]]></dc:creator>
		<pubDate>Mon, 27 Nov 2023 09:10:29 +0000</pubDate>
				<category><![CDATA[Circuit Design]]></category>
		<category><![CDATA[Embedded Development & Programming]]></category>
		<category><![CDATA[Low-Power Embedded Design]]></category>
		<category><![CDATA[MOSFET]]></category>
		<category><![CDATA[online calculator]]></category>
		<category><![CDATA[Power Dissipation]]></category>
		<category><![CDATA[Power loss]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/17021/mosfet-power-loss-calculator/</guid>

					<description><![CDATA[<p>Online MOSFET Power Loss/Dissipation Calculator and Guide for Engineers In the world of power electronics, understanding and minimizing power losses in Metal-Oxide-Semiconductor Field-Effect Transistors (MOSFETs) is crucial for optimizing efficiency and performance. This guide explains the basics of calculating various types of power losses in MOSFETs, including conduction, switching, reverse recovery, deadtime, and gate charge [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/17021/mosfet-power-loss-calculator/">MOSFET Power Loss Calculator</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<style>
    table input[type="number"],
    table select,
    table input[type="text"] {
      font-size: 14px;
      padding: 4px 6px;
      min-width: 90px;
    }
    #share-tools {
      margin: 12px 0 20px 0;
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }
    #project_name,
    #share_button,
    #share_link {
      font-size: 14px;
      padding: 4px 6px;
      height: 28px;
      box-sizing: border-box;
    }
    #project_name {
      min-width: 240px;
    }
    #share_link {
      flex: 1 1 260px;
      min-width: 260px;
      max-width: 520px;
    }
    #project-name-row {
      margin: 8px 0 12px 0;
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }
    #loss-bar-container {
      margin: 14px 0 6px 0;
      width: 100%;
      max-width: 1100px;
    }
    #loss-bar {
      display: flex;
      height: 20px;
      border: 1px solid #ccc;
      border-radius: 4px;
      overflow: hidden;
      background: #f5f5f5;
    }
    .loss-segment {
      height: 100%;
      min-width: 0;
    }
    #loss-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 8px 16px;
      margin-top: 6px;
      font-size: 12px;
    }
    .loss-legend-item {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .loss-swatch {
      width: 12px;
      height: 12px;
      border-radius: 2px;
      display: inline-block;
    }
    #thermal-container {
      margin: 18px 0 10px 0;
      width: 100%;
    }
    #thermal-table {
      border: 1px solid #ccc;
      border-collapse: collapse;
      width: 100%;
    }
    #thermal-table th,
    #thermal-table td {
      border: 1px solid #ccc;
      padding: 6px;
      text-align: left;
      vertical-align: middle;
    }
    #thermal-table input,
    #thermal-table select {
      padding: 4px 6px;
      font-size: 14px;
      min-width: 90px;
    }
    #thermal-table .help {
      font-size: 14px;
      color: #444;
    }
    #thermal-status {
      font-weight: 600;
    }
    #main-table,
    #thermal-table {
      width: 100%;
      box-sizing: border-box;
    }
    /* Keep main and thermal tables aligned */
    col.col-param { width: 22%; }
    col.col-value { width: 22%; }
    col.col-units { width: 15%; }
    /* Consistent cell styling across both tables */
    #main-table th,
    #main-table td,
    #thermal-table th,
    #thermal-table td {
      padding: 6px;
      text-align: left;
      vertical-align: middle;
      border: 1px solid #ccc;
      font-size: 18px;
      font-family: inherit;
    }
    /* Definition blocks as cards */
    .param-block {
      margin: 12px 0;
      padding: 12px 16px;
      border: 1px solid #ddd;
      border-radius: 20px;
      background: #fafafa;
    }
    /* Parameter name at the top of each card */
    .param-name {
      margin: 0 0 6px 0;
      font-weight: 600;
      font-size: 15px;
    }
    /* A row: label on left, text on right */
    .param-detail {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      margin: 6px 0;
      font-size: 16px;
      line-height: 1.5;
    }
    /* Left column: fixed width, bold label */
    .param-detail em {
      font-style: normal;
      font-weight: 600;
      color: #333;
      flex: 0 0 130px;
      text-align: right;
    }
    /* Right column: fill remaining width */
    .param-detail span {
      flex: 1;
    }
    /* Calculation blocks styled similarly to cards */
    .calculation-block {
      margin: 16px 0;
      padding: 12px 16px;
      border: 1px solid #ddd;
      border-radius: 20px;
      background: #fdfdfd;
    }
    .calculation-block h4 {
      margin-top: 0;
      margin-bottom: 8px;
    }
    .formula {
      display: inline-block;
      margin: 4px 0;
      padding: 4px 8px;
      font-weight: 600;
      font-family: Consolas, "Courier New", monospace;
      font-size: 14px;
      border-radius: 3px;
      background: #f3f3f3;
    }
    /* Consistent heading spacing in definitions section */
    h3.wp-block-heading {
      margin-top: 24px;
      margin-bottom: 8px;
    }
    h4.wp-block-heading {
      font-size: 16px;
      margin-top: 0;
      margin-bottom: 6px;
    }
    @media (max-width: 600px) {
      table input[type="number"],
      table select,
      table input[type="text"] {
        font-size: 8px;
        padding: 2px 4px;
        min-width: 40px;
      }
      #main-table th,
        #main-table td,
        #thermal-table th,
        #thermal-table td {
          padding: 4px;
          font-size: 8px;
        }
        #thermal-table .help {
          font-size: 8px;
        }
        #thermal-table input, #thermal-table select {
          padding: 2px 4px;
          font-size: 8px;
          min-width: 40px;
        }
    }
  </style>
<div id="calc-container">
<h2 class="wp-block-heading">Online MOSFET Power Loss/Dissipation Calculator and Guide for Engineers</h2>

<p>In the world of power electronics, understanding and minimizing power losses in Metal-Oxide-Semiconductor Field-Effect Transistors (MOSFETs) is crucial for optimizing efficiency and performance. This guide explains the basics of calculating various types of power losses in MOSFETs, including conduction, switching, reverse recovery, deadtime, and gate charge losses.</p>

<h3 class="wp-block-heading">MOSFET Power Loss Calculator <span id="share_status" style="margin-left: 8px; font-size: 0.9em; color: #555;"></span></h3>
<div class="calc-inner">
<div id="project-name-row">
  <label for="project_name"><strong>Project Name:</strong></label>
  <input id="project_name" oninput="handleProjectNameInput()" type="text" maxlength="30" placeholder="Required for sharing" />
  <button id="share_button" type="button" onclick="copyShareLink()" disabled>Copy shareable link</button>
  <input aria-label="Shareable link" id="share_link" readonly type="text" style="flex:1 1 260px; max-width: 520px;" />
</div>
<div id="loss-bar-container">
  <div><strong>Power Loss Breakdown (largest to smallest)</strong></div>
  <div id="loss-bar">
    <div id="seg_cond" class="loss-segment" style="background:#d62728; width: 16.6%;"></div>
    <div id="seg_sw" class="loss-segment" style="background:#ff7f0e; width: 16.6%;"></div>
    <div id="seg_rr" class="loss-segment" style="background:#f2c94c; width: 16.6%;"></div>
    <div id="seg_dt" class="loss-segment" style="background:#2ca02c; width: 16.6%;"></div>
    <div id="seg_gate" class="loss-segment" style="background:#17becf; width: 16.6%;"></div>
    <div id="seg_coss" class="loss-segment" style="background:#1f77b4; width: 16.6%;"></div>
  </div>
  <div id="loss-legend">
    <span id="legend_cond" class="loss-legend-item"><span class="loss-swatch" style="background:#d62728;"></span><span class="loss-label-text">Conduction</span></span>
    <span id="legend_sw" class="loss-legend-item"><span class="loss-swatch" style="background:#ff7f0e;"></span><span class="loss-label-text">Switching</span></span>
    <span id="legend_rr" class="loss-legend-item"><span class="loss-swatch" style="background:#f2c94c;"></span><span class="loss-label-text">Reverse Recovery</span></span>
    <span id="legend_dt" class="loss-legend-item"><span class="loss-swatch" style="background:#2ca02c;"></span><span class="loss-label-text">Deadtime</span></span>
    <span id="legend_gate" class="loss-legend-item"><span class="loss-swatch" style="background:#17becf;"></span><span class="loss-label-text">Gate Charge</span></span>
    <span id="legend_coss" class="loss-legend-item"><span class="loss-swatch" style="background:#1f77b4;"></span><span class="loss-label-text">Output Capacitance</span></span>
  </div>
</div>
</div>
<!-- Table with input fields and loss calculations -->
  <table id="main-table" border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse: collapse; width: 100%;">
  <colgroup>
    <col class="col-param">
    <col class="col-value">
    <col class="col-units">
    <col>
  </colgroup>
  <tbody>
    <tr>
    <th style="text-align: left"><strong>Parameter</strong></th>
    <th style="text-align: left"><strong>Value</strong></th>
    <th style="text-align: left"><strong>Units</strong></th>
    <th style="text-align: left"><strong>Description</strong></th>
    </tr>
    <tr>
    <td>Vbus</td>
    <td><input id="v_bus" onchange="calculateLosses()" type="number" value="24" /></td>
    <td>Volts</td>
    <td>Bus voltage</td>
    </tr>
    <tr>
    <td>Current</td>
    <td><input id="current" onchange="calculateLosses()" type="number" value="10" /></td>
    <td>Amps</td>
    <td>Current</td>
    </tr>
    <tr>
    <td>f_sw</td>
    <td><input id="f_sw" onchange="calculateLosses()" type="number" value="24" /></td>
    <td><select id="f_sw_unit" onchange="calculateLosses()"><option value="1e3">kHz</option><option value="1e0">Hz</option> </select></td>
    <td>Switching frequency</td>
    </tr>
    <tr>
    <td>Vgate_drive</td>
    <td><input id="v_gate_drive" onchange="calculateLosses()" type="number" value="10" /></td>
    <td>Volts</td>
    <td>Gate drive voltage</td>
    </tr>
    <tr>
    <td>Rds(on)</td>
    <td><input id="rdson" onchange="calculateLosses()" type="number" value="2.8" /></td>
    <td><select id="t_rdson_unit" onchange="calculateLosses()"><option value="1e-3">mOhms</option><option value="1">Ohms</option> </select></td>
    <td>Drain-to-source on resistance</td>
    </tr>
    <tr>
    <td>Qg</td>
    <td><input id="q_g" onchange="calculateLosses()" type="number" value="38" /></td>
    <td><select id="q_g_unit" onchange="calculateLosses()"><option value="1e-9">nC</option><option value="1e-6">&micro;C</option> </select></td>
    <td>Gate charge total</td>
    </tr>
    <tr>
    <td>Td(on)</td>
    <td><input id="t_d_on" onchange="calculateLosses()" type="number" value="120" /></td>
    <td><select id="t_d_on_unit" onchange="calculateLosses()"><option value="1e-9">ns</option><option value="1e-6">&micro;s</option> </select></td>
    <td>Turnon delay time</td>
    </tr>
    <tr>
    <td>Tr</td>
    <td><input id="t_rise" onchange="calculateLosses()" type="number" value="22" /></td>
    <td><select id="t_rise_unit" onchange="calculateLosses()"><option value="1e-9">ns</option><option value="1e-6">&micro;s</option> </select></td>
    <td>Rise time</td>
    </tr>
    <tr>
    <td>Td(off)</td>
    <td><input id="t_d_off" onchange="calculateLosses()" type="number" value="120" /></td>
    <td><select id="t_d_off_unit" onchange="calculateLosses()"><option value="1e-9">ns</option><option value="1e-6">&micro;s</option> </select></td>
    <td>Turn-off delay</td>
    </tr>
    <tr>
    <td>Tf</td>
    <td><input id="t_fall" onchange="calculateLosses()" type="number" value="6" /></td>
    <td><select id="t_fall_unit" onchange="calculateLosses()"><option value="1e-9">ns</option><option value="1e-6">&micro;s</option> </select></td>
    <td>Fall time</td>
    </tr>
    <tr>
    <td>Qrr</td>
    <td><input id="q_rr" onchange="calculateLosses()" type="number" value="12" /></td>
    <td><select id="q_rr_unit" onchange="calculateLosses()"><option value="1e-9">nC</option><option value="1e-6">&micro;C</option> </select></td>
    <td>Reverse recovery charge</td>
    </tr>
    <tr>
    <td>Vsd</td>
    <td><input id="v_fv" onchange="calculateLosses()" type="number" value="1.0" /></td>
    <td>Volts</td>
    <td>Body diode Forward Voltage</td>
    </tr>
    <tr>
    <td>Coss</td>
    <td><input id="c_oss" onchange="calculateLosses()" type="number" value="150" /></td>
    <td><select id="c_oss_unit" onchange="calculateLosses()"><option value="1e-12">pF</option><option value="1e-9">nF</option> </select></td>
    <td>Output capacitance of the MOSFET</td>
    </tr>
    <tr>
    <td>Conduction Loss (P_cond)</td>
    <td id="p_cond">&nbsp;</td>
    <td>Watts</td>
    <td>Power loss due to conduction</td>
    </tr>
    <tr>
    <td>Switching Loss (P_sw)</td>
    <td id="p_sw">&nbsp;</td>
    <td>Watts</td>
    <td>Power loss during switching</td>
    </tr>
    <tr>
    <td>Reverse Recovery Loss (P_rr)</td>
    <td id="p_rr">&nbsp;</td>
    <td>Watts</td>
    <td>Power loss due to reverse recovery of the body diode</td>
    </tr>
    <tr>
    <td>Deadtime Loss (P_dt)</td>
    <td id="p_dt">&nbsp;</td>
    <td>Watts</td>
    <td>Power loss during deadtime</td>
    </tr>
    <tr>
    <td>Gate Charge Loss (P_gate)</td>
    <td id="p_gate">&nbsp;</td>
    <td>Watts</td>
    <td>Power loss due to gate charge</td>
    </tr>
    <tr>
    <td><em><strong>Total MOSFET Power Loss</strong></em></td>
    <td id="total_loss">&nbsp;</td>
    <td><em><strong>Watts</strong></em></td>
    <td><em><strong>Total power loss in MOSFET</strong></em></td>
    </tr>
    <!-- <tr>
        <td>Gate Driver Power Loss (P_driver)</td>
        <td id="p_driver">&nbsp;</td>
        <td>Watts</td>
        <td>Power loss due to driving the gate</td>
      </tr> -->
  </tbody>
  </table>
<div id="thermal-container">
  <div><strong>Thermal Check (does not affect power loss calculations)</strong></div>
  <p style="margin: 6px 0 4px 0; font-size: 13px;">
    The thermal section does a quick “what will my junction temperature be?” check using the total power loss you calculated. You supply the thermal resistances and ambient temp; it multiplies total loss by the chosen R&theta;, adds ambient, and shows ΔT, estimated Tj, and whether you’re under your limit.
  </p>
  <p style="margin: 0 0 8px 0; font-size: 13px;">
    Not sure which numbers to use? R&theta;JA comes straight from the MOSFET datasheet and assumes the part is soldered to the datasheet&#8217;s test PCB (usually no custom heatsink). R&theta;JC is also from the datasheet (junction to the case). R&theta;CA is your own path from case to ambient; your heatsink, board, and airflow. If you don’t have a heatsink model, pick R&theta;JA. If you do, choose R&theta;JC + R&theta;CA so the heatsink path is included.
  </p>
  <table id="thermal-table" style="width: 100%;">
    <colgroup>
      <col class="col-param">
      <col class="col-value">
      <col class="col-units">
      <col>
    </colgroup>
    <tbody>
      <tr>
        <th style="text-align: left;"><strong>Parameter</strong></th>
        <th style="text-align: left;"><strong>Value</strong></th>
        <th style="text-align: left;"><strong>Units</strong></th>
        <th style="text-align: left;"><strong>Description / Help</strong></th>
      </tr>
      <tr>
        <td>Mode</td>
        <td>
          <select id="thermal_mode" onchange="updateThermalMode(); calculateThermal(lastTotalLoss);">
            <option value="ja">Use RθJA (datasheet)</option>
            <option value="jc">Use RθJC + RθCA</option>
          </select>
        </td>
        <td>&#8211;</td>
        <td class="help">JA = datasheet junction-to-ambient (often bare PCB). JC+CA = datasheet junction-to-case plus your heatsink/board path.</td>
      </tr>
      <tr>
        <td>RθJA</td>
        <td><input id="theta_ja" type="number" value="35" onchange="calculateThermal(lastTotalLoss)" /></td>
        <td>°C/W</td>
        <td class="help">Datasheet Junction-to-Ambient. Soldered to PCB, no custom heatsink model.</td>
      </tr>
      <tr>
        <td>RθJC</td>
        <td><input id="theta_jc" type="number" value="1.5" onchange="calculateThermal(lastTotalLoss)" /></td>
        <td>°C/W</td>
        <td class="help">Datasheet Junction-to-Case.</td>
      </tr>
      <tr>
        <td>RθCA</td>
        <td><input id="theta_ca" type="number" value="10" onchange="calculateThermal(lastTotalLoss)" /></td>
        <td>°C/W</td>
        <td class="help">Case-to-Ambient for your heatsink/board/airflow.</td>
      </tr>
      <tr>
        <td>T<sub>amb</sub></td>
        <td><input id="t_amb" type="number" value="25" onchange="calculateThermal(lastTotalLoss)" /></td>
        <td>°C</td>
        <td class="help">Ambient temperature around the MOSFET.</td>
      </tr>
      <tr>
        <td>T<sub>J,limit</sub></td>
        <td><input id="t_j_limit" type="number" value="125" onchange="calculateThermal(lastTotalLoss)" /></td>
        <td>°C</td>
        <td class="help">Chosen max junction temperature (125 to 150°C typical).</td>
      </tr>
      <tr>
        <td>ΔT</td>
        <td><span id="delta_t">&#8211;</span></td>
        <td>°C</td>
        <td class="help">Temperature rise from total loss × thermal resistance.</td>
      </tr>
      <tr>
        <td>Estimated T<sub>J</sub></td>
        <td><span id="t_j">&#8211;</span></td>
        <td>°C</td>
        <td class="help">T<sub>amb</sub> + ΔT. First-order estimate.</td>
      </tr>
      <tr>
        <td>Rθ used</td>
        <td><span id="theta_used">&#8211;</span></td>
        <td>°C/W</td>
        <td class="help">The active path (JA or JC+CA) used for the estimate.</td>
      </tr>
      <tr>
        <td>Status</td>
        <td colspan="3"><span id="thermal-status" style="color: #444;">Enter values to estimate junction temperature.</span></td>
      </tr>
    </tbody>
  </table>
</div>

<h2 class="wp-block-heading">&nbsp;</h2>

<h2 class="wp-block-heading">Parameter Definitions &amp; Loss Formulas</h2>

<h3 class="wp-block-heading">Electrical Parameters</h3>

<div class="param-block">
  <p class="param-name"><strong>Vbus</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The bus or supply voltage applied across the MOSFET and its load. It is the electrical &#8220;push&#8221; driving power through the system.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>A power stage needs a voltage source to move energy. Vbus sets the maximum voltage the MOSFET must block and switch.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Higher Vbus reduces current for the same power which lowers conduction loss. At the same time, higher Vbus increases switching loss because the MOSFET spends time switching with both voltage and current present. It also stores more energy in the MOSFET internal capacitances that must be charged and discharged every cycle, and MOSFETs rated for higher voltage usually have worse on resistance and higher cost.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Higher Vbus improves conduction efficiency but raises switching stress. Lower Vbus helps switching efficiency but increases current. Choose Vbus based on topology, switching frequency, and power level.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Pick MOSFETs with enough voltage headroom, minimize stray inductance in layout, and select a switching frequency that balances conduction and switching losses.</span>
</p>
</div>

<div class="param-block">
  <p class="param-name"><strong>Current</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The current flowing through the MOSFET when it is on. This is the MOSFET main job, passing load current from drain to source.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The MOSFET forms the controlled conduction path that sends energy to the load.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Conduction loss rises with the square of current. Higher current increases temperature rise and stresses the package, and layout resistance becomes more important as current climbs.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Your system voltage and power requirements set the current. The MOSFET must be chosen to handle this current without excessive heating.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Use thicker copper, shorten high current paths, parallel MOSFETs when needed, or increase Vbus to reduce required current.</span>
</p>
</div>

<div class="param-block">
  <p class="param-name"><strong>f_sw</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The switching frequency. It is how many times per second the MOSFET turns on and off.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>Switching allows the converter to control voltage and power. The frequency sets how quickly regulation can respond.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Higher frequency shrinks magnetics which saves size, but higher frequency increases switching loss because the MOSFET transitions more often and increases heating and EMI.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Frequency is a major efficiency lever. Use the lowest frequency that still meets your size, noise, and control requirements.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Use MOSFETs with fast transitions, improve layout to reduce ringing, and use a gate driver with enough current for your chosen frequency.</span>
</p>
</div>

<div class="param-block">
  <p class="param-name"><strong>Vgate_drive</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The gate to source voltage applied by the gate driver. It controls how strongly the MOSFET turns on.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>A MOSFET channel forms only when the gate is charged. Higher gate voltage strengthens the channel.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Higher gate drive reduces on resistance. Very high gate drive increases gate charge loss and can damage the gate if it exceeds limits, and too low gate drive prevents full enhancement which increases heating.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Use the recommended gate drive voltage from the datasheet. More is not always better.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Use a gate driver capable of delivering enough current, ensure clean gate traces, and follow safe operating limits for the MOSFET.</span>
</p>
</div>

<div class="param-block">
  <p class="param-name"><strong>Rds(on)</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The drain to source resistance when the MOSFET is fully on. It is an unavoidable resistive component of the channel.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The channel is made of doped silicon and has finite resistance. Larger silicon area reduces this resistance.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Lower Rds(on) reduces conduction loss directly. Larger die area that gives low resistance often increases gate charge and capacitance, which can increase switching loss, and Rds(on) increases as temperature rises.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Lower Rds(on) is great for high current or low frequency designs. At higher frequency you balance Rds(on) with switching performance.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Choose MOSFETs with balanced Rds(on) and gate charge, keep the device cool, and use the recommended gate drive voltage.</span>
</p>
</div>

<div class="param-block">
  <p class="param-name"><strong>Qg</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The total gate charge needed per switching cycle. It tells you how much effort it takes to turn the MOSFET on and off.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The gate behaves like a capacitor. Moving charge in and out shifts the device state.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Higher Qg slows switching if the driver cannot supply enough current and increases gate drive loss. Reducing Qg often increases on resistance.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Low Qg is helpful at high frequency. For low frequency converters it is less critical.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Use a strong gate driver, keep gate traces short, and choose MOSFETs with a good balance of Qg and Rds(on).</span>
</p>
</div>

<div class="param-block">
  <p class="param-name"><strong>Td(on) and Td(off)</strong></p>
  <p class="param-detail">
  <em>What they are</em>
  <span>The delays before the MOSFET begins turning on or off after the gate signal changes.</span>
</p>
  <p class="param-detail">
  <em>Why they exist</em>
  <span>Internal capacitances and the structure of the gate region create brief delays.</span>
</p>
  <p class="param-detail">
  <em>How they affect performance</em>
  <span>Long delays increase deadtime which forces the body diode to conduct. Excessive delay reduces efficiency and raises diode stress.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Shorter delays improve efficiency in synchronous converters.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize them</em>
  <span>Use a faster gate driver, ensure clean signals, and avoid unnecessary gate trace length.</span>
</p>
</div>

<div class="param-block">
  <p class="param-name"><strong>Tr and Tf</strong></p>
  <p class="param-detail">
  <em>What they are</em>
  <span>The rise and fall times during switching transitions. These define how long the MOSFET spends in the region where both voltage and current are present.</span>
</p>
  <p class="param-detail">
  <em>Why they exist</em>
  <span>Gate charge, driver strength, and internal capacitances limit how fast the MOSFET can transition.</span>
</p>
  <p class="param-detail">
  <em>How they affect performance</em>
  <span>Longer transition times increase switching loss. Very fast transitions reduce loss but can cause noise and ringing.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>You want transitions that are fast enough for efficiency but not so fast that EMI or overshoot becomes a problem.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize them</em>
  <span>Tune gate resistance, use proper PCB layout, and pick MOSFETs with suitable switching characteristics.</span>
</p>
</div>

<div class="param-block">
  <p class="param-name"><strong>Qrr</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The reverse recovery charge of the MOSFET body diode. It is the leftover charge that must be removed when the diode stops conducting.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The diode stores charge while it conducts. That charge does not disappear instantly when current reverses.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Higher Qrr causes current spikes and additional heating and hurts efficiency in fast switching applications.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Low Qrr is important in synchronous converters and high frequency designs.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Choose MOSFETs with optimized body diodes or move to devices with inherently low Qrr such as superjunction or wide bandgap parts.</span>
</p>

</div>

<div class="param-block">
  <p class="param-name"><strong>Vsd</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The forward voltage drop of the MOSFET body diode when it conducts.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The diode is built into the MOSFET structure and conducts during deadtime or reverse current events.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Higher Vsd increases loss during deadtime and the diode heats up more at high current or long deadtime intervals.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Low Vsd is helpful when the diode conducts often, but Qrr typically matters more at high frequency.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Use MOSFETs with optimized diode behavior and minimize deadtime.</span>
</p>

</div>

<div class="param-block">
  <p class="param-name"><strong>Coss</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The output capacitance between drain and source. It stores energy that must be moved during switching.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The MOSFET internal structure forms parasitic capacitors.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Higher Coss increases energy loss each time the MOSFET switches, affects switching speed and voltage overshoot, and Coss loss rises quickly with higher bus voltage.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Low Coss is valuable in high voltage, high frequency applications.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Use MOSFETs designed for low capacitance, reduce switching frequency, and keep layout inductance low.</span>
</p>

</div>

<h3 class="wp-block-heading">Thermal Parameters</h3>

<div class="param-block">
  <p class="param-name"><strong>R&theta;JA</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The junction-to-ambient thermal resistance from the datasheet. It tells you how many degrees the silicon junction will rise for each watt of power the MOSFET dissipates on the specified test PCB with no special heatsink.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>Any real device has to dump its heat into the surrounding air. The package, solder, and PCB copper form a thermal path that resists heat flow, similar to how an electrical resistor resists current.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>A higher R&theta;JA means the junction gets hotter for the same power loss, reducing safety margin and lifetime. A lower R&theta;JA keeps the device cooler and lets you safely run more current or accept higher losses.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>R&theta;JA is most accurate when your mounting and PCB look like the datasheet test conditions. In dense layouts with many hot parts or different airflow, the real effective thermal resistance can be worse.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Use wider copper areas, thermal vias, thicker copper, and avoid trapping hot air around the device. If R&theta;JA alone is not low enough, move to a package that can connect to a heatsink and use the R&theta;JC + R&theta;CA path instead.</span>
</p>
 
</div>

<div class="param-block">
  <p class="param-name"><strong>R&theta;JC</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The junction-to-case thermal resistance from the datasheet. It describes how easily heat flows from the silicon junction into the package case or exposed pad that touches your heatsink or PCB.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>Between the silicon and the outside world there are die attach materials, leadframe, and package plastic, all of which slow heat flow and add thermal resistance.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Lower R&theta;JC means the junction tracks closer to the case temperature, so a good heatsink can keep the die much cooler. High R&theta;JC limits how effective your heatsink or copper plane can be.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>R&theta;JC is the key number when you plan to mount the MOSFET on a heatsink or heavy copper area. It lets you estimate junction temperature starting from measured or simulated case temperature.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Choose packages with low R&theta;JC (for example power packages with exposed pads), mount them with good thermal interface material, and follow layout recommendations so the thermal pad is fully soldered.</span>
</p>
 
</div>

<div class="param-block">
  <p class="param-name"><strong>R&theta;CA</strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The case-to-ambient thermal resistance for your specific cooling path: heatsink, PCB copper, thermal interface material, and airflow.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>Heat leaving the case must travel through metal, interface material, and surrounding air. Each of these adds resistance to heat flow, just like resistors in series.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Lower R&theta;CA means the case runs closer to ambient temperature for a given power loss, giving the junction more headroom. Poor heatsinking (high R&theta;CA) quickly pushes junction temperature toward its limit.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Combined with R&theta;JC, it sets the effective junction-to-ambient resistance of your custom design (R&theta;JA &approx; R&theta;JC + R&theta;CA). It drives decisions about heatsink size, airflow, and board copper area.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Use larger or more efficient heatsinks, add airflow, choose good thermal interface materials, and design PCBs with solid copper areas and thermal vias under the device.</span>
</p>
 
</div>

<div class="param-block">
  <p class="param-name"><strong>T<sub>amb</sub></strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The ambient air temperature around the MOSFET, usually the air just outside the board or heatsink rather than room temperature measured far away.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>Heat can only flow into something cooler. The temperature of the surrounding air sets the starting point for how far the junction can rise before reaching its limit.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Higher ambient temperature raises junction temperature for the same power loss and thermal resistance, reducing safety margin. Cooler ambient gives you more headroom for power or lifetime.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>You must use realistic ambient assumptions for your product environment, not just 25&nbsp;&deg;C lab conditions. Enclosures, nearby hot components, and limited airflow all make the effective ambient hotter.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Improve airflow, separate hot parts, avoid enclosing the MOSFET in small sealed spaces, and consider derating current or power for worst-case ambient conditions.</span>
</p>
 
</div>

<div class="param-block">
  <p class="param-name"><strong>T<sub>J,limit</sub></strong></p>
  <p class="param-detail">
  <em>What it is</em>
  <span>The maximum junction temperature you are willing to allow, often chosen below the absolute maximum rating in the datasheet.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>Semiconductor reliability and lifetime drop sharply as temperature rises. The datasheet absolute maximum is a do-not-exceed value, not a comfortable operating point.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>A higher chosen T<sub>J,limit</sub> lets you run more loss or current but reduces lifetime margin. A lower T<sub>J,limit</sub> improves reliability but may require a better MOSFET or stronger cooling.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Picking T<sub>J,limit</sub> is a design trade-off between efficiency, cost, and reliability. Safety standards or company guidelines may define the maximum allowed junction temperature for long-life products.</span>
</p>
  <p class="param-detail">
  <em>Practical ways to optimize it</em>
  <span>Start from datasheet limits and application requirements, then adjust MOSFET selection and cooling so the estimated Tj under worst-case conditions stays below your chosen limit with some margin.</span>
</p>
 
</div>

<h3 class="wp-block-heading">Power Loss Calculations</h3>

<div class="calculation-block">
<h4 class="wp-block-heading">Conduction Loss (P_cond)</h4>

<p class="param-detail">
  <em>What it represents</em>
  <span>Losses when the MOSFET is fully on and simply carrying current. This is the resistive heating from Rds(on).</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The MOSFET channel behaves like a small resistor when on, so any current through it creates I&sup2;R heating.</span>
</p>
<p class="param-detail">
  <em>Formula</em>
  <span>For a simple case with constant current:<br />
  <span class="formula"><code>P_cond = Current^2 &times; Rds(on)</code></span><br />
  In real converters you often use RMS current and include duty cycle. The calculator can account for that behind the scenes if extended.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Grows with the square of current, so higher current hurts a lot. Increases with temperature because Rds(on) rises as the device heats up, and tends to dominate loss in low frequency, high current designs.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Conduction loss is often the first thing to check in high current systems. It pushes you toward lower Rds(on), better cooling, or higher Vbus to reduce current.</span>
</p>
<p class="param-detail">
  <em>Practical tips</em>
  <span>Choose MOSFETs with suitable Rds(on), keep them cool so resistance stays low, and use thick copper and short traces to avoid extra resistive loss.</span>
</p>
</div>

<div class="calculation-block">
<h4 class="wp-block-heading">Overlap Switching Loss (P_sw)</h4>

<p class="param-detail">
  <em>What it represents</em>
  <span>Losses while the MOSFET is turning on and off. In this time the device sees both significant voltage and current.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The MOSFET cannot jump instantly from off to on. During each transition it passes through a region where it is partially on and the product of voltage and current creates heat.</span>
</p>
<p class="param-detail">
  <em>Formula</em>
  <span>A common approximation for hard switching is:<br />
  <span class="formula"><code>P_sw = 0.5 &times; Vbus &times; Current &times; (Tr + Tf) &times; f_sw</code></span><br />
  Where Tr and Tf are the rise and fall times. This calculator also adds a capacitance related term consistent with the Coss model below.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Increases linearly with bus voltage, current, and frequency, and increases with longer rise and fall times. It becomes dominant in many high frequency converters.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Once switching loss dominates, simply lowering Rds(on) does not help much. You need faster switching devices, stronger gate drive, or lower frequency.</span>
</p>
<p class="param-detail">
  <em>Practical tips</em>
  <span>Use a strong gate driver, keep gate loops tight, tune gate resistance to balance speed and EMI, and avoid unnecessarily high switching frequencies.</span>
</p>
</div>

<div class="calculation-block">
<h4 class="wp-block-heading">Reverse Recovery Loss (P_rr)</h4>

<p class="param-detail">
  <em>What it represents</em>
  <span>Loss caused by the body diode inside the MOSFET when it turns off and dumps its stored charge.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>When the diode conducts, charge accumulates in its junction. When current reverses, that charge must be removed which causes a brief extra current spike and extra heating.</span>
</p>
<p class="param-detail">
  <em>Formula</em>
  <span>A common approximation is:<br />
  <span class="formula"><code>P_rr = Qrr &times; Vbus &times; f_sw</code></span></span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Grows with bus voltage and switching frequency, shows up as current spikes and ringing that stress components and cause EMI, and matters much more in fast synchronous converters than in slow or diode based designs.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Reverse recovery can quietly dominate losses at high frequency even when Rds(on) looks good on paper. Low Qrr becomes a key selection parameter.</span>
</p>
<p class="param-detail">
  <em>Practical tips</em>
  <span>Choose MOSFETs with low Qrr body diodes, consider wide bandgap devices for very high frequency, and keep loop inductance low to reduce overshoot during recovery.</span>
</p>
</div>

<div class="calculation-block">
<h4 class="wp-block-heading">Deadtime Loss (P_dt)</h4>

<p class="param-detail">
  <em>What it represents</em>
  <span>Loss when neither MOSFET in a half bridge is on and the body diode conducts during deadtime.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>You must insert a small deadtime so that high side and low side are never on at the same time. During this time, current has to flow somewhere, usually through the body diode.</span>
</p>
<p class="param-detail">
  <em>Formula</em>
  <span>In a simple synchronous half bridge, an approximation is:<br />
  <span class="formula"><code>P_dt = 2 &times; Vsd &times; Current &times; (Td(on) + Td(off)) &times; f_sw</code></span><br />
  The factor of 2 accounts for both edges in one full switching period.</span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Increases with diode forward drop, current, deadtime, and frequency, and shows up directly as heat in the MOSFET and extra stress on the diode.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>Too much deadtime wastes energy in the diode. Too little risks shoot through. There is a sweet spot that keeps efficiency high and the converter safe.</span>
</p>
<p class="param-detail">
  <em>Practical tips</em>
  <span>Use gate drivers that provide adjustable deadtime, minimize propagation delay mismatch, and choose MOSFETs with good body diode behavior if the diode will conduct often.</span>
</p>
</div>

<div class="calculation-block">
<h4 class="wp-block-heading">Gate Charge Loss (P_gate)</h4>

<p class="param-detail">
  <em>What it represents</em>
  <span>Losses in the gate driver from charging and discharging the MOSFET gate every cycle.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The gate is capacitive. Moving charge Qg at a voltage Vgate_drive every cycle consumes energy that ends up in the driver and the MOSFET gate network.</span>
</p>
<p class="param-detail">
  <em>Formula</em>
  <span>Each full cycle charges and discharges the gate once, so:<br />
  <span class="formula"><code>P_gate = 2 &times; Qg &times; Vgate_drive &times; f_sw</code></span></span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Grows with Qg, gate drive voltage, and frequency. It does not heat the MOSFET much directly but adds to system power loss and driver heating and limits how many devices you can drive from one controller.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>At very high frequency or in multi phase systems, gate drive loss is no longer negligible and it influences both MOSFET and driver selection.</span>
</p>
<p class="param-detail">
  <em>Practical tips</em>
  <span>Pick MOSFETs with a good balance of Qg and Rds(on), keep gate drive voltage at the recommended level, and use drivers that can handle the required total gate charge.</span>
</p>
</div>

<div class="calculation-block">
<h4 class="wp-block-heading">Output Capacitance Loss (P_coss)</h4>

<p class="param-detail">
  <em>What it represents</em>
  <span>Loss from charging and discharging the MOSFET output capacitance every switching cycle.</span>
</p>
  <p class="param-detail">
  <em>Why it exists</em>
  <span>The MOSFET drain to source capacitance stores energy at Vbus. Each time you switch, that stored energy is moved around and usually ends up as heat.</span>
</p>
<p class="param-detail">
  <em>Formula</em>
  <span>A common approximation is:<br />
  <span class="formula"><code>P_coss = 0.5 &times; Coss &times; Vbus^2 &times; f_sw</code></span></span>
</p>
  <p class="param-detail">
  <em>How it affects performance</em>
  <span>Grows quickly with bus voltage because it scales with V&sup2; and increases linearly with switching frequency. It can become a dominant loss term in high voltage, high frequency converters.</span>
</p>
  <p class="param-detail">
  <em>Design implications</em>
  <span>At higher voltages, Coss performance can matter more than Qg. Selecting a MOSFET with low output capacitance can give a significant efficiency gain.</span>
</p>
<p class="param-detail">
  <em>Practical tips</em>
  <span>Use MOSFETs optimized for low Coss at your operating voltage, keep switching frequency reasonable, and minimize parasitic inductance that interacts with Coss to cause ringing.</span>
</p>

</div>

<h2 class="wp-block-heading">Summary</h2>

<p>This guide provides an introduction to the power dissipation characteristics in MOSFETs under various operating conditions. These calculations are helpful for anyone looking to understand the efficiency and performance of MOSFET-based power electronic systems.</p>

<p><strong>Learn more about DMC&apos;s <a href="https://static.dmcinfo.com/services/embedded-development-and-embedded-programming">Embedded Development and Embedded Programming</a> expertise.&nbsp;</strong></p>
</div>
<p>The post <a href="https://static.dmcinfo.com/blog/17021/mosfet-power-loss-calculator/">MOSFET Power Loss Calculator</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Creating a GATT Server With ESP-IDF’s Latest Bluetooth LE Stack: NimBLE</title>
		<link>https://static.dmcinfo.com/blog/19377/creating-a-gatt-server-with-esp-idfs-latest-bluetooth-le-stack-nimble/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Mon, 19 Apr 2021 15:41:01 +0000</pubDate>
				<category><![CDATA[Low-Power Embedded Design]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/19377/creating-a-gatt-server-with-esp-idfs-latest-bluetooth-le-stack-nimble/</guid>

					<description><![CDATA[<p>At the end of 2019, the ESP32 became Bluetooth LE 5.0-certified. This certification demonstrates Espressif&#8217;s commitment to staying compatible with the latest devices on the market. Luckily for us, this makes it easy for new and existing products to use the 5.0 standard. Another way Espressif is improving their&#160;Bluetooth capabilities is by porting a new [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/19377/creating-a-gatt-server-with-esp-idfs-latest-bluetooth-le-stack-nimble/">Creating a GATT Server With ESP-IDF’s Latest Bluetooth LE Stack: NimBLE</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">At the end of 2019, the ESP32 became <a href="https://www.espressif.com/en/news/BLE_5.0_Certification" target="_blank">Bluetooth LE 5.0-certified</a>. This certification demonstrates Espressif&rsquo;s commitment to staying compatible with the latest devices on the market. Luckily for us, this makes it easy for new and existing products to use the 5.0 standard.</p>

<p class="wp-block-paragraph">Another way Espressif is improving their&nbsp;Bluetooth capabilities is by porting a new BLE-only stack called <a href="https://mynewt.apache.org/latest/network/ble_setup/ble_setup_intro.html" target="_blank">NimBLE</a> into their ESP-IDF. ESP-IDF is Espressif&rsquo;s software development kit (SDK) for the ESP32. Previously, the only option for Bluetooth on the ESP was BlueDroid, which implemented classic Bluetooth and Bluetooth LE. BlueDroid is large in terms of both code size and runtime memory&mdash;even if the application only uses Bluetooth LE. I recently implemented a GATT server using NimBLE on the ESP32 and in this blog, I&rsquo;ll share some of the things I learned.</p>

<h2 class="wp-block-heading">NimBLE Functionalities&nbsp;</h2>

<p class="wp-block-paragraph">NimBLE is the BLE stack used for <a href="http://mynewt.apache.org/latest/network/index.html" target="_blank">Mynewt OS</a>, a cross-platform OS targeted at IoT devices. Mynewt contains a variety of lower-level functions and structures that are used across their higher-level communication protocol stacks (NimBLE included). Espressif therefore had to port over some of these lower-level functions and structures along with the NimBLE stack, such as the ble_hs_mbuf_to_flat() function.</p>

<p class="wp-block-paragraph">Data in NimBLE is passed around via memory buffers named mbufs. Mbufs are a linked list containing data needed for any type of packet in Mynewt OS. Data coming to my application from the NimBLE stack would be in an mbuf, and the data I want to send to the NimBLE stack needed to be in an mbuf. There are a few functions ported into ESP-IDF to encode or decode mbufs to a Uint8Array, but the ones I primarily used were:</p>

<p class="wp-block-paragraph"><strong>ble_hs_mbuf_to_flat()</strong></p>

<p class="wp-block-paragraph"><strong>ble_hs_mbuf_from_flat()</strong></p>

<p class="wp-block-paragraph">I used these when I needed to create an mbuf to be passed into NimBLE, or when I needed to access the raw data from an mbuf passed to my application from NimBLE.</p>

<h2 class="wp-block-heading">Customization</h2>

<p class="wp-block-paragraph">With NimBLE, creating custom services and characteristics is surprisingly easy. For background, all BLE services and characteristics have universally unique identifiers (UUIDs). Some generic UUIDs are reserved by the Bluetooth SIG and should only be used by specific metrics. For example, the device name should always be at UUID 00002A00-0000-1000-8000-00805F9B34FB. Some applications require data to be sent that does not fall into any of these generic UUIDs, and therefore require a custom service or characteristic. Doing so is as easy as passing a <strong>ble_gatt_svc_def</strong> structure to the NimBLE stack. Part of the<strong> ble_gatt_svc_def </strong>structure requires a user callback. This user callback will be called to handle BLE events like writes or reads of any characteristic. I found this easy to set up and clean if you need to expand and customize BLE services or characteristics.</p>

<p class="wp-block-paragraph">You can check out some examples of the NimBLE port inside <a href="https://github.com/espressif/esp-idf" target="_blank">ESP-IDF</a>. There are examples showing GATT servers/clients, and one for creating a BLE mesh. I hope this can help in creating your next BLE project with the ESP32!</p>

<p class="wp-block-paragraph"><strong>Read more about DMC&rsquo;s <a href="/services/embedded-development-and-embedded-programming">embedded development and programming expertise</a> and <a href="/contact">contact us</a> to get started on your next project.&nbsp;</strong><br />
&nbsp;</p>
<p>The post <a href="https://static.dmcinfo.com/blog/19377/creating-a-gatt-server-with-esp-idfs-latest-bluetooth-le-stack-nimble/">Creating a GATT Server With ESP-IDF’s Latest Bluetooth LE Stack: NimBLE</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Unveiling the Power of the Nordic nRF9160 SiP</title>
		<link>https://static.dmcinfo.com/blog/20419/unveiling-the-power-of-the-nordic-nrf9160-sip/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Tue, 07 Jan 2020 13:22:13 +0000</pubDate>
				<category><![CDATA[Embedded Development & Programming]]></category>
		<category><![CDATA[Low-Power Embedded Design]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/20419/unveiling-the-power-of-the-nordic-nrf9160-sip/</guid>

					<description><![CDATA[<p>The nRF9160 is one of the latest product releases from Nordic. I have been having a lot of fun creating user applications with this chip, and wanted to share my experience with this new tool. A Chip That Packs a Punch The nRF9160&#160;is a system-in-Package (SiP)&#160;that includes an LTE modem with an Arm Cortex-M33 processor [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/20419/unveiling-the-power-of-the-nordic-nrf9160-sip/">Unveiling the Power of the Nordic nRF9160 SiP</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">The <a href="https://www.nordicsemi.com/Products/Low-power-cellular-IoT/nRF9160" target="_blank">nRF9160</a> is one of the latest product releases from Nordic. I have been having a lot of fun creating user applications with this chip, and wanted to share my experience with this new tool.</p>



<h2 class="wp-block-heading" id="h-a-chip-that-packs-a-punch">A Chip That Packs a Punch</h2>



<p class="wp-block-paragraph">The nRF9160&nbsp;is a system-in-Package (SiP)&nbsp;that includes an LTE modem with an Arm Cortex-M33 processor for user applications. The modem can support either LTE-M or NB-IoT, but it can also be updated dependent on the application. The processor has 1MB of flash, 256 KB of RAM, and 32 GPIO. The SiP also has a built-in GPS receiver. I think one of the most impressive things about this chip is that its only 16mm X 10mm X 1mm. It’s tiny, but it really packs a punch! I couldn’t wait to get my hands on this development kit.</p>



<p class="wp-block-paragraph"><img decoding="async" alt="Nordic nrf9160 chip" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/nordic-nrf9160-01.jpg"><br>
<em>The nRF9160 Development Kit</em></p>



<h2 class="wp-block-heading" id="h-development-environment">Development Environment</h2>



<p class="wp-block-paragraph">Nordic’s documentation for setting up the&nbsp;development environment made it easy to get to the point where I could flash sample programs. The desktop app, called <a href="https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-desktop" target="_blank">nRF Connect for Desktop</a>, is their suite where they house their apps for nRF devices. The app called <a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/gs_assistant.html#gs-assistant" target="_blank">Getting Started Assistant</a> walked me through setting up their toolchain, SDK, and development environment.&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/nordic-nrf9160-02.jpg" alt="Nordic nrf9160 documentation"><br> <em>nRF Connect for Desktop application</em></p>



<p class="wp-block-paragraph">The IDE of choice for the nRF modules is SEGGER Embedded Studio (SES). Nordic has their own edition of SES that is used to open their nRF Connect SDK Projects. Installing this edition of SES is covered in the Getting Started Assistant application. You can open one of their SDK projects through <strong>File -&gt; Open nRF Connect SDK Project…</strong> This will autogenerate some files necessary to open your project through SES, as well as create some configuration files.&nbsp;</p>



<p class="wp-block-paragraph">Their samples are combinations of solutions that consist of smaller projects that compile to C libraries. You can configure what projects are included in your solution by selecting <strong>Project -&gt; Configure nRF Connect SDK Project</strong>. This menu is also used to enable the options of Zephyr, the RTOS used with their SDK. This menu then updates a configuration file for Zephyr and other projects in your build directory. The initial values of these configuration files are set through the prj.conf file in your project folder.&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/nordic-nrf9160-03.jpg" alt="Configure Nordic nrf9160"><br><em>nRF Connect SDK configuration menu</em></p>



<h2 class="wp-block-heading" id="h-create-an-application">Create an Application</h2>



<p class="wp-block-paragraph">To begin creating your own application, you’ll probably want to start with one of the sample projects. You can use the project named libapp.a to store your application files. You can open your applications CMakeList by right-clicking your project and choosing <strong>Open CMakeLists.txt in Editor</strong>. This lets you choose all included directories and source files needed by your application. When you are ready to test, you can go to <strong>Build -> Build and Run</strong> or <strong>Build -> Build and Debug</strong>. </p>



<p class="wp-block-paragraph">I hope this helps you have as much fun creating user applications with this chip as I did! One thing to note is that, since this chip is still fairly new, there are some kinks to be worked out in the SDK. Luckily, Nordic has been very responsive to issues in their forums and are continuously releasing bug fixes and features to their SDK. Stay tuned for some of the amazing applications that will come out of this chip!</p>



<p class="wp-block-paragraph"><strong>Learn more about DMC&#8217;s <a href="https://static.dmcinfo.com/services/embedded-development-and-embedded-programming">embedded development expertise</a>.</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/20419/unveiling-the-power-of-the-nordic-nrf9160-sip/">Unveiling the Power of the Nordic nRF9160 SiP</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>4 Tips for Launching a Product on Emerging Cellular Networks</title>
		<link>https://static.dmcinfo.com/blog/20846/4-tips-for-launching-a-product-on-emerging-cellular-networks/</link>
		
		<dc:creator><![CDATA[Tim Jager]]></dc:creator>
		<pubDate>Fri, 04 Oct 2019 14:51:46 +0000</pubDate>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[Embedded Development & Programming]]></category>
		<category><![CDATA[IoT]]></category>
		<category><![CDATA[Low-Power Embedded Design]]></category>
		<category><![CDATA[Cellular Networks]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/20846/4-tips-for-launching-a-product-on-emerging-cellular-networks/</guid>

					<description><![CDATA[<p>The major cellular network providers (AT&amp;T, Verizon, T-Mobile) have launched or are&#160;in the process of launching upgrades to their LTE networks that will enable the deployment of millions of new, previously&#160;impractical IoT&#160;solutions.&#160;LTE-M (aka CAT-M1) and NB-IoT&#160;networks are designed specifically for low-power, low-cost, low-bandwidth&#160;devices. By reducing the&#160;bandwidth, carriers can&#160;offer connectivity at increasingly lower monthly costs. Devices [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/20846/4-tips-for-launching-a-product-on-emerging-cellular-networks/">4 Tips for Launching a Product on Emerging Cellular Networks</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">The major cellular network providers (AT&amp;T, Verizon, T-Mobile) have launched or are&nbsp;in the process of launching upgrades to their LTE networks that will enable the deployment of millions of new, previously&nbsp;impractical IoT&nbsp;solutions.&nbsp;LTE-M (aka CAT-M1) and NB-IoT&nbsp;networks are designed specifically for <a href="https://static.dmcinfo.com/services/embedded-development-and-embedded-programming/low-power-embedded-design">low-power</a>, low-cost, low-bandwidth&nbsp;devices. By reducing the&nbsp;bandwidth, carriers can&nbsp;offer connectivity at increasingly lower monthly costs. Devices using cellular modules may cost as little as $1&nbsp;monthly.</p>



<p class="wp-block-paragraph">These new networks are the future of&nbsp;IoT. However, as this writing, many of these networks still have a lot of kinks to work out. Cellular module vendors are rapidly developing and lunching modules for these networks. These modules are all new and so is the network, so&nbsp;challenges launching a product on one of these networks are to be expected.</p>



<h2 class="wp-block-heading" id="h-what-to-do">What to Do</h2>



<p class="wp-block-paragraph"><strong>1. Know your Module Vendor</strong><br>
When selecting a cellular module <a href="https://static.dmcinfo.com/services/embedded-development-and-embedded-programming/embedded-systems-platforms">vendor</a> make sure they have a good support network. With new network deployments, there will be a LOT of updates happening in the background. The cell providers will be making adjustments and so will the module vendors. It&#8217;s important to understand the level of support you will get from the module vendor if your device happens to uncover a bug or incompatibility between the module and the network, or worse, between the module and a specific cell tower.</p>



<p class="wp-block-paragraph"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/ublox-SARA-R4.png" alt="SARA-R4 by ublox"> <img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Simcon-SIM7000X.png" alt="SIM7000X by Simcon"> <img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/nordic-nRF9160.png" alt="nRF9160 by Nordic"><br> <em>ublox SARA-R4 series, <a href="https://www.simcom.com/product/SIM7000G.html" target="_blank" rel="noreferrer noopener">SIMCom SIM7000X</a>, and <a href="https://www.nordicsemi.com/Products/Low-power-cellular-IoT/nRF9160?utm_term=nordic%20nrf9160&amp;utm_campaign=NRF91+series&amp;utm_source=adwords&amp;utm_medium=ppc&amp;hsa_tgt=kwd-669404695330&amp;hsa_grp=65550591524&amp;hsa_src=g&amp;hsa_net=adwords&amp;hsa_mt=b&amp;hsa_ver=3&amp;hsa_ad=319485577104&amp;hsa_acc=1116845495&amp;hsa_kw=nordic%20nrf9160&amp;hsa_cam=1658684085&amp;gclid=Cj0KCQjw3JXtBRC8ARIsAEBHg4kAtSLOubBGs_G5mjbB44UesNpvOxYqSkBeQ982zXuCBjHqHQdq5AgaAqrbEALw_wcB" target="_blank">Nordic nRF9160</a></em><br> <br> <strong>2. Understand the Module Power Requirements</strong><br> Most of these cellular module vendors provide a lot of marketing material about the low power requirements of their modules. These low power modules promise battery-powered cellular connectivity with years of battery life. It&#8217;s true, these modules have very low average currents while operating. The important thing to understand is that they also have relatively high peak current demands, which means you need to select your battery and design your power circuitry carefully. You won&#8217;t see any cellular IoT devices running on coin cells anytime soon.</p>



<p class="wp-block-paragraph">Lithium Thionyl Chloride is popular cell chemistry for super long-life Wi-Fi or Bluetooth IoT devices, but most of the batteries made with this chemistry fail to provide the high peak current required by the cellular modules. Spiral wound Lithium Thionyl Chloride batteries use the same chemistry but provide higher peak current (by increasing the electrode surface area), however these batteries may still not meet the peak current demands.</p>



<p class="wp-block-paragraph"><img decoding="async" alt="Spiral bound lithium battery diagram" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/spiral-bound-lithium-battery.png"><br>
<em>Spiral wound Lithium Thionyl Chloride batteries</em></p>



<p class="wp-block-paragraph">Instead, you may need to consider hybrid batteries&nbsp;like <a href="https://xenoenergy.com/xlc_capacitor" target="_blank" rel="noreferrer noopener">these</a>&nbsp;from Xeno Energy which consist of a Lithium Thionyl Chloride cell and a parallel supercapacitor. The supercapacitor can provide high peak currents while exhibiting very low leakage.&nbsp; Although the cost is higher for this battery topology, it provides the performance needed for long life cellular IoT devices.&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="Hybrid battery graphic" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/hybrid-battery-emerging-cellular-networks.png"><br>
<em>Hybrid battery</em><br>
<br>
<strong>3. Test Your Module in a Wide Variety of Conditions</strong><br>
These modules contain closed-source vendor-supplied firmware. The operation of the module may not be fully documented. Part of your testing protocol should include adding attenuators to the cellular antenna (to simulate poor cellular reception) and observing how the module functions with reduced signal strength.</p>



<p class="wp-block-paragraph">Modules draw significantly more average current when operating at this reduced signal level. Not knowing this ahead of time can be problematic, especially if your product advertises a minimum battery life expectancy.&nbsp;The actual battery life will largely depend on your connection to the cellular network. The total energy required to transmit a message from your device to the backend server can vary significantly depending on your signal strength and the number of retries required.&nbsp;</p>



<p class="wp-block-paragraph"><img decoding="async" alt="Add attenuators to the cellular antenna for testing" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/emerging-celular-networks-attenuator.jpg"><br>
<em>Add attenuators to the cellular antenna to test at a reduced signal strength</em><br>
<br>
<strong>4.&nbsp;Expect and Plan Time for Network Issues</strong><br>
These networks are going to be great, but until they are fully stable your product launch is going to go slower than you hoped. Add extra time in your launch schedule to account for these unknowns and extend your engineering budget to account for the time required to work through these issues.&nbsp;</p>



<p class="wp-block-paragraph">Keep in mind that different cell towers may contain different vendor hardware.&nbsp;Each of these vendors may be interpreting the CAT-M1/LTE-M specification differently and you may encounter situations where the firmware in your device performs better on some towers than others. If you encounter issues like this,&nbsp;move your device to a different location to&nbsp;see if it picks up a different tower and starts working. Eventually, these issues will be worked out by the carriers and module providers, but you should initially be prepared to work through these situations during your testing and product rollout.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</p>



<p class="wp-block-paragraph"><em><img decoding="async" alt="Two cell towers" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/emerging-cellular-networks-cell-towers.jpg"><br>
The&nbsp;firmware in your device may perform better on some cell towers than others due to hardware differences</em></p>



<p class="wp-block-paragraph"><strong>Learn more about DMC&#8217;s <a href="https://static.dmcinfo.com/services/application-development/iot-solutions">IoT solutions</a>.&nbsp;</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/20846/4-tips-for-launching-a-product-on-emerging-cellular-networks/">4 Tips for Launching a Product on Emerging Cellular Networks</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Getting Started with the ESP32 &#038; ESP8266: 8 Tips and Tricks</title>
		<link>https://static.dmcinfo.com/blog/21298/getting-started-with-the-esp32-esp8266-8-tips-and-tricks/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Wed, 03 Jul 2019 09:31:58 +0000</pubDate>
				<category><![CDATA[Embedded Development & Programming]]></category>
		<category><![CDATA[Low-Power Embedded Design]]></category>
		<category><![CDATA[Embedded Platforms]]></category>
		<category><![CDATA[Espressif]]></category>
		<category><![CDATA[Microcontrollers]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21298/getting-started-with-the-esp32-esp8266-8-tips-and-tricks/</guid>

					<description><![CDATA[<p>Espressif makes two of the most common modules used for Wi-Fi integration in embedded systems, the ESP8266 and ESP32. The ESP8266 was huge for IoT development. It contains a high-performance CPU with an antenna etched into the PCB to allow Wi-Fi connectivity. If you are left wanting more, the ESP32 packs another CPU and includes [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21298/getting-started-with-the-esp32-esp8266-8-tips-and-tricks/">Getting Started with the ESP32 &#038; ESP8266: 8 Tips and Tricks</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">Espressif makes two of the most common modules used for Wi-Fi integration in embedded systems, <strong>the ESP8266 and ESP32</strong>. The ESP8266 was huge for <a href="/services/application-development/iot-solutions">IoT development</a>. It contains a high-performance CPU with an antenna etched into the PCB to allow Wi-Fi connectivity. If you are left wanting more, the ESP32 packs another CPU and includes BLE and classic Bluetooth.</p>

<p class="wp-block-paragraph">Espressif developed the<strong> Espressif Internet Development Framework </strong>(ESP-IDF) as their SDK for developing with the ESP32. There is a very good guide to getting their toolchain and SDK setup on Espressif&rsquo;s website. The ESP-IDF has components for almost anything you&rsquo;d like to do with the ESP32. There are drivers for GPIO, Wi-Fi, IoT communication standards, and so much more. Espressif&nbsp;recently began modifying their SDK for the ESP8266 to be similar to the ESP-IDF.</p>

<p class="wp-block-paragraph">The ESP-IDF uses a <strong>menuconfig</strong> to enable sections of the ESP-IDF API, configure peripherals, etc. This is nice for finding all the components that are available through ESP-IDF and their options. Some of these options can also be changed on the fly through API calls, but I&rsquo;d argue that I&rsquo;d rather have these configured before runtime.</p>

<figure class="wp-block-image"><img decoding="async" alt="esp microcontrollers" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/esp-microcontrollers-blog.png"  /></figure>

<p class="wp-block-paragraph">The ESP32 and ESP8266 are both great modules to work with, but each of them has their quirks. Below, I&rsquo;ve compiled a list of tips for getting started with the Espressif modules:</p>

<ol class="wp-block-list">
 <li style="margin-bottom:20px;"><strong>The sdkconfig file saves all the changes made in the menuconfig</strong>

 <ul class="wp-block-list">
  <li>The menuconfig saves all configurations in a file called sdkconfig. Sdkconfig shows all options available to be set through menuconfig. If you are searching for a specific option, it can be quicker to ctrl = f through sdkconfig and backtrack to find the location through menuconfig.</li>
  <li>Menuconfig does read and write from sdkconfig, so changes you make in sdkconfig will be reflected in menuconfig. If you have a lot of trouble finding a parameter through menuconfig, this can be a backup option (though it is not recommended by Espressif so be warned!)</li>
 </ul>
 </li>
 <li style="margin-bottom:20px;"><strong>Run make with parallel jobs</strong>
 <ul class="wp-block-list">
  <li>Building a project using ESP-IDF can take a while because they do not automatically run parallel jobs. This causes long compile times when rebuilding from scratch. Since every change in menuconfig requires a complete rebuild, this can start to eat a significant amount of development time.</li>
  <li>To build with parallel jobs, you need to add the -j option to your make commands. A command of make -j4 will run make with 4 parallel jobs. Espressif recommends running with option -j(number of CPUs +1)</li>
 </ul>
 </li>
 <li style="margin-bottom:20px;"><strong>Not all GPIO pins have full functionality</strong>
 <ul class="wp-block-list">
  <li>The ESP32 has 4 pins that are labeled as input only. These pins are GPIO 34, 35, 36, and 39.</li>
  <li>The ESP32 also has 18 ADC pins, however, 10 of these cannot be used while Wi-Fi is being used! The pins that cannot be used as ADC with Wi-Fi are GPIO 0, 2, 4, 12, 13, 14, 15, 25, 26, 27.</li>
  <li>Since the ESP32 and ESP8266 have external flash, the modules have a SPI interface. On some development boards, these pins are exposed, so it is recommended to not use these pins in your projects. On both boards, these pins are GPIO 6-11.</li>
 </ul>
 </li>
 <li style="margin-bottom:20px;"><strong>Default FreeRTOS tick is 10ms</strong>
 <ul class="wp-block-list">
  <li>The default tick rate for FreeRTOS in ESP-IDF is 100. This can be updated up to 1000 with no issues, but anymore than that I&rsquo;ve heard is unreliable. If you need timing more precise than 1ms, you may need to implement RTC timers with interrupts.</li>
 </ul>
 </li>
 <li style="margin-bottom:20px;"><strong>OTA updates for ESP32</strong>
 <ul class="wp-block-list">
  <li>ESP-IDF gives the user control over how the external flash is utilized through a partition table. Setting up the flash partitions correctly is essential for OTA updates. OTA updates require at least 3 entries, otadata, ota_0, and ota_1.<figure class="wp-block-image"><img decoding="async" alt="OTA updates" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/ota-updates-for-esp.jpg" /></figure></li>
  <li>On first boot, the bootloader jumps to ota_0 partition (if the factory partition is not specified) and begin running the firmware. When the firmware activates a firmware update, it then updates the ota_1 partition. The device then runs the firmware in ota_1 and updates otadata to mark ota_1 as the active partition, so that on bootup, ota_1 is run.</li>
  <li>One of the cool features included in this method of updating firmware is that it allows for firmware verification on every update. This way, if you push code to your device that doesn&rsquo;t pass your user-defined tests, the device can roll back to the previous ota partition and continue running. This is a nice feature to be rolled into the ESP-IDF as it can save.</li>
 </ul>
 </li>
 <li style="margin-bottom:20px;"><strong>Add more RAM</strong>
 <ul class="wp-block-list">
  <li>Both the ESP32 and ESP8266 support adding additional RAM. Espressif has even developed an SRAM device for the ESP32, called the ESP-PSRAM32. The external RAM is connected in parallel with the external flash chip, allowing the new RAM to be accessed the same as internal RAM.</li>
  <li>Espressif also has the ESP32-WROVER module, which contains an external 4MB SPI Flash and 8MB external PSRAM, in case you don&rsquo;t want to add these yourself.</li>
 </ul>
 </li>
 <li style="margin-bottom:20px;"><strong>Security</strong>
 <ul class="wp-block-list">
  <li>Both modules support signed firmware updates. This can help guarantee that any code updates are only applied by you (or anyone who gets a hold of your private key). Additionally, the ESP32 supports secure boot and flash encryption. Secure boot is another method of ensuring only your code can run on your device. Flash encryption protects your firmware from being accessible to anyone with physical access to your device.</li>
 </ul>
 </li>
 <li style="margin-bottom:20px;"><strong>Low-Power Mode</strong>
 <ul class="wp-block-list">
  <li>Both the ESP8266 and ESP32 can enter either light sleep or deep sleep.</li>
  <li>In light sleep, clock pulses are powered off and RAM is retained. When exiting light sleep, and the program continues from wherever light sleep mode was entered from. There is also the ability to enable automatic light sleep, which can retain Wi-Fi connection by cycling between active mode and light sleep mode.</li>
  <li>In deep sleep, the CPU and memory are powered off. The RTC module is still powered in this mode, which is responsible for periodic wakeups and can store a small amount of memory. The ESP32 also has an ultra-low power processor that can be enabled in deep sleep!</li>
 </ul>
 </li>
</ol>

<p class="wp-block-paragraph"><strong><a href="https://static.dmcinfo.com/contact">Contact Us</a> Today to Speak With&nbsp;Our&nbsp;<a href="/services/embedded-development-and-embedded-programming">Embedded Development Solutions</a>&nbsp;Experts and&nbsp;We Can Get Started on Your Next Project!</strong></p>
<p>The post <a href="https://static.dmcinfo.com/blog/21298/getting-started-with-the-esp32-esp8266-8-tips-and-tricks/">Getting Started with the ESP32 &#038; ESP8266: 8 Tips and Tricks</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Oxidizing Bare Metal: Rust Programming for ARM Microcontrollers</title>
		<link>https://static.dmcinfo.com/blog/21750/oxidizing-bare-metal-rust-programming-for-arm-microcontrollers/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Fri, 19 Apr 2019 12:33:02 +0000</pubDate>
				<category><![CDATA[Embedded Development & Programming]]></category>
		<category><![CDATA[Low-Power Embedded Design]]></category>
		<category><![CDATA[Product Development]]></category>
		<category><![CDATA[ARM Microcontrollers]]></category>
		<category><![CDATA[Embedded Systems]]></category>
		<category><![CDATA[Microcontroller Programming]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/21750/oxidizing-bare-metal-rust-programming-for-arm-microcontrollers-4/</guid>

					<description><![CDATA[<p>Being an embedded systems developer is always an exciting challenge. One of the downsides though is that in general, programming and development tools are somewhat limited. Developers are almost always restricted to C/C++ and often can&#8217;t rely on more extensive open source libraries. However, recently there have been many efforts to expand high-level language support [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21750/oxidizing-bare-metal-rust-programming-for-arm-microcontrollers/">Oxidizing Bare Metal: Rust Programming for ARM Microcontrollers</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Being an <a href="/services/embedded-development-and-embedded-programming">embedded systems developer</a> is always an exciting challenge. One of the downsides though is that in general, programming and development tools are somewhat limited. Developers are almost always restricted to C/C++ and often can&#8217;t rely on more extensive open source libraries. However, recently there have been many efforts to expand high-level language support to ARM-based bare metal targets.</p>



<p class="wp-block-paragraph">Projects using MicroPython and JerryScript attempt to provide a means to write Python and JavaScript code and provide frameworks for “compiling” and running scripts on a variety of bare-metal targets. However, these types of frameworks have some inherent drawbacks. JavaScript and Python are both interpreted languages with garbage collection and weak typing. Running these languages requires relying on&nbsp;a run time or more complex cross compiler.</p>



<h2 class="wp-block-heading" id="h-a-new-language-for-embedded-systems">A New Language for Embedded Systems</h2>



<p class="wp-block-paragraph">More recently, Rust has emerged as an appealing language for applications that require <strong>memory safety and efficiency</strong>. Both of these features are often critical for embedded devices. Manual memory management often creates bugs which are hard to isolate and are not always easily remedied due to the resource constraints of embedded devices.</p>



<p class="wp-block-paragraph">Additionally, C/C++, even given all of its faults, remains a highly efficient language due to the control it provides developers and because it can use many target-specific optimizations at compile time. C/C++ sets a high benchmark for speed that is difficult for interpreted languages to match.</p>



<p class="wp-block-paragraph">Rust, fortunately, solves both problems in ways that are particularly well suited to <a href="/services/embedded-development-and-embedded-programming/embedded-systems-platforms">microcontrollers</a>. Rust does not require any run-time engine for garbage collection or memory management. Rust instead chooses to enforce memory safety at compile time. Furthermore, because Rust compiles to LLVM, target optimizations rivaling those achievable with C/C++ are possible. Recently, the Rust core team has made support for new target architectures a priority, and there are already many open source projects aimed at expanding support for embedded devices in Rust.</p>



<p class="wp-block-paragraph"><img decoding="async" alt="" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/Rust-Board-3.jpg"><span style="font-size:12px;"><em>Nucleo PCB Running on Rust</em></span></p>



<h2 class="wp-block-heading" id="h-getting-started-with-rust">Getting Started with Rust</h2>



<p class="wp-block-paragraph">The <a href="https://docs.rust-embedded.org/book/index.html" target="_blank">Embedded Rust Book</a> provides many details regarding getting started with Rust on embedded devices. For this blog, I’ll highlight a few key components that make up the Rust embedded landscape. Specifically, I’ll be discussing support for <strong>ARM Cortex M based microcontrollers</strong>.</p>



<p class="wp-block-paragraph">The Rust ecosystem is built on an extensive library of packages called “Crates.” A few specific crates, “cortex-m” and “cortex-m-rt”, make up the core support for ARM targets. These packages provide the bare minimum of code to get a basic program up and running. It allows access and control of the core ARM registers.</p>



<p class="wp-block-paragraph">Below is an example of setting up the systick peripheral taken from the Rust Embedded Book.</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Rust</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>use cortex_m::peripheral::{syst, Peripherals};
use cortex_m_rt::entry;

#&#91;entry&#93;
fn main() -> ! {
    let mut peripherals = Peripherals::take().unwrap();
    let mut systick = peripherals.SYST;
    systick.set_clock_source(syst::SystClkSource::Core);
    systick.set_reload(1_000);
    systick.clear_current();
    systick.enable_counter();
    while !systick.has_wrapped() {
        // Loop
    }

    loop {}
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">use</span><span style="color: #D4D4D4"> </span><span style="color: #4EC9B0">cortex_m</span><span style="color: #D4D4D4">::</span><span style="color: #4EC9B0">peripheral</span><span style="color: #D4D4D4">::{syst, </span><span style="color: #4EC9B0">Peripherals</span><span style="color: #D4D4D4">};</span></span>
<span class="line"><span style="color: #569CD6">use</span><span style="color: #D4D4D4"> </span><span style="color: #4EC9B0">cortex_m_rt</span><span style="color: #D4D4D4">::entry;</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">#&#91;entry&#93;</span></span>
<span class="line"><span style="color: #569CD6">fn</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">main</span><span style="color: #D4D4D4">() -&gt; ! {</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">let</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">mut</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">peripherals</span><span style="color: #D4D4D4"> = </span><span style="color: #4EC9B0">Peripherals</span><span style="color: #D4D4D4">::</span><span style="color: #DCDCAA">take</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">unwrap</span><span style="color: #D4D4D4">();</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">let</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">mut</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">systick</span><span style="color: #D4D4D4"> = </span><span style="color: #9CDCFE">peripherals</span><span style="color: #D4D4D4">.SYST;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">systick</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">set_clock_source</span><span style="color: #D4D4D4">(</span><span style="color: #4EC9B0">syst</span><span style="color: #D4D4D4">::</span><span style="color: #4EC9B0">SystClkSource</span><span style="color: #D4D4D4">::</span><span style="color: #4EC9B0">Core</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">systick</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">set_reload</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">1_000</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">systick</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">clear_current</span><span style="color: #D4D4D4">();</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">systick</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">enable_counter</span><span style="color: #D4D4D4">();</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">while</span><span style="color: #D4D4D4"> !</span><span style="color: #9CDCFE">systick</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">has_wrapped</span><span style="color: #D4D4D4">() {</span></span>
<span class="line"><span style="color: #6A9955">        // Loop</span></span>
<span class="line"><span style="color: #D4D4D4">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">loop</span><span style="color: #D4D4D4"> {}</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<p class="wp-block-paragraph">To implement something more interesting than a simple timer, we’ll need a <strong>Peripheral Access</strong> crate. These crates are typically specific to a <a href="/services/embedded-development-and-embedded-programming/embedded-systems-platforms">vendor and family</a> of microcontrollers. For example, the <strong>STM32F4 crate</strong> provides an API for accessing various peripherals such as GPIO, UART, and I2C for the STM32F4 family of devices.</p>



<p class="wp-block-paragraph">Pulling in a Peripheral Access crate, we can build a program for toggling an LED:</p>



<div class="wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers" data-code-block-pro-font-family="Code-Pro-JetBrains-Mono" style="font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)"><span style="display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e"><span style="background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e">Rust</span></span><span role="button" tabindex="0" style="color:#D4D4D4;display:none" aria-label="Copy" class="code-block-pro-copy-button"><pre class="code-block-pro-copy-button-pre" aria-hidden="true"><textarea class="code-block-pro-copy-button-textarea" tabindex="-1" aria-hidden="true" readonly>fn main() -> ! {
    let mut peripherals = stm32f429::Peripherals::take().unwrap();

    //Enable gpio b clock
    let rcc = &amp;peripherals.RCC;
    rcc.ahb1enr.write(|w| w.gpioben().bit(true));

    //set pin 14 to output
    let gpio = &amp;peripherals.GPIOB;
    gpio.moder.write(|w| w.moder14().bits(1));

    //Turn on led
    gpio.odr.write(|w| w.odr14().set_bit());

    loop {

        delay(10000);
        if  gpio.odr.read().odr14().bit()
        {
            gpio.odr.write(|w| w.odr14().clear_bit());
        }
        else {
            gpio.odr.write(|w| w.odr14().set_bit());
        }
        
    }
}

fn delay(count: u32) {
     for _ in 0..count { cortex_m::asm::nop() }
}</textarea></pre><svg xmlns="http://www.w3.org/2000/svg" style="width:24px;height:24px" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2"><path class="with-check" stroke-linecap="round" stroke-linejoin="round" d="M4.5 12.75l6 6 9-13.5"></path><path class="without-check" stroke-linecap="round" stroke-linejoin="round" d="M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6"></path></svg></span><pre class="shiki dark-plus" style="background-color: #1E1E1E" tabindex="0"><code><span class="line"><span style="color: #569CD6">fn</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">main</span><span style="color: #D4D4D4">() -&gt; ! {</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">let</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">mut</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">peripherals</span><span style="color: #D4D4D4"> = </span><span style="color: #4EC9B0">stm32f429</span><span style="color: #D4D4D4">::</span><span style="color: #4EC9B0">Peripherals</span><span style="color: #D4D4D4">::</span><span style="color: #DCDCAA">take</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">unwrap</span><span style="color: #D4D4D4">();</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">    //Enable gpio b clock</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">let</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">rcc</span><span style="color: #D4D4D4"> = &amp;</span><span style="color: #9CDCFE">peripherals</span><span style="color: #D4D4D4">.RCC;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">rcc</span><span style="color: #D4D4D4">.ahb1enr.</span><span style="color: #DCDCAA">write</span><span style="color: #D4D4D4">(|</span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">| </span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">gpioben</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">bit</span><span style="color: #D4D4D4">(</span><span style="color: #569CD6">true</span><span style="color: #D4D4D4">));</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">    //set pin 14 to output</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #569CD6">let</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">gpio</span><span style="color: #D4D4D4"> = &amp;</span><span style="color: #9CDCFE">peripherals</span><span style="color: #D4D4D4">.GPIOB;</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">gpio</span><span style="color: #D4D4D4">.moder.</span><span style="color: #DCDCAA">write</span><span style="color: #D4D4D4">(|</span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">| </span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">moder14</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">bits</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">1</span><span style="color: #D4D4D4">));</span></span>
<span class="line"></span>
<span class="line"><span style="color: #6A9955">    //Turn on led</span></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #9CDCFE">gpio</span><span style="color: #D4D4D4">.odr.</span><span style="color: #DCDCAA">write</span><span style="color: #D4D4D4">(|</span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">| </span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">odr14</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">set_bit</span><span style="color: #D4D4D4">());</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">    </span><span style="color: #C586C0">loop</span><span style="color: #D4D4D4"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #DCDCAA">delay</span><span style="color: #D4D4D4">(</span><span style="color: #B5CEA8">10000</span><span style="color: #D4D4D4">);</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">if</span><span style="color: #D4D4D4">  </span><span style="color: #9CDCFE">gpio</span><span style="color: #D4D4D4">.odr.</span><span style="color: #DCDCAA">read</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">odr14</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">bit</span><span style="color: #D4D4D4">()</span></span>
<span class="line"><span style="color: #D4D4D4">        {</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #9CDCFE">gpio</span><span style="color: #D4D4D4">.odr.</span><span style="color: #DCDCAA">write</span><span style="color: #D4D4D4">(|</span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">| </span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">odr14</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">clear_bit</span><span style="color: #D4D4D4">());</span></span>
<span class="line"><span style="color: #D4D4D4">        }</span></span>
<span class="line"><span style="color: #D4D4D4">        </span><span style="color: #C586C0">else</span><span style="color: #D4D4D4"> {</span></span>
<span class="line"><span style="color: #D4D4D4">            </span><span style="color: #9CDCFE">gpio</span><span style="color: #D4D4D4">.odr.</span><span style="color: #DCDCAA">write</span><span style="color: #D4D4D4">(|</span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">| </span><span style="color: #9CDCFE">w</span><span style="color: #D4D4D4">.</span><span style="color: #DCDCAA">odr14</span><span style="color: #D4D4D4">().</span><span style="color: #DCDCAA">set_bit</span><span style="color: #D4D4D4">());</span></span>
<span class="line"><span style="color: #D4D4D4">        }</span></span>
<span class="line"><span style="color: #D4D4D4">        </span></span>
<span class="line"><span style="color: #D4D4D4">    }</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span>
<span class="line"></span>
<span class="line"><span style="color: #569CD6">fn</span><span style="color: #D4D4D4"> </span><span style="color: #DCDCAA">delay</span><span style="color: #D4D4D4">(</span><span style="color: #9CDCFE">count</span><span style="color: #D4D4D4">: </span><span style="color: #4EC9B0">u32</span><span style="color: #D4D4D4">) {</span></span>
<span class="line"><span style="color: #D4D4D4">     </span><span style="color: #C586C0">for</span><span style="color: #D4D4D4"> </span><span style="color: #9CDCFE">_</span><span style="color: #D4D4D4"> </span><span style="color: #569CD6">in</span><span style="color: #D4D4D4"> </span><span style="color: #B5CEA8">0</span><span style="color: #D4D4D4">..</span><span style="color: #9CDCFE">count</span><span style="color: #D4D4D4"> { </span><span style="color: #4EC9B0">cortex_m</span><span style="color: #D4D4D4">::</span><span style="color: #4EC9B0">asm</span><span style="color: #D4D4D4">::</span><span style="color: #DCDCAA">nop</span><span style="color: #D4D4D4">() }</span></span>
<span class="line"><span style="color: #D4D4D4">}</span></span></code></pre></div>



<p class="wp-block-paragraph">Although Rust is an exciting new option for embedded development, it will take some time for it to supplant C/C++ as the standard. A lack of official support from major silicon vendors like <a href="/services/embedded-development-and-embedded-programming/embedded-systems-platforms">ST, NXP, and Silicon Labs</a> means that adding support for new microcontrollers can be a tedious process. Additionally, C/C++ frameworks like ARM&#8217;s mbed offer large, general purpose libraries and drivers that can be used across a variety of ARM targets with little to no modification.</p>



<p class="wp-block-paragraph">Learn more about DMC&#8217;s <a href="/services/embedded-development-and-embedded-programming/product-development">Embedded Product Development</a> Services and <a href="/services/embedded-development-and-embedded-programming/embedded-systems-platforms">Embedded Systems Platforms</a> expertise.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/21750/oxidizing-bare-metal-rust-programming-for-arm-microcontrollers/">Oxidizing Bare Metal: Rust Programming for ARM Microcontrollers</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Recovering Missing Library Components in Altium Designer</title>
		<link>https://static.dmcinfo.com/blog/25888/recovering-missing-library-components-in-altium-designer/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Tue, 09 Feb 2016 13:51:36 +0000</pubDate>
				<category><![CDATA[Embedded Development & Programming]]></category>
		<category><![CDATA[Low-Power Embedded Design]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/25888/recovering-missing-library-components-in-altium-designer/</guid>

					<description><![CDATA[<p>Have you ever opened an Altium project only to discover that a Footprint or Schematic Library file is missing? Maybe your coworker forgot to commit the files to version control, or forgot to include them in the .zip file before leaving for vacation. If so, have no fear: you can recover the footprints easily and [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/25888/recovering-missing-library-components-in-altium-designer/">Recovering Missing Library Components in Altium Designer</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">Have you ever opened an Altium project only to discover that a Footprint or Schematic Library file is missing? Maybe your coworker forgot to commit the files to version control, or forgot to include them in the .zip file before leaving for vacation. If so, have no fear: you can recover the footprints easily and automatically.</p>

<h2 class="wp-block-heading">Schematic Library</h2>

<p class="wp-block-paragraph">From the Schematic Editor, select Design -&gt; Make Schematic Library.</p>

<p class="wp-block-paragraph">Altium will convert each component on your schematic into a library component and will use the Library Reference parameter to name each component. However, if you use part parameters to store information like part numbers, vendor links, etc. (which you should be!), Altium will flag components with the same Library Reference but different parameters. An example of this is shown below. Two of the capacitors in my schematic use the same symbol but have different part number fields (&quot;different internal structure&quot; in Altium-speak).</p>

<figure class="wp-block-image"><img decoding="async" alt="Duplicated components interface in Altium Designer" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/recover-library-duplicated-components.png"  /></figure>

<p class="wp-block-paragraph">There&apos;s no need to have several different capacitor (or inductor, resistor, etc) symbols in your symbol library &#8211; you just need to make sure you edit/verify the component parameters when you add the component to your schematic. But you do that anyway, right?</p>

<p class="wp-block-paragraph">If you select &quot;Process only the first instance and ignore the rest&quot; and then click &quot;Remember the answer and don&apos;t ask again&quot;, it will only create one schematic symbol per Library Reference.</p>

<p class="wp-block-paragraph">When finished, the new symbol library will be added to your project and opened in Altium. By default, the library filename is set to whatever your project file is named.</p>

<h2 class="wp-block-heading">Footprint Library</h2>

<p class="wp-block-paragraph">To generate a footprint library, go to your PCB Editor and select Design -&gt; Make PCB Library. As before, Altium will create a new library component for each footprint in your design and then open the library for your perusal when complete.</p>

<h2 class="wp-block-heading">Library Trimming</h2>

<p class="wp-block-paragraph">This functionality is useful in a few other cases as well. The main case is useful for handing off the finalized design to a client or manufacturer. In large embedded projects, it&apos;s common to make changes to the component selection in order to drive cost down, improve functionality, decrease power consumption, etc. As a result, there will be extra library components hanging around. Using the procedures described above, you can create libraries that contain only the parts in your design, rather than manually searching for and deleting the extras.</p>

<p class="wp-block-paragraph">Happy PCB designing!</p>

<p class="wp-block-paragraph"><a href="https://static.dmcinfo.com/services/embedded-development-and-embedded-programming">Learn more about DMC&apos;s embedded development and programming services.</a></p>
<p>The post <a href="https://static.dmcinfo.com/blog/25888/recovering-missing-library-components-in-altium-designer/">Recovering Missing Library Components in Altium Designer</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Improving Battery Life in Low Power Embedded Applications Part 2: Case Study</title>
		<link>https://static.dmcinfo.com/blog/28457/improving-battery-life-in-low-power-embedded-applications-part-2-case-study/</link>
		
		<dc:creator><![CDATA[DMC]]></dc:creator>
		<pubDate>Wed, 24 Apr 2013 14:25:35 +0000</pubDate>
				<category><![CDATA[Embedded Development & Programming]]></category>
		<category><![CDATA[Low-Power Embedded Design]]></category>
		<guid isPermaLink="false">https://static.dmcinfo.com/blog/28457/improving-battery-life-in-low-power-embedded-applications-part-2-case-study/</guid>

					<description><![CDATA[<p>In Part 1, I talked about how battery capacity is rated and how certain conditions can affect relative battery capacity. This case study will specifically focus on a solution DMC provided for a low-power embedded application designed around user interaction with a high base current draw. Many of its principles can be applied to all [&#8230;]</p>
<p>The post <a href="https://static.dmcinfo.com/blog/28457/improving-battery-life-in-low-power-embedded-applications-part-2-case-study/">Improving Battery Life in Low Power Embedded Applications Part 2: Case Study</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In <a href="/latest-thinking/blog/id/8483/improving-battery-life-in-low-power-embedded-applications-part-1-basics">Part 1</a>, I talked about how battery capacity is rated and how certain conditions can affect relative battery capacity. This case study will specifically focus on a solution DMC provided for a low-power embedded application designed around user interaction with a high base current draw. Many of its principles can be applied to all embedded applications.</p>



<p class="wp-block-paragraph"><strong>Active/Sleep Programming</strong></p>



<p class="wp-block-paragraph">One of the first steps DMC took to help improve battery life was to use an active/sleep architecture for running the program. In this design, the microcontroller and any other high-current devices are shut down/put to sleep when they are not needed. This inherently created a variable current draw for the device, but ended up being much more efficient than having the hardware idly chewing up current without accomplishing anything (idle operations).</p>



<p class="wp-block-paragraph">This was accomplished with a microcontroller by using hardware interrupts to bring the microcontroller out of a sleep state to process new data or actions. Specifically, DMC used a TI MSP430 that sat in an ultra-low power state that was interrupted by a couple of conditions: a timer set to update the user display, a button action, or new data from an external chip. Once interrupted, the microcontroller did all the necessary calculations and then went back to sleep. The microcontroller was also limited in how often it could be awoken, even when being constantly interacted with, to guarantee a certain duty cycle of sleep vs. active. Using this in place of code that actively waited for those conditions reduced the microcontroller&#8217;s average current draw by orders of magnitude. </p>



<p class="wp-block-paragraph">DMC further increased battery life by optimizing the active/sleep timing and behavior for the customer’s exact application, increasing the battery life of an inactive device from 160 to 240 hours. This was done by running all communications in parallel with processing using interrupts, and by reducing the display update frequency while keeping the user experience intact. Both of these allowed the microcontroller to get to sleep quicker and stay asleep longer.</p>



<p class="wp-block-paragraph"><strong>Clockspeed Adjustments</strong></p>



<p class="wp-block-paragraph">The next step DMC took was to optimize the clock speed at which the microcontroller was operating. Almost all microcontrollers have the ability to change their clock speed, and some even dynamically while running code. If running off of an external power source, it is typical to just run the device at the highest clock speed, and with a sleep/active architecture, some may argue that the active clock speed is not important since a faster clock speed allows you to run your calculations quicker and get back to a sleep state.</p>



<p class="wp-block-paragraph">However, remembering the conditions from the first post, a higher current draw has a bigger impact than a low current draw, even if they average to be the same. Therefore, DMC optimized the clock so that it only ran as fast as necessary to complete our code in the allotted amount of time. In this application, DMC used an oscilloscope to time the processing of certain functions under specific conditions, allowing the clock speed to be changed for each case while still maintaining responsiveness and accuracy.</p>



<p class="wp-block-paragraph">In the image above, you can see the change in current draw when the clock speed in our application was reduced. In both cases, the amount of computation is the same, as is the average current draw over time, but the higher clock rate has a much greater peak current draw. The results of decreasing this peak were an increase in idle battery life from 260 to 300 hours and dynamic life from 150 to 180 hours.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BatteryLife1.png" alt=""/></figure>



<p class="wp-block-paragraph"><strong>Capacitor smoothing</strong></p>



<p class="wp-block-paragraph">In addition to reducing the clock speed when actively processing data, DMC also added capacitance to the battery supply to further reduce the peak current draws seen by the battery. By placing a fairly large capacitor in parallel with the battery, the capacitor can act as a power source when high currents are required. The result is that the battery does not have to supply all of this current, and the capacitor can be recharged during periods of low current draw. In the end, the battery sees a much smoother current profile and gets closer to our ideal situation of constant low current draw.</p>



<p class="wp-block-paragraph">In the image below, the addition of a 100 mfd capacitor dramatically reduced the peak current draw seen by the battery. This resulted in an increase in dynamic battery life from 180 to 210 hours.</p>



<figure class="wp-block-image"><img decoding="async" src="https://static.dmcinfo.com/wp-content/uploads/2025/05/BatteryLife2.png" alt=""/></figure>



<p class="wp-block-paragraph"><strong>Conclusion</strong></p>



<p class="wp-block-paragraph">By leveraging DMC’s knowledge in embedded software and hardware development, DMC was able to improve the customer’s battery life by almost 90% when inactive and 40% when active. This, in the end, will provide a better selling point for the device and reduce battery costs and downtime for the end user.</p>
<p>The post <a href="https://static.dmcinfo.com/blog/28457/improving-battery-life-in-low-power-embedded-applications-part-2-case-study/">Improving Battery Life in Low Power Embedded Applications Part 2: Case Study</a> appeared first on <a href="https://static.dmcinfo.com/">DMC, Inc.</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
