Download

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). Also use when installing the MOSFET visualizer. 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", "install mosfet visualizer".

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.

Source: https://github.com/adom-inc/mosfet-visualizer Port: 8778

Installation

Run this block to install or update. It's idempotent — safe to run multiple times.

INSTALL_DIR="/home/adom/mosfet-visualizer"

if [ -d "$INSTALL_DIR/.git" ]; then
  echo "[mosfet-visualizer] Updating..."
  cd "$INSTALL_DIR" && git pull origin main 2>&1
else
  echo "[mosfet-visualizer] Installing..."
  git clone https://github.com/adom-inc/mosfet-visualizer.git "$INSTALL_DIR" 2>&1
fi

cd "$INSTALL_DIR" && npm install --production 2>&1 | tail -3

# Start the server (idempotent)
bash "$INSTALL_DIR/start-mosfet-visualizer.sh"

Verify Installation

curl -sf http://127.0.0.1:8778/health && echo " OK" || echo " NOT RUNNING"

Open the Visualizer

Open a Web View tab pointing to /proxy/8778/viz:

# Get a leaf pane ID
PANE_ID=$(adom-cli hydrogen workspace get 2>/dev/null | python3 -c "
import json,sys
layout = json.load(sys.stdin)
def find_leaf(node):
    if node.get('type') == 'leaf': return node['id']
    if node.get('type') == 'split': return find_leaf(node.get('second', node.get('first', {})))
    return None
print(find_leaf(layout['root']))
")

PROXY_BASE=$(echo "$VSCODE_PROXY_URI" | sed 's|{{port}}.*||')

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}8778/viz\"}"

Load Data

Sample data:

curl -s -X POST http://127.0.0.1:8778/ \
  -H 'Content-Type: application/json' \
  -d '{"action":"sample"}'

CSV from curve tracer:

CSV=$(cat /path/to/sweeps.csv)
python3 -c "
import json, sys
csv = sys.stdin.read()
print(json.dumps({'action':'plot_csv','device':{'id':'DUT1','name':'My MOSFET'},'csv':csv,'filename':'sweeps.csv'}))
" <<< "$CSV" | curl -s -X POST http://127.0.0.1:8778/ -H 'Content-Type: application/json' -d @-

JSON sweeps:

{
  "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 }] }
  ]
}

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

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:

# 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

  • "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"
  • "Install the MOSFET IV visualizer"

Keyboard Shortcuts

Key Action
L Toggle linear/log scale
K Compute/clear saturation curve
S Load sample data
R Reset zoom
Esc Clear readout

Updating

cd /home/adom/mosfet-visualizer && git pull origin main && npm install --production
# Restart: kill old process, start new
pkill -f 'node.*mosfet-visualizer.*server.js' 2>/dev/null; bash start-mosfet-visualizer.sh