← Commit history

Initial commit: app/hardware-calculator

Caleb ·c4ca0c78b5 ·
2 files changed +171
README.mdadded+65
@@ -0,0 +1,65 @@+# Hardware Calculator++**40 hardware design calculators whose every number traces to a standard, with a live schematic of the circuit you are sizing.**++Trace width to IPC-2152, clearance to IPC-2221C, impedance to IPC-2141, crystal load caps and oscillator start-up margin to+ST AN2867, I²C pull-ups to NXP UM10204. Each result shows the formula it used and the document, revision and section it+came from, and 26 calculators draw the circuit or PCB cross-section labelled with your values as you type.++![Crystal oscillator load capacitors with the Pierce schematic](docs/crystal-oscillator.png)++![Buck converter sizing with its live schematic](docs/buck-converter.png)++## Install++```bash+adom-wiki pkg install adom/hardware-calculator+hwcalc --ai-thread "<name>" start        # opens the calculator in a Hydrogen tab+```++## Say it to your AI++- "with the hardware calculator, what trace width for 3 A at 20 °C rise on 2 oz?"+- "size the load caps for a 12 pF crystal and check the gain margin with 25 mA/V gm"+- "hardware calculator: clearance for 300 V on an external coated layer"+- "open the hardware calculator on a buck from 12 V to 3.3 V at 2 A, 500 kHz"++Or from the terminal, no server needed: `hwcalc calc trace I=3 dT=20 oz=2`, `hwcalc calc crystal CL=12p Cs=4p --svg osc.svg`.++## Calculators++✎ = draws the circuit or cross-section.++- **Basics** — Ohm's law & power · Voltage divider ✎ · LED series resistor ✎+- **Signal** — RC / RL / LC time constants & cut-off ✎ · Rise time, bandwidth & critical length · Skin depth · Reactance & RLC resonance ✎ · Op-amp gain & bandwidth ✎ · 555 timer ✎+- **PCB** — Trace width for current (IPC-2152 / IPC-2221) ✎ · Microstrip / stripline impedance (IPC-2141) ✎ · Conductor spacing for voltage (IPC-2221 Table 6-1) ✎ · Differential pair impedance (edge-coupled) ✎ · Via: resistance, current, parasitics ✎ · Fusing current (Onderdonk)+- **Power** — Linear regulator dissipation ✎ · Buck converter: inductor & ripple ✎ · Boost converter: inductor & ripple ✎ · Hold-up / bulk capacitor ✎ · Battery life (duty-cycled load) · Adjustable regulator feedback resistors ✎ · MOSFET conduction & switching loss ✎ · PDN target impedance+- **Interfaces** — I²C pull-up resistor range ✎ · Crystal oscillator load capacitors (CL) ✎ · Frequency tolerance (ppm)+- **Measurement** — Current-sense shunt ✎ · ADC resolution & ideal SNR · NTC thermistor (β model) ✎+- **Thermal** — Junction temperature & heatsink ✎+- **Wiring** — Wire gauge: resistance & drop+- **RF** — dBm · watts · volts · Wavelength & antenna lengths · Resistive attenuator (Pi / Tee) ✎ · VSWR · return loss · mismatch loss · Planar spiral inductor ✎+- **Components** — Standard values & resistor codes · Series / parallel combinations ✎ · Two-resistor combination finder ✎ · Length & copper unit converter++## Why you can trust it++- **Standards checked for currency** (2026-09-25): IPC-2221 is Rev C (Dec 2023), IPC-2152 is still Rev 0 (2009), and so on.+  The register with every source, its revision and the date checked is in [SOURCES.md](SOURCES.md).+- **No undisclosed fits.** Where a standard is chart-only (IPC-2152) the published curve fit is named; where a table is+  paywalled (IPC-2221 Table 6-1) the values were cross-checked against two independent reproductions.+- **Tested against the sources' own worked examples**, for example AN2867's 8 MHz crystal: gm_crit 0.23 mA/V and gain margin 107.+  140 automated checks run on every change.+- **Honest limits.** Closed-form impedance says ±5–10 % and to confirm with your fab's field solver; unmodelled effects are+  stated under each result.++## Contributing++Anyone in the adom org can publish. Every change follows the `hwcalc-calculator-standards` skill (Dev skills tab): source+fetched and revision confirmed, a test reproducing the source's worked example, a labelled drawing for any circuit, and the+sources register updated. Releases follow `hwcalc-release` (Publish skills tab).++## Interfaces++One formula module (`calcs.js`) drives the Hydrogen UI, the CLI and an HTTP API: `POST /api/calc {calc, inputs}`,+`GET /api/schematic?calc=<id>&…` (SVG), `POST /api/open {aiThread, calc, inputs}` to put a calculation in front of the user.+Zero dependencies beyond Node.js 18+. MIT licensed.
page.jsonadded+106
@@ -0,0 +1,106 @@+{+  "slug": "hardware-calculator",+  "title": "Hardware Calculator",+  "name": "hardware-calculator",+  "version": "0.3.0",+  "type": "app",+  "description": "40 hardware design calculators whose every number traces to a standard (IPC-2152/2221C/2141, ST AN2867, NXP UM10204, IEC 60063), with live labelled schematics and PCB cross-sections. Hydrogen UI, CLI and HTTP API.",+  "dependencies": {},+  "bin": {+    "hwcalc": "bin/hwcalc"+  },+  "tags": [+    "calculator",+    "pcb",+    "ipc-2152",+    "ipc-2221",+    "impedance",+    "crystal",+    "oscillator",+    "power",+    "rf",+    "electronics",+    "schematic",+    "mit"+  ],+  "license": "MIT",+  "needs_sudo": false,+  "scripts": {+    "install": "./install.sh",+    "uninstall": "./uninstall.sh",+    "test": "node test.js",+    "start": "node server.js --port auto"+  },+  "files": [+    "bin/**",+    "public/**",+    "skills/**",+    "calcs.js",+    "schematics.js",+    "server.js",+    "test.js",+    "install.sh",+    "uninstall.sh",+    "package.json",+    "README.md",+    "SOURCES.md",+    "CHANGELOG.md",+    "docs/hero.png"+  ],+  "changelog": "0.3.0: AN2867-verified crystal oscillator CL calculator; live schematics for 26 calculators; sources register",+  "discovery_triggers": [+    "hardware calculator",+    "hwcalc",+    "trace width",+    "trace current",+    "IPC-2152",+    "IPC-2221",+    "clearance for voltage",+    "creepage clearance PCB",+    "microstrip impedance",+    "stripline impedance",+    "differential pair impedance",+    "via current",+    "crystal load capacitors",+    "oscillator capacitors",+    "gain margin crystal",+    "voltage divider",+    "LED resistor",+    "I2C pull-up",+    "buck inductor",+    "boost inductor",+    "LM317 resistors",+    "attenuator",+    "VSWR",+    "junction temperature",+    "E-series value"+  ],+  "discovery_pitch": "40 standards-verified hardware calculators (IPC trace width, spacing, impedance, crystal CL, power, RF) with live labelled schematics. Say 'with the hardware calculator' to your AI.",+  "sample_prompts": [+    {+      "label": "trace width for 3 A",+      "prompt": "with the hardware calculator, what trace width for 3 A at 20 °C rise on 2 oz copper?"+    },+    {+      "label": "crystal load caps + gain margin",+      "prompt": "size the load caps for a 12 pF crystal and check the gain margin with 25 mA/V gm"+    },+    {+      "label": "clearance for 300 V",+      "prompt": "hardware calculator: PCB clearance for 300 V on an external coated layer"+    },+    {+      "label": "buck 12 V → 3.3 V",+      "prompt": "open the hardware calculator on a buck from 12 V to 3.3 V at 2 A, 500 kHz"+    }+  ],+  "hero": {+    "type": "image",+    "path": "docs/hero.png"+  },+  "org": "adom",+  "author": {+    "name": "Caleb",+    "email": "[email protected]"+  }+}\ No newline at end of file