<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://wayri.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://wayri.github.io/" rel="alternate" type="text/html" /><updated>2026-10-18T16:30:26+00:00</updated><id>https://wayri.github.io/feed.xml</id><title type="html">Yawar | Engineering the Physical Layer</title><subtitle>Electrical engineering, power electronics, embedded systems, and engineering tools</subtitle><author><name>Yawar Badri</name></author><entry><title type="html">500W Three-Phase Inverter: Architecture and Layout</title><link href="https://wayri.github.io/blog/2026/06/17/500w-3-phase-inverter/" rel="alternate" type="text/html" title="500W Three-Phase Inverter: Architecture and Layout" /><published>2026-06-17T00:00:00+00:00</published><updated>2026-06-17T00:00:00+00:00</updated><id>https://wayri.github.io/blog/2026/06/17/500w-3-phase-inverter</id><content type="html" xml:base="https://wayri.github.io/blog/2026/06/17/500w-3-phase-inverter/"><![CDATA[<p>This article describes the architecture and layout choices for a three-phase inverter board tested at 500 W continuous power. The main design concerns include switching loops, heat removal, gate drive, and protection.</p>

<p>The linked <strong><a href="https://github.com/wayri/3-Phase-inverter-board">inverter board</a></strong> provides the project context. The sections below focus on its supporting circuits and physical layout.</p>

<hr />

<h3 id="system-architecture">System Architecture</h3>

<p>The core topology is a three-phase, two-level voltage-source inverter (VSI). The supporting circuits handle sensing, gate drive, and filtering.</p>

<pre><code class="language-mermaid">graph TD
    DC[DC Input Bus] --&gt; Caps[DC-Link Capacitors]
    Caps --&gt; Bridge[3-Phase VSI Bridge]
    
    MCU[Control MCU / DSP] --&gt;|PWM Signals| Iso[Digital Isolation]
    Iso --&gt; Gate[Isolated Gate Drivers]
    Gate --&gt;|High/Low Side Drive| Bridge
    
    Bridge --&gt; Filter[On-Board LC Filter]
    Filter --&gt; Load[3-Phase Load / Motor]
    
    Bridge -.-&gt;|Current Sense| MCU
    DC -.-&gt;|Voltage Sense| MCU
</code></pre>

<h4 id="the-dc-link-and-decoupling">The DC-Link and Decoupling</h4>
<p>The DC-link capacitor bank supplies switching current near the bridge. Excess series resistance (ESR) raises capacitor heating, while loop inductance (including capacitor ESL) contributes to voltage overshoot during switching.</p>

<p>To mitigate this, the board supports multiple capacitor footprint options, allowing for a mix of bulk electrolytic capacitors (for low-frequency energy storage) and high-frequency ceramic/film capacitors placed immediately adjacent to the switching nodes.</p>

<hr />

<h3 id="gate-drive-and-isolation">Gate Drive and Isolation</h3>

<p>Gate-drive timing affects switching loss, voltage overshoot, and electromagnetic interference (EMI). Faster edges can reduce transition loss but may increase ringing.</p>

<pre><code class="language-ascii">     +HV DC
       |
     | D |  (High-Side Switch)
     +---+
       |--------&gt; Phase Output (U, V, W)
     +---+
     | D |  (Low-Side Switch)
       |
      GND
</code></pre>

<p>The gate-drive path uses:</p>
<ol>
  <li><strong>Digital isolators</strong> to separate control signals from the power stage.</li>
  <li><strong>Gate drivers</strong> sized for the selected MOSFETs and switching rate.</li>
  <li><strong>Overcurrent protection provisions</strong>, whose sensing and shutdown method depend on the final switch and driver choices.</li>
</ol>

<hr />

<h3 id="output-filter-design">Output Filter Design</h3>

<p>PWM output contains switching-frequency components. Where the load or interface requires lower ripple, an output filter can attenuate those components; its values depend on the application.</p>

<p>This board includes <strong>on-board filter options</strong>.</p>
<ul>
  <li>The <strong>inductor ($L$)</strong> limits current ripple and must be checked for saturation at the expected peak current.</li>
  <li>The <strong>capacitor ($C$)</strong> provides a high-frequency current path; its connection and rating depend on the chosen filter topology.</li>
</ul>

<p>The filter is integrated on the board to keep high-frequency current paths short and make EMI easier to manage.</p>

<hr />

<h3 id="physical-layout--thermal-management">Physical Layout &amp; Thermal Management</h3>

<p>PCB layout affects voltage spikes, thermal behavior, and reliability, even when the schematic is sound.</p>

<p><strong>Key Layout Principles Applied:</strong></p>
<ol>
  <li><strong>Minimizing Commutation Loops</strong>: The loop from the DC-link capacitor, through the high-side switch, through the low-side switch, and back to the capacitor must be physically as small as possible to minimize parasitic inductance ($L_{loop}$). High $L_{loop}$ combined with high $di/dt$ causes destructive voltage spikes ($V = L \cdot di/dt$).</li>
  <li><strong>Thermal Planes</strong>: The copper pours carrying phase currents are sized not just for electrical resistance, but as thermal radiators.</li>
  <li><strong>Trace Clearance</strong>: Ensuring adequate creepage and clearance distances between the high-voltage DC bus and the low-voltage control circuitry to prevent arcing.</li>
</ol>

<h3 id="conclusion">Conclusion</h3>

<p>The board is a test platform for motor-control and power-conversion work. Switching speed, layout, thermal design, and clearances all need to be considered together.</p>]]></content><author><name>Yawar Badri</name></author><category term="Power Electronics" /><summary type="html"><![CDATA[This article describes the architecture and layout choices for a three-phase inverter board tested at 500 W continuous power. The main design concerns include switching loops, heat removal, gate drive, and protection.]]></summary></entry><entry><title type="html">Capacitive Pressure Sensing: Geometry and Readout</title><link href="https://wayri.github.io/blog/2026/05/21/capacitor-pressure-sensor/" rel="alternate" type="text/html" title="Capacitive Pressure Sensing: Geometry and Readout" /><published>2026-05-21T00:00:00+00:00</published><updated>2026-05-21T00:00:00+00:00</updated><id>https://wayri.github.io/blog/2026/05/21/capacitor-pressure-sensor</id><content type="html" xml:base="https://wayri.github.io/blog/2026/05/21/capacitor-pressure-sensor/"><![CDATA[<p>A capacitor’s value depends on its geometry and dielectric. If pressure deflects a diaphragm or compresses a dielectric, the resulting capacitance change can be measured. This article describes the design principle; it does not report a calibrated sensor test.</p>

<h2 id="the-governing-physics">The Governing Physics</h2>

<p>Capacitance of a parallel-plate capacitor:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>C = ε₀ × εᵣ × A / d
</code></pre></div></div>

<p>Where:</p>
<ul>
  <li><strong>A</strong> — plate overlap area (m²)</li>
  <li><strong>d</strong> — plate separation (m)</li>
  <li><strong>εᵣ</strong> — dielectric permittivity</li>
</ul>

<p>With a fixed plate area and dielectric, reducing a 10 µm gap to 9 µm raises the ideal parallel-plate capacitance by about <strong>11%</strong>. Fringing fields, diaphragm shape, and material changes make the response of a real sensor less simple.</p>

<h2 id="two-structural-approaches">Two Structural Approaches</h2>

<h3 id="1-diaphragm-type-mems-style">1. Diaphragm-Type (MEMS Style)</h3>
<p>A thin conductive membrane suspended over a fixed plate. Applied pressure deflects the membrane, decreasing the air gap:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>ΔC / C₀ ≈ -Δd / d₀    (for small changes in gap)
</code></pre></div></div>

<p>MEMS devices use this principle at micrometre scale. A flexible electrode over a cavity is one possible prototype approach, but its pressure range and sensitivity depend on the mechanical design and must be calibrated.</p>

<h3 id="2-dielectric-compression">2. Dielectric Compression</h3>
<p>Soft dielectrics between plates may compress under load. Both gap and permittivity can change, so the capacitance-to-pressure relationship needs measurement and calibration.</p>

<h2 id="readout-circuit">Readout Circuit</h2>

<p>One readout option converts capacitance to an oscillator frequency; the frequency equation depends on the circuit used. A capacitance-to-digital converter is another option. For example, the <a href="https://www.analog.com/media/en/technical-documentation/data-sheets/AD7745_7746.pdf">AD7746 data sheet</a> specifies a ±4 pF changing-capacitance range and up to 17 pF of common-mode capacitance. Its 4 aF resolution figure describes noise under specified conditions, not overall measurement accuracy. The sensor and readout must be matched for baseline capacitance and expected change.</p>

<h2 id="noise-and-stability-concerns">Noise and Stability Concerns</h2>

<ul>
  <li><strong>Parasitic capacitance</strong>: Keep sense connections short and consider driven guards or shielding where the readout supports them.</li>
  <li><strong>Humidity</strong>: Moisture can change dielectric properties and leakage; packaging choices depend on the intended environment.</li>
  <li><strong>Temperature drift</strong>: Characterize the sensor and readout across the operating range, then calibrate or compensate as needed.</li>
</ul>

<h2 id="practical-build-notes">Practical Build Notes</h2>

<p>A prototype could use two electrodes separated by a flexible film. The next steps would be to measure baseline capacitance, apply known pressures, repeat loading cycles, and check drift and hysteresis. No pressure-to-capacitance measurement is reported here.</p>

<p>The geometry sets the ideal sensitivity; calibration and environmental testing determine whether a particular build is useful as a pressure sensor.</p>]]></content><author><name>Yawar Badri</name></author><category term="Sensors &amp; Instrumentation" /><summary type="html"><![CDATA[A design note on diaphragm-based capacitance sensing, readout range, and calibration.]]></summary></entry><entry><title type="html">Power Dissipation in Electronics: From Calculation to PCB</title><link href="https://wayri.github.io/blog/2026/05/21/power-dissipation/" rel="alternate" type="text/html" title="Power Dissipation in Electronics: From Calculation to PCB" /><published>2026-05-21T00:00:00+00:00</published><updated>2026-05-21T00:00:00+00:00</updated><id>https://wayri.github.io/blog/2026/05/21/power-dissipation</id><content type="html" xml:base="https://wayri.github.io/blog/2026/05/21/power-dissipation/"><![CDATA[<p>Power lost in a component appears mostly as heat. Estimating that loss and the path from the component to ambient helps identify where thermal validation is needed.</p>

<h2 id="the-fundamentals">The Fundamentals</h2>

<p>Power dissipation in a resistive element is defined by:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>P = I² × R  =  V² / R  =  V × I
</code></pre></div></div>

<p>For a 10 V to 5 V linear regulator supplying 1 A, the IC dissipates about 5 W. A buck converter delivering the same 5 W output at an assumed 90% efficiency would dissipate about 0.56 W. Actual efficiency depends on the device and operating point.</p>

<h2 id="where-power-actually-goes">Where Power Actually Goes</h2>

<p>In a real system, losses appear across multiple domains:</p>

<table>
  <thead>
    <tr>
      <th>Domain</th>
      <th>Primary Loss Mechanism</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Linear regulators</td>
      <td>Voltage drop × current</td>
    </tr>
    <tr>
      <td>MOSFETs</td>
      <td>I²×Rds(on) conduction + switching losses</td>
    </tr>
    <tr>
      <td>Inductors</td>
      <td>I²×DCR + core losses</td>
    </tr>
    <tr>
      <td>PCB traces</td>
      <td>I²×R_trace</td>
    </tr>
    <tr>
      <td>Connectors</td>
      <td>Contact resistance × I²</td>
    </tr>
  </tbody>
</table>

<h2 id="trace-resistance">Trace Resistance</h2>

<p>Using bulk copper resistivity as a first estimate, a 10 mm trace that is 0.3 mm wide and 35 µm thick has:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>R = ρ × L / A
R = (1.72×10⁻⁸) × 0.01 / (0.3×10⁻³ × 35×10⁻⁶)
R ≈ 16.4 mΩ
</code></pre></div></div>

<p>At 3 A, that is about 147 mW. Actual resistance also depends on copper thickness, temperature, and geometry.</p>

<h2 id="thermal-resistance-chain">Thermal Resistance Chain</h2>

<p>With a heatsink, a simplified steady-state thermal path is:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>T_junction = P_dissipated × (θ_jc + θ_cs + θ_sa) + T_ambient
</code></pre></div></div>

<p>Where:</p>
<ul>
  <li><strong>θ_jc</strong> — Junction-to-case (from datasheet)</li>
  <li><strong>θ_cs</strong> — Case-to-heatsink (depends on TIM/pad)</li>
  <li><strong>θ_sa</strong> — Heatsink-to-ambient (heatsink selection)</li>
</ul>

<p>Without a heatsink, use the package’s junction-to-ambient estimate instead of θ_sa. For example, 8 W with θ_ja = 60°C/W would imply a 480°C temperature rise in this simple model, far beyond a practical operating limit. With a heatsink and illustrative values θ_jc = 2°C/W, θ_cs = 0.5°C/W, and θ_sa = 5°C/W, the same 8 W at 40°C ambient gives an estimated junction temperature of 100°C. These values must come from the chosen device, mounting method, heatsink, and airflow. See <a href="https://www.ti.com/lit/an/slva118a/slva118a.pdf">TI’s thermal model guide</a> for the distinction between θ_ja and a heatsink path.</p>

<h2 id="my-verification-workflow">My Verification Workflow</h2>

<ol>
  <li><strong>Schematic phase</strong>: Annotate every power path with expected I, V, and P</li>
  <li><strong>Layout phase</strong>: Check resistance and temperature rise on relevant power traces</li>
  <li><strong>Thermal simulation</strong>: Build a thermal model in MATLAB or LTspice</li>
  <li><strong>Lab validation</strong>: Thermistor + thermal camera after 30-min steady state soak</li>
</ol>

<p>Estimate the losses, measure temperatures under representative loads, and update the model where measurements differ.</p>]]></content><author><name>Yawar Badri</name></author><category term="Power Electronics" /><summary type="html"><![CDATA[Understanding where power goes — and how to stop it from becoming a failure mode.]]></summary></entry><entry><title type="html">Generating PWM with STM32</title><link href="https://wayri.github.io/blog/2026/05/21/stm32-pwm/" rel="alternate" type="text/html" title="Generating PWM with STM32" /><published>2026-05-21T00:00:00+00:00</published><updated>2026-05-21T00:00:00+00:00</updated><id>https://wayri.github.io/blog/2026/05/21/stm32-pwm</id><content type="html" xml:base="https://wayri.github.io/blog/2026/05/21/stm32-pwm/"><![CDATA[<p>Microcontrollers handle tasks from sensor sampling to motor control. PWM generation is one example where the timer configuration matters as much as the application code.</p>

<p>For projects needing more timer channels, interfaces, or processing headroom, a 32-bit STM32 can be a useful choice. This example uses the STM32F103x8 family, which has a 72 MHz Cortex-M3 core, timers, and 12-bit ADCs; peripheral availability varies by STM32 model. See the <a href="https://www.st.com/resource/en/datasheet/CD00161566.pdf">STM32F103x8 data sheet</a> for device limits.</p>

<p><strong><a href="https://github.com/wayri/Generating-PWM-with-STM32">View the related STM32CubeMX/HAL PWM project on GitHub</a></strong></p>

<h3 id="the-development-ecosystem">The Development Ecosystem</h3>
<p>For an STM32F103x8 PWM project, a typical toolchain includes:</p>
<ul>
  <li><strong>Software:</strong> <strong>STM32CubeMX</strong> can configure clocks and pins and generate initialization code. <strong>Keil uVision</strong> is one option for building and debugging C/C++ firmware.</li>
  <li><strong>Hardware:</strong> An <strong>ST-Link v2</strong> can flash the device and support Serial-Wire Debugging (SWD).</li>
  <li><strong>Libraries:</strong> ST’s Hardware Abstraction Layer (HAL) can simplify setup. The timer reference manual is useful when checking update timing or debugging a configuration.</li>
</ul>

<h3 id="the-physical-layer-of-pwm">The Physical Layer of PWM</h3>
<p>For edge-aligned PWM, the timer counts to an <code class="language-plaintext highlighter-rouge">Auto-Reload Register (ARR)</code> value, while a <code class="language-plaintext highlighter-rouge">Capture/Compare Register (CCR)</code> sets the compare point. The linked project uses STM32CubeMX and HAL; the following separate register-level illustration assumes TIM2 has a 72 MHz timer input clock and that the peripheral clock and output pin are already configured.</p>

<div class="language-c highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1">// Example Bare-Metal Timer Configuration</span>
<span class="n">TIM2</span><span class="o">-&gt;</span><span class="n">PSC</span> <span class="o">=</span> <span class="mi">71</span><span class="p">;</span>        <span class="c1">// 72 MHz timer clock / 72 = 1 MHz tick</span>
<span class="n">TIM2</span><span class="o">-&gt;</span><span class="n">ARR</span> <span class="o">=</span> <span class="mi">999</span><span class="p">;</span>       <span class="c1">// Auto-reload value (Period = 1ms -&gt; 1kHz frequency)</span>
<span class="n">TIM2</span><span class="o">-&gt;</span><span class="n">CCR1</span> <span class="o">=</span> <span class="mi">500</span><span class="p">;</span>      <span class="c1">// Duty cycle = 50% in PWM mode 1</span>
<span class="n">TIM2</span><span class="o">-&gt;</span><span class="n">CCMR1</span> <span class="o">|=</span> <span class="n">TIM_CCMR1_OC1M_1</span> <span class="o">|</span> <span class="n">TIM_CCMR1_OC1M_2</span><span class="p">;</span> <span class="c1">// PWM Mode 1</span>
<span class="n">TIM2</span><span class="o">-&gt;</span><span class="n">CCER</span> <span class="o">|=</span> <span class="n">TIM_CCER_CC1E</span><span class="p">;</span> <span class="c1">// Enable Output</span>
<span class="n">TIM2</span><span class="o">-&gt;</span><span class="n">CR1</span> <span class="o">|=</span> <span class="n">TIM_CR1_CEN</span><span class="p">;</span>    <span class="c1">// Start Timer</span>
</code></pre></div></div>

<h3 id="why-it-matters-in-power-electronics">Why It Matters in Power Electronics</h3>
<p>Timer clock, prescaler, and register update behavior set the available PWM resolution and timing. In a power converter, also check when preload values take effect and configure dead time and protection where the switching topology requires them.</p>]]></content><author><name>Yawar Badri</name></author><category term="Embedded Systems" /><summary type="html"><![CDATA[Microcontrollers handle tasks from sensor sampling to motor control. PWM generation is one example where the timer configuration matters as much as the application code.]]></summary></entry></feed>