MOSFET IV Characterization Visualizer
Interactive web-based visualizer for MOSFET IV curves. Plot Drain Current (Id) vs Drain-to-Source Voltage (Vds) with multiple gate voltage (Vgs) sweeps, overlay data from different devices, compute saturation boundaries, and extract device parameters.
Features
- Multiple Vgs sweep curves with per-sweep color coding
- Device overlay — compare multiple MOSFETs on the same chart
- Custom legend — eyeball toggle per device and per sweep, sweep count badges
- Saturation boundary detection — compute the linear/saturation region boundary via knee detection algorithm
- Parameter extraction — threshold voltage (Vth), on-resistance (Rds_on)
- Linear/Log scale toggle — essential for subthreshold characterization
- Crosshair cursor with hover tooltip showing exact Vds, Id, Vgs values
- Export — PNG, SVG, CSV, JSON
- CSV import — drag-and-drop curve tracer CSV files directly onto the chart
- Real-time API control — WebSocket pushes all state changes to the frontend instantly
- Shot log — monitor all API calls with timestamps and durations
Data Formats
JSON Sweeps
{
"action": "plot",
"device": { "id": "IRF540N", "name": "IRF540N", "type": "NMOS" },
"sweeps": [
{ "vgs": 4.0, "data": [{ "vds": 0, "id": 0 }, { "vds": 5, "id": 0.5 }] }
]
}
Curve Tracer CSV
Column triplets per sweep: VN (V), IN (A), RN (Ohm) — auto-detected from headers.
AI Prompts
| Prompt | What it does |
|---|
| "Plot my MOSFET IV curves from this CSV file" | Reads CSV, sends to visualizer |
| "Show me the MOSFET visualizer with sample data" | Starts server, loads demo, opens panel |
| "Compute the saturation boundary curve" | Runs knee finder, draws red dashed parabola |
| "What's the threshold voltage?" | Analyzes data, extracts Vth |
| "Switch to log scale" | Toggles Y-axis to log10 |
| "Overlay my BSS138 data on the IRF540N" | Adds second device for comparison |
Keyboard Shortcuts
| Key | Action |
|---|
| L | Toggle linear/log scale |
| K | Compute/clear saturation curve |
| S | Load sample data |
| R | Reset zoom |
Architecture
- Server: Node.js HTTP + WebSocket (port 8778)
- Frontend: Self-contained HTML with Plotly.js
- Brand: Adom dark theme (teal #00b8b0)
---
name: mosfet-visualizer
description: Use when the user wants to visualize MOSFET IV curves, plot drain current vs drain-to-source voltage, characterize MOSFETs, overlay IV data from multiple devices, compare MOSFET devices, or analyze MOSFET parameters (Vth, Rds_on, gm). Trigger phrases include "MOSFET IV", "IV curves", "characterize MOSFET", "drain current", "Vds vs Id", "plot MOSFET", "MOSFET visualizer", "saturation boundary", "knee point", "curve tracer data".
---
# MOSFET IV Characterization Visualizer
Interactive web-based visualizer for MOSFET IV curves (Id vs Vds). Supports multiple Vgs sweeps, device overlay, saturation boundary detection, and real-time API control.
**Server:** `http://127.0.0.1:8778`
**Source:** `/home/adom/project/mosfet-visualizer/`
## Quick Start
### 1. Ensure the server is running
```bash
curl -sf --max-time 2 http://127.0.0.1:8778/health > /dev/null 2>&1 || bash /home/adom/project/mosfet-visualizer/start-mosfet-visualizer.sh
```
### 2. Open the visualizer
Open a Web View tab pointing to `/proxy/8778/viz` using the workspace API:
```bash
adom-cli hydrogen workspace add-tab \
--panel-id "<PANE_ID>" \
--panel-type "adom/a1b2c3d4-0031-4000-a000-000000000031" \
--display-name "MOSFET IV Visualizer" \
--display-icon "mdi:chart-line" \
--initial-state '{"url":"<PROXY_BASE>/proxy/8778/viz"}'
```
Replace `<PANE_ID>` with a leaf pane ID from `adom-cli hydrogen workspace get` and `<PROXY_BASE>` from `$VSCODE_PROXY_URI`.
### 3. Load data
**Sample data:**
```bash
curl -s -X POST http://127.0.0.1:8778/ \
-H 'Content-Type: application/json' \
-d '{"action":"sample"}'
```
**CSV from curve tracer:**
```bash
CSV=$(cat /path/to/sweeps.csv)
curl -s -X POST http://127.0.0.1:8778/ \
-H 'Content-Type: application/json' \
-d "{\"action\":\"plot_csv\",\"device\":{\"id\":\"DUT1\",\"name\":\"My MOSFET\"},\"csv\":$(python3 -c \"import json,sys; print(json.dumps(sys.stdin.read()))\" <<< \"$CSV\"),\"filename\":\"sweeps.csv\"}"
```
**JSON sweeps:**
```json
{
"action": "plot",
"device": { "id": "IRF540N-s1", "name": "IRF540N", "type": "NMOS" },
"sweeps": [
{ "vgs": 4.0, "data": [{ "vds": 0, "id": 0 }, { "vds": 1, "id": 0.25 }, { "vds": 5, "id": 0.5 }] },
{ "vgs": 6.0, "data": [{ "vds": 0, "id": 0 }, { "vds": 1, "id": 1.8 }, { "vds": 5, "id": 4.5 }] }
]
}
```
## API Actions (POST / with JSON body)
| Action | Description |
|--------|-------------|
| `plot` | Add device with JSON sweeps |
| `plot_csv` | Add device from curve tracer CSV |
| `overlay` | Add multiple devices at once |
| `sample` | Load built-in demo data |
| `clear` | Clear all data |
| `remove` | Remove device by id |
| `toggle_device` | Toggle device visibility (eyeball) |
| `toggle_sweep` | Toggle individual sweep visibility |
| `compute_saturation` | Compute and show saturation boundary line |
| `clear_saturation` | Hide saturation boundary |
| `set_config` | Change settings (e.g., `{"scale":"log"}`) |
| `analyze` | Extract Vth, Rds(on) from data |
All actions update the frontend in real-time via WebSocket — no page refresh needed.
## CSV Format
The CSV must have column triplets per sweep: `VN (V), IN (A), RN (Ohm)` where N is 1-indexed:
```
V1 (V),I1 (A),R1 (Ohm),V2 (V),I2 (A),R2 (Ohm),...
38.32,0.0009,...
```
Optionally pass `vgs_values: [0, 1, 2, ...]` to label sweeps with their Vgs voltages.
## Real-Time Control
The server has a WebSocket at `ws://127.0.0.1:8778/ws`. Claude can control the visualizer live during demos:
```bash
# Toggle a device's visibility
curl -s -X POST http://127.0.0.1:8778/ -H 'Content-Type: application/json' \
-d '{"action":"toggle_device","id":"DUT1"}'
# Compute saturation boundary
curl -s -X POST http://127.0.0.1:8778/ -H 'Content-Type: application/json' \
-d '{"action":"compute_saturation"}'
# Switch to log scale
curl -s -X POST http://127.0.0.1:8778/ -H 'Content-Type: application/json' \
-d '{"action":"set_config","scale":"log"}'
```
## Shot Log
Monitor API activity: `curl http://127.0.0.1:8778/shotlog?tail=10`
## Example AI Prompts
Users can ask Claude:
- "Plot my MOSFET IV curves from this CSV file"
- "Show me the MOSFET visualizer with sample data"
- "Overlay my BSS138 data on top of the IRF540N"
- "Compute the saturation boundary curve"
- "What's the threshold voltage of this MOSFET?"
- "Switch to log scale to see subthreshold behavior"
- "Export the IV data as CSV"
- "Toggle off sweep 3 so I can focus on the others"
- "Compare these two MOSFETs side by side"
## Keyboard Shortcuts (in the visualizer)
| Key | Action |
|-----|--------|
| L | Toggle linear/log scale |
| K | Compute/clear saturation curve |
| S | Load sample data |
| R | Reset zoom |
| Esc | Clear readout |
No sub-skills yet. Be the first to contribute one!