Skip to main content

Playground · research instrument

Signal

GaN FOC Drive — SVPWM Inverter + Motor

GaN/SiC three-phase inverter driving a PMSM with field-oriented control. Tune Vdc, Iq*/Id*, f_sw up to 100 kHz, dead-time ns, torque load, p, Rs/Ls. Watch stator flux spin, 3-phase currents, Clarke/Park live, SVPWM hexagon with sector times, dead-time distortion V_dead=td·fsw·Vdc·sign(I), thermal ΔT=Rth·Psw and hear whine pitch-tracked to fe=p·ωm/2π.

Independent research instrument — not claimed as MakerPortal shipped product code. Methods, equations, assumptions, and limitations are disclosed so you can inspect what the page does and does not establish.

Inverter & Motor Tuning

DC-link & FOC setpoint — Iq torque, Id flux

GaN/SiC Switching — dead-time & f_sw

Motor — PMSM SPMSM

ω_m rpm
fe Hz = p·ωm/2π
Te Nm
id / iq A
ia pk A
Vd / Vq V
Mod M / sector
V_dead V
Pcond / Psw W
ΔT °C / η %
T1 T2 T0 µs

Stator flux rotation — αβ + dq frame (ψs)

Green: stator ψs, Orange: rotor ψm, Blue: αβ, White: dq rotating. θe = ∫ωe.

SVPWM hexagon — Vref = Vdc/√3 limit, sector T1/T2

Yellow: Vref, gray hex: 2·Vdc/3 vectors V1-V6, inner circle Vdc/√3, red haze dead-time.

3-phase currents — Clarke/Park live (ia,ib,ic & id,iq)

— ia— ib— ic— id— iqPark θ —

Thermal rise — ΔT=Rth·Psw, Psw≈fsw·Esw, efficiency

Esw≈Vdc·|I|·(tr+tf)/2, Pcond=I²Rds, LPF τ_th=2s. GaN tr=15ns tf=10ns.
Electrical θe
Inverter Vαβ
Switching loss Esw
— µJ
FOC loop dt
0.25 ms

Anatomy of the GaN FOC drive

Power stage → FOC chain

  1. GaN half-bridges: 3× half-bridge, Vdc 12-80 V, 2-level. GaN HEMT Rds(on) 3-80 mΩ, tr 15 ns tf 10 ns vs Si 80 ns. Dead-time td 0-500 ns inserts blanking to avoid shoot-through.
  2. SVPWM: Given vdq commands from PI, inverse Park → vαβ, SVPWM computes sector 1-6, T1,T2,T0 duty. Linear limit circle Vdc/√3 inside hexagon radius 2·Vdc/3.
  3. Dead-time distortion: Body diode conduction clamps phase to opposite rail, average error V_dead = td·fsw·Vdc·sign(I). Modeled as additive ΔVαβ via Clarke of per-phase V_dead·sign(i).
  4. PMSM motor: SPMSM Ld≈Lq=Ls. Electrical vd = R·id + L·did/dt - ωe·L·iq, vq = R·iq + L·diq/dt + ωe·L·id + ωe·ψm. Torque Te=1.5·p·ψm·iq (id=0).
  5. Mechanical: J·dωm/dt = Te - Tload - B·ωm, ωe = p·ωm, θe = ∫ωe dt. Inertia J tunes how fast speed ramps.
  6. Loss / thermal: Pcond=3·Irms²·Rds, Psw≈ Σ Vdc·|i|·(tr+tf)/2·fsw, Rth models heatsink, first-order LPF τ=2 s → ΔT=Rth·P, Tj=Tamb+ΔT.

Dead-time & thermal

Vdead=tdeadfswVdcsign(I),ΔT=RthPsw,  PswfswEswV_{dead}=t_{dead}\,f_{sw}\,V_{dc}\,sign(I),\quad \Delta T = R_{th}\,P_{sw},\; P_{sw}\approx f_{sw}E_{sw}

Reducing td from 2 µs Si to 80 ns GaN cuts distortion voltage ~25×, enabling silent 40-100 kHz operation.

Controls & sensing visualization

  • Flux canvas: stator flux ψs = L·Is + ψm rotor, dq frame rotating at θe. When id=0, ψs leads ψm by 90° (iq axis).
  • Currents canvas: 1000-sample rolling buffer ~2 electrical periods. Shows ia,ib,ic sinusoids, plus id,iq decoded live. Dead-time shows as zero-crossing flattening.
  • SVPWM canvas: hexagon V1(100)..V6(101) active, zeros V0,V7 center. Vref yellow dot, T1/T2 arrows along two bounding vectors, red halo width ∝ V_dead/Vref.
  • Thermal canvas: stacked area Pcond vs Psw, line Tj progression, efficiency η=Pmech/(Pmech+Ploss). Over-temp >125 °C flags fault.
  • Audio: 2 oscillators: carrier fe_hz = p·ωm/2π. Audible f = 5k + fe·55 + 1.2k·|Te| + fsw_mod (fsw>20k gives ultrasonic sideband folded). Gain ∝ torque+speed.
  • FOC PI: Kp≈L·bw, Ki≈R·bw, bw≈ 2π·400 Hz default. Decoupling feedforward ωe·L·I removes cross-axis.

PMSM dq model (SPMSM)

vd=Rid+LdiddtωeLiq,  vq=Riq+Ldiqdt+ωeLid+ωeψmv_d=R i_d+L\frac{di_d}{dt}-\omega_e L i_q,\; v_q=R i_q+L\frac{di_q}{dt}+\omega_e L i_d+\omega_e\psi_m

Discretized semi-implicit Euler at 4 kHz control, 0.25 ms.

Equations of motion

Clarke / Park transforms

iα=23(ia12ib12ic),  iβ=23(32ib32ic)i_\alpha=\tfrac23(i_a-\tfrac12 i_b-\tfrac12 i_c),\; i_\beta=\tfrac23(\tfrac{\sqrt3}{2}i_b-\tfrac{\sqrt3}{2}i_c)[idiq]=[cθsθsθcθ][iαiβ],  θe=pθm\begin{bmatrix}i_d\\ i_q\end{bmatrix}=\begin{bmatrix}c_\theta & s_\theta\\ -s_\theta & c_\theta\end{bmatrix}\begin{bmatrix}i_\alpha\\ i_\beta\end{bmatrix},\; \theta_e=p\theta_m

Amplitude invariant preserves peak sinusoid as dq DC.

FOC id=0 & SVPWM

Te=32p[ψmiq+(LdLq)idiq],  VrefVdc/3T_e=\tfrac32 p[\psi_m i_q+(L_d-L_q)i_d i_q],\; V_{ref}\le V_{dc}/\sqrt3T1=3TsVrefVdcsin(60θ),  T2=3TsVrefVdcsinθT_1=\sqrt3 T_s\frac{V_{ref}}{V_{dc}}\sin(60^\circ-\theta),\; T_2=\sqrt3 T_s\frac{V_{ref}}{V_{dc}}\sin\theta

MTPA id=0 for SPMSM, field weakening id negative above base speed.

Switching, power, audio

Esw12VdcI(tr+tf),  Psw=fswEsw,  ΔT=RthPE_{sw}\approx \tfrac12 V_{dc}|I|(t_r+t_f),\; P_{sw}=f_{sw}E_{sw},\; \Delta T=R_{th}Pfe=pωm2π,  faud=5k+55fe+1.2kTe,  fside=fsw±kfef_e=\frac{p\omega_m}{2\pi},\; f_{aud}=5k+55 f_e+1.2k|T_e|,\; f_{side}=f_{sw}\pm k f_e

fe is electrical, fsw is ultrasonic carrier GaN pushes >30 kHz.

Gear behind this build

GaN stack · 7 picks

Hardware picks7

More gear across every app: the full Gear list →

Hardware Kit Builder

Build the physical hardware platform. Select your components below to generate a live, real-time bill of materials and build instructions.

Build this lab

GaN FOC bench starter

Teensy 4.0 + RedBoard Plus + OpenLog + logic analyzer — close the loop from SVPWM simulation to phase-current capture. RedBoard & OpenLog are SparkFun Originals (10%).

Prices shown were retrieved from the Amazon Product Advertising API on 19 July 2026 and are indicative only — the price and availability on Amazon at the time of purchase apply.

Estimated total

$83

Prices from Amazon catalog cache · may change

Open primary listing ↗

Kit Total

Buy ↗

Core solver — TypeScript

// FOC core — Clarke, Park, SVPWM, PMSM dq model
type DQ = { d:number; q:number };
type AB = { a:number; b:number };

const SQRT3 = Math.sqrt(3);

// Clarke amplitude-invariant (ia+ib+ic=0)
function clarke(ia:number, ib:number, ic:number): AB {
  return { a: (2/3)*(ia - 0.5*ib - 0.5*ic), b: (2/3)*(SQRT3/2*ib - SQRT3/2*ic) };
}
function invClarke(ab:AB): [number,number,number] {
  const ia = ab.a;
  const ib = -0.5*ab.a + SQRT3/2*ab.b;
  const ic = -0.5*ab.a - SQRT3/2*ab.b;
  return [ia, ib, ic];
}
function park(ab:AB, theta:number): DQ {
  const c=Math.cos(theta), s=Math.sin(theta);
  return { d: ab.a*c + ab.b*s, q: -ab.a*s + ab.b*c };
}
function invPark(dq:DQ, theta:number): AB {
  const c=Math.cos(theta), s=Math.sin(theta);
  return { a: dq.d*c - dq.q*s, b: dq.d*s + dq.q*c };
}

function svpwm(valpha:number, vbeta:number, Vdc:number, fsw:number){
  const Vref = Math.hypot(valpha, vbeta);
  const Vlim = Vdc / Math.sqrt(3); // linear limit
  const V = Math.min(Vref, Vlim);
  let ang = Math.atan2(vbeta, valpha); // 0..2pi
  if(ang<0) ang+=2*Math.PI;
  const sector = Math.floor(ang / (Math.PI/3)) + 1; // 1..6
  const theta = ang - (sector-1)*(Math.PI/3); // 0..60deg
  const T = 1/fsw;
  const T1 = Math.sqrt(3)*T*V/Vdc*Math.sin(Math.PI/3 - theta);
  const T2 = Math.sqrt(3)*T*V/Vdc*Math.sin(theta);
  const T0 = Math.max(0, T - T1 - T2);
  const mod = V / Vlim;
  return { Vref, Vlim: V, mod, ang, sector, theta, T1, T2, T0, T };
}

// dead-time voltage error per phase
function vDead(td:number, fsw:number, Vdc:number, i:number): number {
  // V_dead = td * fsw * Vdc * sign(I)  (average over Ts)
  return td * fsw * Vdc * Math.sign(i);
}

// PMSM dq electrical dynamics
function dqDeriv(id:number,iq:number,vd:number,vq:number,we:number,R:number,L:number,psi:number){
  const didt = (vd - R*id + we*L*iq)/L;
  const diqt = (vq - R*iq - we*L*id - we*psi)/L;
  return { didt, diqt };
}
function torque(p:number, psi:number, iq:number, Ld:number, Lq:number, id:number){
  return 1.5 * p * (psi*iq + (Ld - Lq)*id*iq);
}

// PI + feedforward
function piFOC(e:number, int:number, Kp:number, Ki:number, we:number, L:number, iq:number, extra=0){
  return Kp*e + Ki*int + we*L*iq + extra;
}

Frequently asked questions

What does FOC with id = 0 mean?

For a surface PM motor Ld≈Lq, torque Te=1.5·p·ψm·iq + 1.5·p·(Ld-Lq)·id·iq reduces to 1.5·p·ψm·iq when id=0. Setting id_sp=0 puts all stator current into torque-producing q-axis, keeps the stator flux |ψs| = sqrt((Ld·id+ψm)²+(Lq·iq)²) minimal and maximizes efficiency below base speed. Field weakening uses id<0 to oppose ψm and extend speed.

How do Clarke and Park transforms work?

Clarke: 3-phase ia,ib,ic (ia+ib+ic=0) → αβ0: iα=2/3·(ia-0.5·ib-0.5·ic), iβ=2/3·(√3/2·ib-√3/2·ic), power/amplitude variant. Park rotates αβ by electrical angle θe: id=iα·cosθe+iβ·sinθe, iq=-iα·sinθe+iβ·cosθe. This locks the reference to the rotor so AC sinusoids become DC setpoints the PI can regulate. Inverse Park does vdq → vαβ for SVPWM.

What is SVPWM limit Vref = Vdc/√3 and the hexagon?

A two-level inverter can only output 6 active vectors V1..V6 at 60° steps plus two zeros. Their tips form a hexagon radius 2·Vdc/3 (amplitude invariant). The largest inscribed circle for linear modulation is Vdc/√3. Modulation index M=Vref/(Vdc/√3). T1=√3·Tsw·Vref/Vdc·sin(60°-θ), T2=√3·Tsw·Vref/Vdc·sinθ, T0=Tsw-T1-T2. Over M>1 we saturate to hexagon edge — six-step.

Why does dead-time cause voltage distortion?

To avoid shoot-through both FETs are off for td. Current freewheels through body diode, clamping phase voltage to ±Vdc/2 opposite sign of current. Average error per switching period averages to V_dead = td·fsw·Vdc·sign(I). It appears as 5th/7th harmonics, zero-crossing distortion, and torque ripple. GaN needs 10-80 ns vs Si IGBT 1-3 µs, so V_dead drops 10-30× at same fsw, enabling 50-100 kHz silent drives.

How is temperature rise and audio modeled?

Conduction Pcond = 3·Irms²·Rds(on). Switching Esw≈Vdc·|I|·(tr+tf)/2 per edge, Psw≈ fsw·Vdc·Iavg·(tr+tf). Total P = Pcond+Psw, ΔT=Rth·P filtered τ_th≈2s. Junction Tj=Tamb+ΔT. Audio: electrical freq fe=p·ωm/2π. Motor whine = carrier at fcarrier=clamp(5000+fe·55 + 1200·|Te|, 5000, 19000) Hz, amp modulated by |iq| and switching sidebands at fsw ± k·fe. GaN high fsw pushes carrier above 15 kHz where human sensitivity rolls off.

Shareable still

The instrument, captured—not illustrated.

This 16:9 frame is rendered from the real browser instrument above. It is the page's canonical preview for image search, link unfurls, and posts that need to show what the tool actually does.

Download 1280 × 720 JPEG
GaN/SiC Power Electronics & FOC Drive — live MakerPortal instrument screenshot
Canonical capture · real UI · no generated scientific artwork