* ESP32 Wearable Haptic Controller - MOSFET motor-driver transient validation
* Portfolio sample asset. Human-checked against the KiCad handoff notes.

Vbat VBAT 0 DC 3.7
Vgpio GPIO 0 PULSE(0 3.3 1m 100n 100n 2m 5m)
Rg GPIO GATE 220
Rpd GATE 0 100k

* Vibration motor approximation: winding resistance plus inductance.
Lmotor VBAT MOTOR 2m
Rmotor MOTOR DRAIN 8

* Flyback diode clamps drain voltage when the MOSFET turns off.
Dfly DRAIN VBAT Dfast
Msw DRAIN GATE 0 0 NLOGIC

.model Dfast D(IS=2n RS=0.08 CJO=8p TT=25n BV=60 IBV=10u)
.model NLOGIC NMOS(VTO=1.8 KP=2.8 RD=0.08 RS=0.05 LAMBDA=0.02)

.tran 10u 12m

.control
run
set wr_singlescale
set wr_vecnames
wrdata eda-portfolio/evidence/ngspice/mosfet-driver-output.csv v(GPIO) v(GATE) v(DRAIN) i(Lmotor) i(Vbat)
quit
.endc

.end
