physbox-mcp 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- physbox_mcp/__init__.py +1 -0
- physbox_mcp/mcp-docs/chemistry.json +271 -0
- physbox_mcp/mcp-docs/circuit.json +234 -0
- physbox_mcp/mcp-docs/physics.json +391 -0
- physbox_mcp/mcp-docs/process.json +406 -0
- physbox_mcp/server.py +575 -0
- physbox_mcp-2.0.0.dist-info/METADATA +113 -0
- physbox_mcp-2.0.0.dist-info/RECORD +11 -0
- physbox_mcp-2.0.0.dist-info/WHEEL +5 -0
- physbox_mcp-2.0.0.dist-info/entry_points.txt +2 -0
- physbox_mcp-2.0.0.dist-info/top_level.txt +1 -0
physbox_mcp/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "2.0.0"
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
{
|
|
2
|
+
"overview": "Chemistry Sim is a browser-based interactive chemistry laboratory and reaction simulator. It uses a custom multi-iteration equilibrium solver (30 iterations per tick), kinetic tickers, and phase boundary models to simulate aqueous solutions, precipitates, indicators, liquid-liquid extraction, vacuum/distillation, electrolysis, and organic reactions. Canvas elements are built using React Flow, where apparatuses are nodes and tubing/pouring channels are edges.",
|
|
3
|
+
"workflow": [
|
|
4
|
+
"1. Use chemistry_get_schema to find the list of supported apparatuses, reagents, indicators, and solvents.",
|
|
5
|
+
"2. Use chemistry_get_state to check the current canvas: nodes (vessels/devices) and edges (pouring links or tubing).",
|
|
6
|
+
"3. Set up the lab apparatus on the canvas using chemistry_set_nodes and chemistry_set_edges.",
|
|
7
|
+
"4. Dispense starting chemicals/reagents into specific vessels using chemistry_dispense_reagent.",
|
|
8
|
+
"5. Set properties such as heating mantle temperature or vacuum pump status using chemistry_set_node_properties.",
|
|
9
|
+
"6. Pour between vessels by invoking chemistry_pour_vessel.",
|
|
10
|
+
"7. Simulate ticks headlessly using chemistry_run_headless to verify chemical changes, temperature spikes, pH indicator transitions, and distillates, then call chemistry_start to run in the live UI."
|
|
11
|
+
],
|
|
12
|
+
"gotchas": [
|
|
13
|
+
"REACTION THERMODYNAMICS: Saponification (soap making) and Fischer esterification require a temperature above 60°C to run. Sulfuric acid catalyst is required for esterification, and strongly basic NaOH/KOH is required for saponification. Verify the heating mantle is connected via a 'heat' edge and set to a high temperature.",
|
|
14
|
+
"VACUUM BOILING: Engaging the vacuum line (connected via a 'vacuum' edge or checkbox) reduces pressure to 0.2 atm, dropping boiling points by ~120°C. For example, DMSO (bp 189°C) will boil and distill at 75°C.",
|
|
15
|
+
"OSCILLATORS: Briggs-Rauscher and Iodine Clock reactions require specific starting concentrations. The BR reaction will slowly damp out and eventually quench. If pH rises above 3.5, the BR reaction is instantly quenched.",
|
|
16
|
+
"PRECIPITATE CONSERVATION: When filtering using a Buchner Funnel, the liquid filtrate drains through the 'drain' edge into the receiver flask, leaving any solid precipitates (like soap cake or BaSO4) trapped inside the funnel as a cake.",
|
|
17
|
+
"HABER-BOSCH: Requires iron catalyst (fe_catalyst), temperature > 200°C (via heating mantle), N2 and H2 gases. Equilibrium position follows real thermodynamics — higher temperature favours reverse reaction (Le Chatelier). Optimal industrial temperature ~450°C balances rate vs yield.",
|
|
18
|
+
"ELECTROLYSIS: Connect an electrolysis node with current_A property. Cu anode is sacrificial (replenishes Cu2+). Inert Pt/C anode: Cl2 gas if [Cl-] > 0.5 M (chlor-alkali), else O2 from water oxidation. Cathode: Cu2+ > Ag+ deposited preferentially before H2 evolution.",
|
|
19
|
+
"AMPHOTERIC METALS: Zn, Al, Cr(OH)3 dissolve in excess NaOH to form zincate/aluminate/chromite. Zn(OH)2 and Ni(OH)2 also dissolve in excess NH3.",
|
|
20
|
+
"METAL REACTIVITY: Na/K react violently with water. Ca reacts steadily. Mg reacts in acid. Zn and Al are amphoteric. Cu dissolves only in oxidising acid (HNO3). Fe dissolves slowly in dilute acid.",
|
|
21
|
+
"DANGEROUS MIXTURES SIMULATED: Bleach + ammonia → chloramine gas. Bleach + acid → chlorine gas. Sulfide + acid → H2S gas. Sulfite + acid → SO2 gas. Cyanide + acid → HCN (do not acidify KCN)."
|
|
22
|
+
],
|
|
23
|
+
"coordinateSystem": {
|
|
24
|
+
"canvasGrid": "React Flow canvas X increases to the right, Y increases downwards.",
|
|
25
|
+
"spacing": "Ensure vessels are spaced 150-300 units apart to leave room for visual connections without layout overlapping."
|
|
26
|
+
},
|
|
27
|
+
"reactionCapabilities": {
|
|
28
|
+
"acidBase": "Full strong/weak acid-base equilibria. Strong acids: HCl, H2SO4, HNO3, HF. Weak acids: CH3COOH (Ka=1.76e-5), H3PO4, H2C2O4 (Ka1=5.9e-2). Indicators: phenolphthalein (pKa 9.4), methyl orange (pKa 3.7), bromothymol blue (pKa 7.1). pH tracked to 0-14.",
|
|
29
|
+
"precipitation": "55+ ion pairs with real Ksp values. Includes silver salts (AgCl, AgBr, AgI, Ag2CO3, Ag2SO4, Ag3PO4, Ag2CrO4, Ag2S), barium salts (BaSO4, BaCO3, BaCrO4), calcium salts (CaCO3, CaSO4, CaF2, Ca3(PO4)2), lead salts (PbI2, PbSO4, PbCO3, PbS, PbCl2, PbCrO4), transition metal hydroxides and sulfides for Cu, Zn, Fe(II/III), Ni, Co, Mn, Cd, Mg, Al, Cr, Bi, Hg. Prussian Blue (Fe4[Fe(CN)6]3) from Fe3+/ferrocyanide.",
|
|
30
|
+
"complexation": "Cu2+ + 4NH3 → [Cu(NH3)4]2+ (deep blue, Kf~1e12). Fe3+ + SCN- → Fe(SCN)2+ (blood red, Kf=138). Fe2+/Fe3+ + 6CN- → ferrocyanide/ferricyanide. Ni2+ + dimethylglyoxime → scarlet NiDMG precipitate at pH 4-10. Cu2+ + 4I- → CuI + I2 (iodometric).",
|
|
31
|
+
"redox": "KMnO4 reduced to Mn2+ in acid or MnO2 in neutral/base. K2Cr2O7 reduced by Fe2+ in acid (Cr3+ product). H2O2 reduces MnO4- in acid. Oxalate reduces MnO4- (permanganometry standard).",
|
|
32
|
+
"chromateEquilibrium": "2CrO4(2-) + 2H+ ⇌ Cr2O7(2-) + H2O K=1e14. Automatically shifts with pH — acidic: orange Cr2O7, basic: yellow CrO4.",
|
|
33
|
+
"organic": "Fischer esterification (CH3COOH + EtOH ⇌ EtOAc, needs H+ catalyst and T>60C). Saponification (fat/EtOAc + OH-, T-dependent rate). Bromination of cyclohexene (Br2 decolorisation). Fermentation (glucose + yeast → EtOH + CO2). Benedict's test (Cu2O from reducing sugars at T>60C). Tollens' silver mirror (Ag+ + aldehyde + NH3). Iodine-starch complexation.",
|
|
34
|
+
"haberBosch": "N2 + 3H2 ⇌ 2NH3. Real thermodynamics: dG = -92400 + 198*T(K) J/mol. Kc computed from dG. Arrhenius kinetics. Requires iron catalyst and T>200C. Equilibrium shifts with temperature per Le Chatelier.",
|
|
35
|
+
"electrolysis": "Faraday's law (n_e = I*t/F). Cathode: Cu2+ > Ag+ deposited before H2 evolution. Inert anode: Cl2 (chlor-alkali, [Cl-]>0.5M) else O2 from water. Cu anode: sacrificial dissolution. Tracks deposited Cu(dep), Ag, H2(g), O2(g), Cl2(g).",
|
|
36
|
+
"distillation": "Boiling points adjusted for pressure via Clausius-Clapeyron. Volatile species (EtOH 78C, MeOH 65C, acetone 56C, DCM 40C, Et2O 35C, THF 66C, CHCl3 61C, EtOAc 77C, hexane 69C, toluene 111C, DMSO 189C). Fractional distillation of crude oil fractions (petrol/kerosene/diesel/bitumen).",
|
|
37
|
+
"liquidLiquidExtraction": "Partition by log Kd: hexane 3.9, toluene 2.73, CHCl3 1.97, EtOAc 0.73, Et2O 0.89, DCM 1.25. Hydrophilic species (Na+, Cl-, Cu2+, Fe(SCN)2+) stay aqueous. I2 prefers organic.",
|
|
38
|
+
"gasEvolution": "CO2 (carbonates + acid, fermentation), H2 (metals + acid, electrolysis), Cl2 (bleach + acid, electrolysis), ClNH2 (bleach + ammonia), SO2 (sulfite + acid), H2S (sulfide + acid), NO (nitrite + acid). Gas rate displayed visually as bubbles."
|
|
39
|
+
},
|
|
40
|
+
"tools": {
|
|
41
|
+
"chemistry_get_state": "Return current Chemistry simulator state: nodes, edges, isRunning, activePreset.",
|
|
42
|
+
"chemistry_start": "Start simulation ticks in the browser view.",
|
|
43
|
+
"chemistry_stop": "Stop/pause simulation ticks in the browser view.",
|
|
44
|
+
"chemistry_reset": "Reset simulator to initial preset flow state.",
|
|
45
|
+
"chemistry_clear": "Clear all nodes and edges from the canvas.",
|
|
46
|
+
"chemistry_list_presets": "List built-in chemistry lab presets, including instructions, recommended actions, node IDs, and edge IDs.",
|
|
47
|
+
"chemistry_load_preset": "Load a named lab preset.",
|
|
48
|
+
"chemistry_set_nodes": "Replace all nodes/apparatuses in the canvas.",
|
|
49
|
+
"chemistry_set_edges": "Replace all edges/wires in the canvas.",
|
|
50
|
+
"chemistry_dispense_reagent": "Dispense a specific reagent of given volume (mL) into a vessel node.",
|
|
51
|
+
"chemistry_pour_vessel": "Pour the entire contents (liquid and solid precipitates) of a source vessel into a target vessel.",
|
|
52
|
+
"chemistry_set_node_properties": "Update apparatus properties such as temperature, vacuumOn, stirring, or note card markdown content.",
|
|
53
|
+
"chemistry_run_headless": "Simulate the chemistry reaction ticks headlessly for N ticks. Returns the final nodes and full tick-by-tick trajectory. 10-20 ticks ≈ 1 second of real-world reaction time.",
|
|
54
|
+
"chemistry_run_headless_final": "Simulate the chemistry reaction ticks headlessly for N ticks. Returns ONLY the final node states (no trajectory), ensuring a very small response payload.",
|
|
55
|
+
"chemistry_get_schema": "Return the list of chemicals, indicator pKas, apparatus types, partition coefficients, and boiling points."
|
|
56
|
+
},
|
|
57
|
+
"schema": {
|
|
58
|
+
"nodeTypes": [
|
|
59
|
+
"beaker",
|
|
60
|
+
"flask_round",
|
|
61
|
+
"flask_erlenmeyer",
|
|
62
|
+
"sep_funnel",
|
|
63
|
+
"distillation_flask",
|
|
64
|
+
"condenser",
|
|
65
|
+
"rotovap",
|
|
66
|
+
"buchner_funnel",
|
|
67
|
+
"vacuum_line",
|
|
68
|
+
"addition_funnel",
|
|
69
|
+
"heating_mantle",
|
|
70
|
+
"drain",
|
|
71
|
+
"card"
|
|
72
|
+
],
|
|
73
|
+
"nodeFields": {
|
|
74
|
+
"id": "string — unique node identifier",
|
|
75
|
+
"type": "string — always 'apparatus' or 'card'",
|
|
76
|
+
"data": {
|
|
77
|
+
"type": "string — apparatus type (e.g. 'beaker', 'flask_round', 'heating_mantle')",
|
|
78
|
+
"label": "string — display label",
|
|
79
|
+
"temperature": "number — local temperature in °C",
|
|
80
|
+
"vacuumOn": "boolean — true if vacuum pump connected and active",
|
|
81
|
+
"stirring": "boolean — true if magnetic stirrer active",
|
|
82
|
+
"refluxOn": "boolean — true if reflux condenser connected above vessel",
|
|
83
|
+
"markdown": "string — note card content (markdown)",
|
|
84
|
+
"state": {
|
|
85
|
+
"volume": "number — current volume in mL",
|
|
86
|
+
"species": "Record<string, number> — solute concentration in mol/L (M)",
|
|
87
|
+
"precipitates": "Record<string, number> — moles of solid precipitates inside vessel",
|
|
88
|
+
"pH": "number — solution pH (0-14)",
|
|
89
|
+
"temperature": "number — solution temperature in °C",
|
|
90
|
+
"pressure": "number — internal pressure in atm",
|
|
91
|
+
"oscillatorActive": "boolean — true if oscillating clock reaction is active",
|
|
92
|
+
"oscillatorPhase": "number — internal oscillation counter"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"reagents": [
|
|
97
|
+
{ "id": "hcl", "name": "Hydrochloric Acid", "formula": "HCl (aq) 1 M", "category": "acid" },
|
|
98
|
+
{ "id": "h2so4", "name": "Sulfuric Acid (conc.)", "formula": "H2SO4 18 M", "category": "acid", "warning": "violent heat on dilution" },
|
|
99
|
+
{ "id": "hno3", "name": "Nitric Acid (conc.)", "formula": "HNO3 16 M", "category": "acid", "warning": "oxidising acid" },
|
|
100
|
+
{ "id": "h2o2", "name": "Hydrogen Peroxide (30%)", "formula": "H2O2 9.8 M", "category": "oxidiser" },
|
|
101
|
+
{ "id": "h3po4", "name": "Phosphoric Acid", "formula": "H3PO4 85%", "category": "acid" },
|
|
102
|
+
{ "id": "acetic", "name": "Acetic Acid (glacial)", "formula": "CH3COOH 17 M", "category": "acid", "boilingPoint": 118 },
|
|
103
|
+
{ "id": "hf", "name": "Hydrofluoric Acid", "formula": "HF (aq)", "category": "acid", "warning": "severe tissue hazard" },
|
|
104
|
+
{ "id": "naoh", "name": "Sodium Hydroxide", "formula": "NaOH (aq) 1 M", "category": "base" },
|
|
105
|
+
{ "id": "koh", "name": "Potassium Hydroxide", "formula": "KOH (aq) 1 M", "category": "base" },
|
|
106
|
+
{ "id": "nh3", "name": "Ammonia (conc.)", "formula": "NH3 (aq) 14 M", "category": "base", "warning": "pungent vapour" },
|
|
107
|
+
{ "id": "conc_nh3", "name": "Ammonia (saturated 28%)", "formula": "NH3 (aq) 14 M", "category": "base" },
|
|
108
|
+
{ "id": "ca_oh2", "name": "Calcium Hydroxide (slaked lime)", "formula": "Ca(OH)2 sat. 22 mM", "category": "base" },
|
|
109
|
+
{ "id": "na2co3", "name": "Sodium Carbonate", "formula": "Na2CO3 0.1 M", "category": "base" },
|
|
110
|
+
{ "id": "nahco3", "name": "Sodium Bicarbonate", "formula": "NaHCO3 1 M", "category": "base" },
|
|
111
|
+
{ "id": "nacl", "name": "Sodium Chloride (brine)", "formula": "NaCl 1 M", "category": "salt" },
|
|
112
|
+
{ "id": "agno3", "name": "Silver Nitrate", "formula": "AgNO3 0.1 M", "category": "salt", "warning": "stains skin black" },
|
|
113
|
+
{ "id": "ki", "name": "Potassium Iodide", "formula": "KI 0.1 M", "category": "salt" },
|
|
114
|
+
{ "id": "pb_no3", "name": "Lead Nitrate", "formula": "Pb(NO3)2 0.025 M", "category": "salt", "warning": "toxic — lead compound" },
|
|
115
|
+
{ "id": "lead_nitrate", "name": "Lead Nitrate (0.5 M)", "formula": "Pb(NO3)2 0.5 M", "category": "salt", "warning": "toxic — lead compound" },
|
|
116
|
+
{ "id": "bacl2", "name": "Barium Chloride", "formula": "BaCl2 0.1 M", "category": "salt", "warning": "toxic — soluble barium" },
|
|
117
|
+
{ "id": "na2so4", "name": "Sodium Sulfate", "formula": "Na2SO4 0.1 M", "category": "salt" },
|
|
118
|
+
{ "id": "fecl3", "name": "Iron(III) Chloride (5 mM)", "formula": "FeCl3 5 mM", "category": "salt" },
|
|
119
|
+
{ "id": "iron3_chloride", "name": "Iron(III) Chloride (0.5 M)", "formula": "FeCl3 0.5 M", "category": "salt" },
|
|
120
|
+
{ "id": "iron3_nitrate", "name": "Iron(III) Nitrate", "formula": "Fe(NO3)3 0.5 M", "category": "salt" },
|
|
121
|
+
{ "id": "iron2_sulfate", "name": "Iron(II) Sulfate", "formula": "FeSO4 0.5 M", "category": "salt", "warning": "oxidises to Fe3+ in air" },
|
|
122
|
+
{ "id": "cuso4", "name": "Copper(II) Sulfate", "formula": "CuSO4 0.1 M", "category": "salt" },
|
|
123
|
+
{ "id": "copper_nitrate", "name": "Copper(II) Nitrate", "formula": "Cu(NO3)2 0.5 M", "category": "salt" },
|
|
124
|
+
{ "id": "copper_sulfate_50", "name": "CuSO4 Electroplating Bath", "formula": "CuSO4 50 mM", "category": "electrolyte" },
|
|
125
|
+
{ "id": "nh4scn", "name": "Ammonium Thiocyanate", "formula": "NH4SCN 25 mM", "category": "salt" },
|
|
126
|
+
{ "id": "kmno4", "name": "Potassium Permanganate", "formula": "KMnO4 20 mM", "category": "oxidiser", "warning": "strong oxidiser" },
|
|
127
|
+
{ "id": "k2cr2o7", "name": "Potassium Dichromate", "formula": "K2Cr2O7", "category": "oxidiser", "warning": "Cr(VI) carcinogen" },
|
|
128
|
+
{ "id": "k2cro4", "name": "Potassium Chromate", "formula": "K2CrO4 0.02 M", "category": "salt", "warning": "Cr(VI) carcinogen" },
|
|
129
|
+
{ "id": "potassium_chromate", "name": "Potassium Chromate (0.5 M)", "formula": "K2CrO4 0.5 M", "category": "salt" },
|
|
130
|
+
{ "id": "na2s2o3", "name": "Sodium Thiosulfate", "formula": "Na2S2O3 0.1 M", "category": "reducing agent" },
|
|
131
|
+
{ "id": "i2", "name": "Iodine Solution", "formula": "I2/KI (aq) 10 mM", "category": "reagent" },
|
|
132
|
+
{ "id": "caso4", "name": "Calcium Sulfate (Drierite)", "formula": "CaSO4 anhydrous", "category": "drying agent" },
|
|
133
|
+
{ "id": "mgso4", "name": "Magnesium Sulfate (anhydrous)", "formula": "MgSO4 anhydrous", "category": "drying agent" },
|
|
134
|
+
{ "id": "phenol", "name": "Phenolphthalein", "formula": "C20H14O4 indicator", "category": "indicator", "pKa": 9.4, "colourChange": "colourless → pink at pH 8.2-10" },
|
|
135
|
+
{ "id": "methyl_o", "name": "Methyl Orange", "formula": "indicator", "category": "indicator", "pKa": 3.7, "colourChange": "red → yellow at pH 3.1-4.4" },
|
|
136
|
+
{ "id": "btb", "name": "Bromothymol Blue", "formula": "indicator", "category": "indicator", "pKa": 7.1, "colourChange": "yellow → blue at pH 6-7.6" },
|
|
137
|
+
{ "id": "starch_solution", "name": "Starch Solution", "formula": "starch 0.5%", "category": "indicator", "note": "turns deep blue-black with I3-" },
|
|
138
|
+
{ "id": "ethanol", "name": "Ethanol (95%)", "formula": "EtOH 16 M", "category": "solvent", "boilingPoint": 78.4, "density": 0.789, "flammable": true },
|
|
139
|
+
{ "id": "methanol", "name": "Methanol", "formula": "MeOH 24.7 M", "category": "solvent", "boilingPoint": 64.7, "density": 0.791, "warning": "toxic — blindness/death" },
|
|
140
|
+
{ "id": "acetone", "name": "Acetone", "formula": "(CH3)2CO 13.5 M", "category": "solvent", "boilingPoint": 56.1, "density": 0.791, "flammable": true },
|
|
141
|
+
{ "id": "dcm", "name": "Dichloromethane (DCM)", "formula": "CH2Cl2 13.1 M", "category": "solvent", "boilingPoint": 40, "density": 1.325 },
|
|
142
|
+
{ "id": "ethyl_acetate", "name": "Ethyl Acetate", "formula": "EtOAc 11.4 M", "category": "solvent", "boilingPoint": 77.1, "density": 0.902, "flammable": true },
|
|
143
|
+
{ "id": "hexane", "name": "Hexane", "formula": "n-C6H14 7.7 M", "category": "solvent", "boilingPoint": 69, "density": 0.659, "flammable": true },
|
|
144
|
+
{ "id": "toluene", "name": "Toluene", "formula": "PhCH3 9.4 M", "category": "solvent", "boilingPoint": 111, "density": 0.867, "flammable": true },
|
|
145
|
+
{ "id": "diethyl_ether", "name": "Diethyl Ether", "formula": "Et2O 6.9 M", "category": "solvent", "boilingPoint": 34.6, "density": 0.713, "warning": "extreme fire hazard — forms peroxides" },
|
|
146
|
+
{ "id": "chloroform", "name": "Chloroform", "formula": "CHCl3 12.5 M", "category": "solvent", "boilingPoint": 61.2, "density": 1.483 },
|
|
147
|
+
{ "id": "dmso", "name": "DMSO", "formula": "(CH3)2SO 14.1 M", "category": "solvent", "boilingPoint": 189, "warning": "skin penetration enhancer" },
|
|
148
|
+
{ "id": "thf", "name": "THF", "formula": "C4H8O 12.3 M", "category": "solvent", "boilingPoint": 66, "flammable": true, "warning": "forms explosive peroxides" },
|
|
149
|
+
{ "id": "water", "name": "Distilled Water", "formula": "H2O", "category": "solvent", "boilingPoint": 100, "density": 1.0 },
|
|
150
|
+
{ "id": "na_metal", "name": "Sodium Metal", "formula": "Na (s)", "category": "reactive metal", "warning": "violent reaction with water" },
|
|
151
|
+
{ "id": "k_metal", "name": "Potassium Metal", "formula": "K (s)", "category": "reactive metal", "warning": "extremely violent reaction with water, may self-ignite" },
|
|
152
|
+
{ "id": "mg_metal", "name": "Magnesium Ribbon", "formula": "Mg (s)", "category": "reactive metal", "warning": "burns with blinding white light" },
|
|
153
|
+
{ "id": "zn_metal", "name": "Zinc (granulated)", "formula": "Zn (s)", "category": "reactive metal" },
|
|
154
|
+
{ "id": "al_metal", "name": "Aluminium (foil/powder)", "formula": "Al (s)", "category": "reactive metal", "note": "amphoteric — dissolves in acid AND strong base" },
|
|
155
|
+
{ "id": "ca_metal", "name": "Calcium Metal", "formula": "Ca (s)", "category": "reactive metal" },
|
|
156
|
+
{ "id": "cu_metal", "name": "Copper (turnings)", "formula": "Cu (s)", "category": "reactive metal", "note": "unreactive in dilute acid; dissolves in HNO3" },
|
|
157
|
+
{ "id": "fe_metal", "name": "Iron Wool / Filings", "formula": "Fe (s)", "category": "reactive metal" },
|
|
158
|
+
{ "id": "vegetable_oil", "name": "Vegetable Oil", "formula": "tristearin", "category": "organic", "note": "saponifies with NaOH at T>60C" },
|
|
159
|
+
{ "id": "crude_oil", "name": "Crude Oil", "formula": "hydrocarbon mixture", "category": "organic", "note": "fractionally distilled into petrol/kerosene/diesel/bitumen" },
|
|
160
|
+
{ "id": "nicl2", "name": "Nickel(II) Chloride", "formula": "NiCl2 0.1 M", "category": "salt" },
|
|
161
|
+
{ "id": "nickel_sulfate", "name": "Nickel Sulfate", "formula": "NiSO4 1 M", "category": "salt" },
|
|
162
|
+
{ "id": "dmg", "name": "Dimethylglyoxime (DMG)", "formula": "C4H8N2O2 50 mM", "category": "chelating agent", "note": "scarlet NiDMG2 precipitate at pH 4-10" },
|
|
163
|
+
{ "id": "na2s", "name": "Sodium Sulfide", "formula": "Na2S 0.1 M", "category": "salt", "warning": "releases toxic H2S in acid" },
|
|
164
|
+
{ "id": "sodium_sulfide", "name": "Sodium Sulfide (0.5 M)", "formula": "Na2S 0.5 M", "category": "salt", "warning": "releases toxic H2S in acid" },
|
|
165
|
+
{ "id": "znso4", "name": "Zinc Sulfate", "formula": "ZnSO4 0.1 M", "category": "salt" },
|
|
166
|
+
{ "id": "zinc_sulfate", "name": "Zinc Sulfate (1 M)", "formula": "ZnSO4 1 M", "category": "salt" },
|
|
167
|
+
{ "id": "zinc_chloride", "name": "Zinc Chloride", "formula": "ZnCl2 1 M", "category": "salt" },
|
|
168
|
+
{ "id": "cobalt_chloride", "name": "Cobalt Chloride", "formula": "CoCl2 1 M", "category": "salt" },
|
|
169
|
+
{ "id": "manganese_sulfate", "name": "Manganese Sulfate", "formula": "MnSO4 1 M", "category": "salt" },
|
|
170
|
+
{ "id": "aluminium_sulfate", "name": "Aluminium Sulfate (Alum)", "formula": "Al2(SO4)3 0.5 M", "category": "salt" },
|
|
171
|
+
{ "id": "magnesium_sulfate", "name": "Magnesium Sulfate (Epsom Salt)", "formula": "MgSO4 1 M", "category": "salt" },
|
|
172
|
+
{ "id": "cadmium_nitrate", "name": "Cadmium Nitrate", "formula": "Cd(NO3)2 0.5 M", "category": "salt", "warning": "highly toxic — carcinogen" },
|
|
173
|
+
{ "id": "bismuth_nitrate", "name": "Bismuth Nitrate", "formula": "Bi(NO3)3 0.1 M", "category": "salt" },
|
|
174
|
+
{ "id": "mercury_nitrate", "name": "Mercury(II) Nitrate", "formula": "Hg(NO3)2 0.1 M", "category": "salt", "warning": "highly toxic neurotoxin" },
|
|
175
|
+
{ "id": "sodium_bromide", "name": "Sodium Bromide", "formula": "NaBr 1 M", "category": "salt" },
|
|
176
|
+
{ "id": "sodium_iodide", "name": "Sodium Iodide", "formula": "NaI 1 M", "category": "salt" },
|
|
177
|
+
{ "id": "potassium_chromate", "name": "Potassium Chromate (0.5 M)", "formula": "K2CrO4 0.5 M", "category": "salt" },
|
|
178
|
+
{ "id": "sodium_phosphate", "name": "Sodium Phosphate", "formula": "Na3PO4 0.3 M", "category": "salt" },
|
|
179
|
+
{ "id": "sodium_fluoride", "name": "Sodium Fluoride", "formula": "NaF 1 M", "category": "salt" },
|
|
180
|
+
{ "id": "k4fe_cn6", "name": "Potassium Ferrocyanide", "formula": "K4[Fe(CN)6] 0.1 M", "category": "salt", "note": "forms Prussian Blue with Fe3+" },
|
|
181
|
+
{ "id": "k3fe_cn6", "name": "Potassium Ferricyanide", "formula": "K3[Fe(CN)6] 0.1 M", "category": "salt", "note": "Turnbull's Blue test for Fe2+" },
|
|
182
|
+
{ "id": "na2so3", "name": "Sodium Sulfite", "formula": "Na2SO3 0.5 M", "category": "salt", "note": "SO2 gas released in acid" },
|
|
183
|
+
{ "id": "nano2", "name": "Sodium Nitrite", "formula": "NaNO2 0.5 M", "category": "salt", "note": "NO gas released in acid" },
|
|
184
|
+
{ "id": "kcn", "name": "Potassium Cyanide", "formula": "KCN 0.1 M", "category": "salt", "warning": "EXTREMELY TOXIC. Never acidify — releases HCN gas." },
|
|
185
|
+
{ "id": "n2_gas", "name": "Nitrogen Gas", "formula": "N2 (g)", "category": "gas", "note": "Haber-Bosch feedstock" },
|
|
186
|
+
{ "id": "h2_gas", "name": "Hydrogen Gas", "formula": "H2 (g)", "category": "gas", "warning": "highly flammable", "note": "Haber-Bosch feedstock" },
|
|
187
|
+
{ "id": "fe_catalyst", "name": "Iron Catalyst", "formula": "Fe (s)", "category": "catalyst", "note": "required for Haber-Bosch at T>200C" },
|
|
188
|
+
{ "id": "bleach", "name": "Bleach (NaOCl)", "formula": "NaOCl (aq) 1 M", "category": "oxidiser", "warning": "NEVER mix with ammonia or acids" },
|
|
189
|
+
{ "id": "pool_shock", "name": "Pool Shock Ca(OCl)2", "formula": "Ca(OCl)2", "category": "oxidiser", "warning": "strong oxidiser — releases Cl2 with acid" },
|
|
190
|
+
{ "id": "muriatic_acid", "name": "Muriatic Acid (HCl 30%)", "formula": "HCl 9.5 M", "category": "acid" },
|
|
191
|
+
{ "id": "vinegar", "name": "White Vinegar (5% AcOH)", "formula": "CH3COOH 0.83 M", "category": "acid" },
|
|
192
|
+
{ "id": "baking_soda", "name": "Baking Soda (NaHCO3)", "formula": "NaHCO3 1 M", "category": "base" },
|
|
193
|
+
{ "id": "washing_soda", "name": "Washing Soda (Na2CO3)", "formula": "Na2CO3 0.1 M", "category": "base" },
|
|
194
|
+
{ "id": "rust", "name": "Rust (Fe2O3)", "formula": "Fe2O3 (s)", "category": "solid", "note": "dissolves in acid or acetic acid to give Fe3+" },
|
|
195
|
+
{ "id": "hard_water", "name": "Hard Water (Ca/Mg salts)", "formula": "CaCO3/MgCO3 dissolved", "category": "aqueous", "note": "softened by Na2CO3 (CaCO3 precipitate)" },
|
|
196
|
+
{ "id": "pool_algicide", "name": "Copper Sulfate (Algicide)", "formula": "CuSO4 10 mM", "category": "salt" },
|
|
197
|
+
{ "id": "glucose", "name": "Glucose Solution", "formula": "C6H12O6 0.5 M", "category": "organic", "note": "reducing sugar — Benedict's/Tollens' positive" },
|
|
198
|
+
{ "id": "fructose", "name": "Fructose Solution", "formula": "C6H12O6 0.5 M", "category": "organic", "note": "reducing sugar — Benedict's positive" },
|
|
199
|
+
{ "id": "formaldehyde", "name": "Formaldehyde (Formalin 10%)", "formula": "HCHO 3.3 M", "category": "organic", "warning": "IARC Group 1 carcinogen" },
|
|
200
|
+
{ "id": "acetaldehyde", "name": "Acetaldehyde", "formula": "CH3CHO 12 M", "category": "organic", "boilingPoint": 20.2 },
|
|
201
|
+
{ "id": "benedicts", "name": "Benedict's Reagent", "formula": "Cu2+/Na2CO3/citrate", "category": "analytical", "note": "brick-red Cu2O from reducing sugars at T>60C" },
|
|
202
|
+
{ "id": "tollens", "name": "Tollens' Reagent (freshly prepared)", "formula": "[Ag(NH3)2]+ aq.", "category": "analytical", "warning": "PREPARE FRESH ONLY — aged forms explosive AgN3" },
|
|
203
|
+
{ "id": "sodium_oxalate", "name": "Sodium Oxalate", "formula": "Na2C2O4 0.5 M", "category": "analytical", "note": "decolorises KMnO4 — primary standard" },
|
|
204
|
+
{ "id": "oxalic_acid", "name": "Oxalic Acid", "formula": "H2C2O4 0.5 M", "category": "acid", "note": "diprotic, Ka1=5.9e-2. Primary standard for KMnO4" },
|
|
205
|
+
{ "id": "nh4cl", "name": "Ammonium Chloride", "formula": "NH4Cl 1 M", "category": "salt", "note": "mildly acidic pH~5; NH4+/NH3 buffer with ammonia" },
|
|
206
|
+
{ "id": "sodium_acetate", "name": "Sodium Acetate", "formula": "CH3COONa 1 M", "category": "salt", "note": "mildly basic pH~8.9; acetate buffer with acetic acid" },
|
|
207
|
+
{ "id": "edta_solution", "name": "EDTA (0.1 M)", "formula": "Na2EDTA 0.1 M", "category": "chelating agent", "note": "titrates most metal ions; water hardness determination" },
|
|
208
|
+
{ "id": "potassium_nitrate", "name": "Potassium Nitrate (saltpetre)", "formula": "KNO3 1 M", "category": "salt" },
|
|
209
|
+
{ "id": "h2o2_3pct", "name": "Hydrogen Peroxide (3%)", "formula": "H2O2 0.9 M", "category": "oxidiser" },
|
|
210
|
+
{ "id": "dilute_h2so4", "name": "Dilute Sulfuric Acid", "formula": "H2SO4 0.5 M", "category": "acid" },
|
|
211
|
+
{ "id": "dilute_hno3", "name": "Dilute Nitric Acid", "formula": "HNO3 0.5 M", "category": "acid" },
|
|
212
|
+
{ "id": "ammonium_sulfate", "name": "Ammonium Sulfate", "formula": "(NH4)2SO4 1 M", "category": "salt" },
|
|
213
|
+
{ "id": "potassium_carbonate", "name": "Potassium Carbonate", "formula": "K2CO3 0.5 M", "category": "base" },
|
|
214
|
+
{ "id": "strontium_chloride", "name": "Strontium Chloride", "formula": "SrCl2 0.5 M", "category": "salt" },
|
|
215
|
+
{ "id": "bromine_water", "name": "Bromine Water", "formula": "Br2 (aq) 0.1 M", "category": "oxidiser", "warning": "toxic vapour — use in fume hood" },
|
|
216
|
+
{ "id": "cyclohexene_l", "name": "Cyclohexene", "formula": "C6H10 neat", "category": "organic", "boilingPoint": 83, "note": "instantly decolorises Br2 — alkene test" },
|
|
217
|
+
{ "id": "glucose_yeast", "name": "Glucose + Yeast (Fermentation)", "formula": "C6H12O6 + Saccharomyces", "category": "organic", "note": "ferments to EtOH + CO2" },
|
|
218
|
+
{ "id": "brine_electrolysis", "name": "Saturated NaCl Brine", "formula": "NaCl 6 M", "category": "electrolyte", "note": "chlor-alkali: Cl2 at anode, H2 + NaOH at cathode" },
|
|
219
|
+
{ "id": "dilute_h2so4_electrolysis", "name": "Dilute H2SO4 (Hofmann)", "formula": "H2SO4 0.5 M", "category": "electrolyte", "note": "water electrolysis: H2:O2 = 2:1 by volume" }
|
|
220
|
+
],
|
|
221
|
+
"partitionCoefficients": {
|
|
222
|
+
"description": "log Kd values (positive = prefers organic layer, negative = prefers aqueous layer). Used in sep funnel liquid-liquid extraction.",
|
|
223
|
+
"hexane": 3.9,
|
|
224
|
+
"toluene": 2.73,
|
|
225
|
+
"CHCl3": 1.97,
|
|
226
|
+
"DCM": 1.25,
|
|
227
|
+
"Et2O": 0.89,
|
|
228
|
+
"EtOAc": 0.73,
|
|
229
|
+
"THF": 0.46,
|
|
230
|
+
"acetone": -0.24,
|
|
231
|
+
"EtOH": 0.1,
|
|
232
|
+
"DMSO": -1.35,
|
|
233
|
+
"MeOH": -0.77,
|
|
234
|
+
"I2(aq)": 2.5,
|
|
235
|
+
"I3-": -0.3,
|
|
236
|
+
"Fe(SCN)2+": -1.0,
|
|
237
|
+
"Cu2+": -3.0,
|
|
238
|
+
"Na+": -5,
|
|
239
|
+
"Cl-": -5
|
|
240
|
+
},
|
|
241
|
+
"boilingPoints": {
|
|
242
|
+
"description": "Normal boiling points at 1 atm (°C). Adjusted for pressure via Clausius-Clapeyron. Vacuum line reduces pressure to ~0.2 atm, lowering BP by ~120°C.",
|
|
243
|
+
"Et2O": 34.6,
|
|
244
|
+
"DCM": 40.0,
|
|
245
|
+
"acetone": 56.1,
|
|
246
|
+
"THF": 66.0,
|
|
247
|
+
"hexane": 69.0,
|
|
248
|
+
"EtOH": 78.4,
|
|
249
|
+
"cyclohexene": 83.0,
|
|
250
|
+
"acetic": 118.0,
|
|
251
|
+
"EtOAc": 77.1,
|
|
252
|
+
"MeOH": 64.7,
|
|
253
|
+
"CHCl3": 61.2,
|
|
254
|
+
"toluene": 111.0,
|
|
255
|
+
"water": 100.0,
|
|
256
|
+
"DMSO": 189.0,
|
|
257
|
+
"glycerol": 290.0,
|
|
258
|
+
"CH3CHO": 20.2
|
|
259
|
+
},
|
|
260
|
+
"precipitates": {
|
|
261
|
+
"description": "Solid precipitates tracked in mol. Form when ion product exceeds Ksp. 55+ ion pairs supported.",
|
|
262
|
+
"silverSalts": ["AgCl (white)", "AgBr (pale yellow)", "AgI (yellow)", "Ag2CO3 (pale yellow)", "Ag2SO4 (white)", "Ag3PO4 (yellow)", "Ag2CrO4 (brick red)", "Ag2S (black)", "AgOH (brownish)", "Ag (silver mirror — Tollens)"],
|
|
263
|
+
"bariumSalts": ["BaSO4 (white)", "BaCO3 (white)", "BaCrO4 (yellow)", "BaF2 (white)"],
|
|
264
|
+
"calciumSalts": ["CaCO3 (white)", "CaSO4 (white)", "CaF2 (white)", "Ca3(PO4)2 (white)"],
|
|
265
|
+
"leadSalts": ["PbI2 (golden — golden rain)", "PbSO4 (white)", "PbCO3 (white)", "PbS (black)", "PbCl2 (white)", "PbCrO4 (yellow)", "Pb(OH)2 (white)"],
|
|
266
|
+
"transitionMetalHydroxides": ["Cu(OH)2 (pale blue)", "Fe(OH)2 (pale green)", "Fe(OH)3 (rust)", "Ni(OH)2 (green)", "Co(OH)2 (pink)", "Mn(OH)2 (pale pink)", "Zn(OH)2 (white)", "Cd(OH)2 (white)", "Al(OH)3 (white gelatinous)", "Cr(OH)3 (grey-green)", "Mg(OH)2 (white)", "Bi(OH)3 (white)"],
|
|
267
|
+
"metalSulfides": ["CuS (black)", "ZnS (pale yellow)", "FeS (black)", "NiS (black)", "CoS (black)", "MnS (salmon)", "CdS (yellow)", "HgS (red/black)", "PbS (black)", "Ag2S (black)"],
|
|
268
|
+
"special": ["NiDMG (scarlet — dimethylglyoximate)", "Fe4[Fe(CN)6]3 (Prussian Blue)", "Cu2O (brick red — Benedict's positive)", "MnO2 (dark brown)", "Cu(dep) (orange — electrodeposited)", "CuI (white — iodometric)"]
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
{
|
|
2
|
+
"overview": "Circuit Expert is a browser-based interactive electronics circuit playground. It uses a WASM-compiled ngspice simulator (via @tscircuit/ngspice-spice-engine) to run SPICE-accurate transient simulations. The canvas is built using React Flow, where components are nodes and connections are edges. In addition to analog components, it integrates logic gates and a Javascript-sandboxed Microcontroller (MCU) simulator for hybrid digital/analog designs. Coordinate system: standard canvas coordinates (X increases right, Y increases down).",
|
|
3
|
+
"workflow": [
|
|
4
|
+
"1. Call circuit_get_schema to find the list of supported components, their parameters, and connection terminal names.",
|
|
5
|
+
"2. Use circuit_get_state to check the current canvas state: which nodes (components) and edges (wires) are loaded.",
|
|
6
|
+
"3. Construct or modify the circuit by calling circuit_set_nodes and/or circuit_set_edges.",
|
|
7
|
+
"4. Trigger the transient simulation using circuit_run_sim. Always call this after modifying node properties or connections to update voltages, currents, and MCU outputs.",
|
|
8
|
+
"5. Retrieve the simulation waveforms using circuit_get_waveforms to inspect voltages, currents, and MCU logs programmatically.",
|
|
9
|
+
"6. If troubleshooting or analyzing a wire, call circuit_toggle_probe to enable real-time voltage inspection at specific coordinates."
|
|
10
|
+
],
|
|
11
|
+
"gotchas": [
|
|
12
|
+
"SINGULAR MATRIX ERROR: ngspice is extremely sensitive to floating nodes. Any pin or terminal that is left unconnected will cause a singular matrix error. To prevent this, the simulation layer automatically shunts unconnected pins with a 1G ohm resistor to ground, but you should always ensure loops are closed and Ground (GND) is connected to a common reference.",
|
|
13
|
+
"MCU TWO-PASS SIMULATION: MCUs are simulated using a two-pass mechanism. Pass 1 runs standard SPICE. Pass 2 inputs the resulting node voltages into the JS sandbox, generates a Piecewise Linear (PWL) output, and re-runs SPICE. For analog reads (e.g. analogRead('A0')), make sure the source is connected to A0 and that you call sleep() in the loop to give the simulation time steps.",
|
|
14
|
+
"PORT TO NET NAMES: In ngspice, nodes are resolved to net names. If you use the probe tool (circuit_toggle_probe), it maps component ports like 'led1-anode' to net names like 'net1'. Keep track of these mappings if writing custom spice.",
|
|
15
|
+
"SAMPLING RATES: The oscilloscope and speaker components capture waveforms over the simulation duration (e.g., simLength). If you are outputting audio, make sure the sampling frequency of your signal generator or MCU code matches the time scale to avoid aliasing.",
|
|
16
|
+
"NMOS HIGH-SIDE SWITCHING: Do not use NMOS as the high-side switch in a buck converter (drain at Vin, source at switching node, gate driven from a GND-referenced signal). This is a fundamental electronics constraint, not a simulator limitation: when the NMOS turns on, the source rises toward Vin, collapsing Vgs below the threshold and immediately turning it off. A proper high-side NMOS requires a bootstrap gate driver. Without one, use NMOS low-side only (source tied to GND). For buck converters, the working topology is: NMOS drain at Vin, source at the switching node, freewheeling diode cathode also at the switching node, diode anode to GND, inductor from switching node to output.",
|
|
17
|
+
"SWITCHING FREQUENCY AND SIMULATION SPEED: The default SPICE timestep is around 1ms (normal resolution) or 0.05ms (high resolution). Signal generators running faster than roughly 1-5kHz may require many sub-steps per cycle to converge, significantly increasing simulation time. Very high frequencies (tens of kHz and above) combined with a long simLength can make the simulation slow or unresponsive. If a switching circuit is slow to simulate, try reducing the frequency or the simLength first.",
|
|
18
|
+
"BUCK CONVERTER DUTY CYCLE: The theoretical duty cycle for a buck converter is Vout/Vin. In practice, MOSFET threshold voltage and diode forward drop mean the effective duty is lower — expect to tune the dutyCycle parameter down by several percent from the ideal value."
|
|
19
|
+
],
|
|
20
|
+
"coordinateSystem": {
|
|
21
|
+
"canvasGrid": "React Flow canvas uses a standard X/Y coordinate system. X increases to the right, Y increases downwards.",
|
|
22
|
+
"spacing": "Ensure components are spaced sufficiently (typically 100-300 units apart) so that their ports can be easily connected without overlapping wires."
|
|
23
|
+
},
|
|
24
|
+
"tools": {
|
|
25
|
+
"circuit_get_state": "Return full Circuit Expert state: nodes, edges, isSimulating, selectedPreset, probeMode.",
|
|
26
|
+
"circuit_get_components": "Return all circuit components (nodes) with positions and data.",
|
|
27
|
+
"circuit_run_sim": "Trigger the SPICE simulation in Circuit Expert.",
|
|
28
|
+
"circuit_stop_sim": "Stop the running SPICE simulation.",
|
|
29
|
+
"circuit_toggle_probe": "Toggle probe mode (click a wire to inspect voltage).",
|
|
30
|
+
"circuit_load_preset": "Load a named circuit preset.",
|
|
31
|
+
"circuit_set_nodes": "Replace all components in the Circuit Expert canvas.",
|
|
32
|
+
"circuit_set_edges": "Replace all wires in the Circuit Expert canvas.",
|
|
33
|
+
"circuit_get_schema": "Return the Circuit Expert component schema, state fields, and SPICE model specifications.",
|
|
34
|
+
"circuit_get_waveforms": "Return transient waveforms (voltage/current time series) for all components and wires after simulation runs.",
|
|
35
|
+
"circuit_upload_audio": "Upload audio samples to a microphone node.",
|
|
36
|
+
"circuit_download_audio": "Download audio waveforms from a speaker node, optionally interpolated."
|
|
37
|
+
},
|
|
38
|
+
"schema": {
|
|
39
|
+
"nodeFields": {
|
|
40
|
+
"id": "string — unique component identifier",
|
|
41
|
+
"type": "string — component type (e.g., resistor, capacitor, inductor, diode, led, switch, multimeter, scope, speaker, transistor (npn/pnp), source (voltage/current/acvoltage/signalgen), ground, mcu, sevensegment, potentiometer, opamp, timer555)",
|
|
42
|
+
"position": {
|
|
43
|
+
"x": "number — X position on canvas",
|
|
44
|
+
"y": "number — Y position on canvas"
|
|
45
|
+
},
|
|
46
|
+
"data": {
|
|
47
|
+
"label": "string — display label (e.g., '1k', '10u', '5V')",
|
|
48
|
+
"value": "string/number — component value",
|
|
49
|
+
"isSimulating": "boolean — true if SPICE simulation is running and rendering animation",
|
|
50
|
+
"current_array": "number[] — transient current through component in Amperes over time",
|
|
51
|
+
"time_points": "number[] — transient timestamps in milliseconds",
|
|
52
|
+
"voltageData": "{t: number, v: number}[] — transient voltage readings (e.g., for Oscilloscope, Speaker)",
|
|
53
|
+
"segmentVoltageArrays": "Record<string, number[]> — per-segment voltage readings for 7-Segment displays"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"componentTerminals": {
|
|
57
|
+
"resistor": ["in", "out"],
|
|
58
|
+
"capacitor": ["in", "out"],
|
|
59
|
+
"inductor": ["in", "out"],
|
|
60
|
+
"diode": ["anode", "cathode"],
|
|
61
|
+
"led": ["anode", "cathode"],
|
|
62
|
+
"zener": ["anode", "cathode"],
|
|
63
|
+
"switch": ["in", "out"],
|
|
64
|
+
"voltage": ["pos", "neg"],
|
|
65
|
+
"acvoltage": ["pos", "neg"],
|
|
66
|
+
"signalgen": ["out", "gnd", "sync"],
|
|
67
|
+
"ground": ["in"],
|
|
68
|
+
"scope": ["ch1", "ch2", "gnd"],
|
|
69
|
+
"speaker": ["in", "gnd"],
|
|
70
|
+
"npn": ["c", "b", "e"],
|
|
71
|
+
"pnp": ["c", "b", "e"],
|
|
72
|
+
"nmos": ["d", "g", "s"],
|
|
73
|
+
"pmos": ["d", "g", "s"],
|
|
74
|
+
"potentiometer": ["in", "out", "wiper"],
|
|
75
|
+
"sevensegment": ["a", "b", "c", "d", "e", "f", "g", "common"],
|
|
76
|
+
"mcu": ["D0", "D1", "D2", "D3", "A0", "A1", "5V", "GND"],
|
|
77
|
+
"opamp": ["in_non", "in_inv", "vcc", "vee", "out"],
|
|
78
|
+
"timer555": ["1", "2", "3", "4", "5", "6", "7", "8"]
|
|
79
|
+
},
|
|
80
|
+
"spiceModels": {
|
|
81
|
+
"potentiometer": {
|
|
82
|
+
"description": "Modelled as a two-resistor voltage divider to capture 3-terminal behaviour.",
|
|
83
|
+
"parameters": {
|
|
84
|
+
"totalResistance": "number — total end-to-end resistance in ohms",
|
|
85
|
+
"wiperPos": "number — wiper position from 0.0 (0%) to 1.0 (100%)",
|
|
86
|
+
"R_top": "TotalResistance * (1 - WiperPos) ohms",
|
|
87
|
+
"R_bottom": "TotalResistance * WiperPos ohms"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"sevensegment": {
|
|
91
|
+
"description": "Common Cathode 7-segment display node. Assumes common pin is grounded.",
|
|
92
|
+
"activationThreshold": "2.5V — segment lights up if (V_seg - V_common) > 2.5V"
|
|
93
|
+
},
|
|
94
|
+
"currentSource": {
|
|
95
|
+
"description": "Provides constant DC current.",
|
|
96
|
+
"parameters": {
|
|
97
|
+
"value": "number — DC current in Amperes"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"probeMode": {
|
|
102
|
+
"description": "Allows clicking on a wire/edge after a simulation run to inspect voltage at that node.",
|
|
103
|
+
"behavior": "Displays a floating tooltip showing the Net name and the final voltage value of the SPICE node."
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"examples": [
|
|
107
|
+
{
|
|
108
|
+
"title": "Basic LED Blinker",
|
|
109
|
+
"description": "A signal generator producing a 1Hz square wave to blink a red LED through a 330 ohm current-limiting resistor.",
|
|
110
|
+
"nodes": [
|
|
111
|
+
{ "id": "sg1", "type": "signalgen", "position": { "x": 100, "y": 150 }, "data": { "label": "Clock 1Hz", "waveform": "square", "frequency": 1, "amplitude": 5 } },
|
|
112
|
+
{ "id": "r1", "type": "resistor", "position": { "x": 350, "y": 150 }, "data": { "label": "330" } },
|
|
113
|
+
{ "id": "led1", "type": "led", "position": { "x": 600, "y": 150 }, "data": { "label": "Red LED", "color": "red", "v_drop": 2.0, "max_current": 20 } },
|
|
114
|
+
{ "id": "g1", "type": "ground", "position": { "x": 600, "y": 300 }, "data": { "label": "GND" } },
|
|
115
|
+
{ "id": "g2", "type": "ground", "position": { "x": 100, "y": 300 }, "data": { "label": "GND" } }
|
|
116
|
+
],
|
|
117
|
+
"edges": [
|
|
118
|
+
{ "id": "e-sg1-r1", "source": "sg1", "target": "r1", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
119
|
+
{ "id": "e-r1-led1", "source": "r1", "target": "led1", "sourceHandle": "out", "targetHandle": "anode", "type": "smoothstep" },
|
|
120
|
+
{ "id": "e-led1-g1", "source": "led1", "target": "g1", "sourceHandle": "cathode", "targetHandle": "in", "type": "smoothstep" },
|
|
121
|
+
{ "id": "e-sg1-g2", "source": "sg1", "target": "g2", "sourceHandle": "gnd", "targetHandle": "in", "type": "smoothstep" }
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"title": "555 Timer Blinker",
|
|
126
|
+
"description": "An astable oscillator circuit built around the NE555 timer macro model, blinking an LED at around 1.3Hz.",
|
|
127
|
+
"nodes": [
|
|
128
|
+
{ "id": "v1", "type": "voltage", "position": { "x": 100, "y": 50 }, "data": { "label": "5V" } },
|
|
129
|
+
{ "id": "t555", "type": "timer555", "position": { "x": 400, "y": 200 }, "data": { "label": "555 Timer" } },
|
|
130
|
+
{ "id": "r1", "type": "resistor", "position": { "x": 250, "y": 50 }, "data": { "label": "10k" } },
|
|
131
|
+
{ "id": "r2", "type": "resistor", "position": { "x": 250, "y": 150 }, "data": { "label": "47k" } },
|
|
132
|
+
{ "id": "c1", "type": "capacitor", "position": { "x": 250, "y": 250 }, "data": { "label": "10u" } },
|
|
133
|
+
{ "id": "r3", "type": "resistor", "position": { "x": 600, "y": 200 }, "data": { "label": "330" } },
|
|
134
|
+
{ "id": "led1", "type": "led", "position": { "x": 800, "y": 200 }, "data": { "label": "Blue LED", "color": "blue" } },
|
|
135
|
+
{ "id": "g1", "type": "ground", "position": { "x": 100, "y": 400 }, "data": { "label": "GND" } }
|
|
136
|
+
],
|
|
137
|
+
"edges": [
|
|
138
|
+
{ "id": "e-v1-t8", "source": "v1", "target": "t555", "sourceHandle": "pos", "targetHandle": "8", "type": "smoothstep" },
|
|
139
|
+
{ "id": "e-v1-t4", "source": "v1", "target": "t555", "sourceHandle": "pos", "targetHandle": "4", "type": "smoothstep" },
|
|
140
|
+
{ "id": "e-v1-r1", "source": "v1", "target": "r1", "sourceHandle": "pos", "targetHandle": "in", "type": "smoothstep" },
|
|
141
|
+
{ "id": "e-v1-g1", "source": "v1", "target": "g1", "sourceHandle": "neg", "targetHandle": "in", "type": "smoothstep" },
|
|
142
|
+
{ "id": "e-t1-g1", "source": "t555", "target": "g1", "sourceHandle": "1", "targetHandle": "in", "type": "smoothstep" },
|
|
143
|
+
{ "id": "e-r1-r2", "source": "r1", "target": "r2", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
144
|
+
{ "id": "e-r1-t7", "source": "r1", "target": "t555", "sourceHandle": "out", "targetHandle": "7", "type": "smoothstep" },
|
|
145
|
+
{ "id": "e-r2-c1", "source": "r2", "target": "c1", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
146
|
+
{ "id": "e-r2-t6", "source": "r2", "target": "t555", "sourceHandle": "out", "targetHandle": "6", "type": "smoothstep" },
|
|
147
|
+
{ "id": "e-r2-t2", "source": "r2", "target": "t555", "sourceHandle": "out", "targetHandle": "2", "type": "smoothstep" },
|
|
148
|
+
{ "id": "e-c1-g1", "source": "c1", "target": "g1", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
149
|
+
{ "id": "e-t3-r3", "source": "t555", "target": "r3", "sourceHandle": "3", "targetHandle": "in", "type": "smoothstep" },
|
|
150
|
+
{ "id": "e-r3-led1", "source": "r3", "target": "led1", "sourceHandle": "out", "targetHandle": "anode", "type": "smoothstep" },
|
|
151
|
+
{ "id": "e-led1-g1", "source": "led1", "target": "g1", "sourceHandle": "cathode", "targetHandle": "in", "type": "smoothstep" }
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"title": "MCU Analog Logger",
|
|
156
|
+
"description": "An AC voltage source monitored by an MCU analog input channel. Demonstrates the two-pass MCU SPICE simulation loop and serial logging.",
|
|
157
|
+
"nodes": [
|
|
158
|
+
{ "id": "vac1", "type": "acvoltage", "position": { "x": 50, "y": 180 }, "data": { "label": "5V 40Hz", "amplitude": 5, "frequency": 40 } },
|
|
159
|
+
{ "id": "mcu1", "type": "mcu", "position": { "x": 300, "y": 150 }, "data": { "label": "Microcontroller", "code": "pinMode('A0', 'INPUT');\n\n// Read A0 every 5ms and log it\nwhile(true) {\n const val = analogRead('A0');\n Serial.println(`t=${millis()}ms -> A0: ${val}`);\n sleep(5);\n}" } },
|
|
160
|
+
{ "id": "g1", "type": "ground", "position": { "x": 50, "y": 300 }, "data": { "label": "GND" } },
|
|
161
|
+
{ "id": "g2", "type": "ground", "position": { "x": 300, "y": 350 }, "data": { "label": "GND" } }
|
|
162
|
+
],
|
|
163
|
+
"edges": [
|
|
164
|
+
{ "id": "e-vac-mcu", "source": "vac1", "target": "mcu1", "sourceHandle": "pos", "targetHandle": "A0", "type": "smoothstep" },
|
|
165
|
+
{ "id": "e-vac-gnd", "source": "vac1", "target": "g1", "sourceHandle": "neg", "targetHandle": "in", "type": "smoothstep" },
|
|
166
|
+
{ "id": "e-mcu-gnd", "source": "mcu1", "target": "g2", "sourceHandle": "GND", "targetHandle": "in", "type": "smoothstep" }
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"title": "BJT Audio Amplifier",
|
|
171
|
+
"description": "A single-stage common-emitter NPN transistor amplifier amplifying a microphone input signal to drive a speaker load.",
|
|
172
|
+
"nodes": [
|
|
173
|
+
{ "id": "v1", "type": "voltage", "position": { "x": 100, "y": 50 }, "data": { "label": "12V VCC" } },
|
|
174
|
+
{ "id": "mic1", "type": "microphone", "position": { "x": 100, "y": 300 }, "data": { "label": "Mic Input" } },
|
|
175
|
+
{ "id": "cin", "type": "capacitor", "position": { "x": 250, "y": 300 }, "data": { "label": "10u" } },
|
|
176
|
+
{ "id": "r1", "type": "resistor", "position": { "x": 400, "y": 150 }, "data": { "label": "47k" } },
|
|
177
|
+
{ "id": "r2", "type": "resistor", "position": { "x": 400, "y": 400 }, "data": { "label": "10k" } },
|
|
178
|
+
{ "id": "q1", "type": "npn", "position": { "x": 600, "y": 300 }, "data": { "label": "2N3904 NPN", "bf": 300 } },
|
|
179
|
+
{ "id": "rc", "type": "resistor", "position": { "x": 600, "y": 150 }, "data": { "label": "2.2k" } },
|
|
180
|
+
{ "id": "re", "type": "resistor", "position": { "x": 600, "y": 450 }, "data": { "label": "1k" } },
|
|
181
|
+
{ "id": "cout", "type": "capacitor", "position": { "x": 800, "y": 300 }, "data": { "label": "470u" } },
|
|
182
|
+
{ "id": "spk1", "type": "speaker", "position": { "x": 1000, "y": 300 }, "data": { "label": "Speaker Output", "acCouple": true, "normalize": true } },
|
|
183
|
+
{ "id": "g1", "type": "ground", "position": { "x": 100, "y": 600 }, "data": { "label": "GND" } }
|
|
184
|
+
],
|
|
185
|
+
"edges": [
|
|
186
|
+
{ "id": "e-v1-rc", "source": "v1", "target": "rc", "sourceHandle": "pos", "targetHandle": "in", "type": "smoothstep" },
|
|
187
|
+
{ "id": "e-v1-r1", "source": "v1", "target": "r1", "sourceHandle": "pos", "targetHandle": "in", "type": "smoothstep" },
|
|
188
|
+
{ "id": "e-v1-g1", "source": "v1", "target": "g1", "sourceHandle": "neg", "targetHandle": "in", "type": "smoothstep" },
|
|
189
|
+
{ "id": "e-mic-cin", "source": "mic1", "target": "cin", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
190
|
+
{ "id": "e-mic-g1", "source": "mic1", "target": "g1", "sourceHandle": "gnd", "targetHandle": "in", "type": "smoothstep" },
|
|
191
|
+
{ "id": "e-r1-b", "source": "r1", "target": "q1", "sourceHandle": "out", "targetHandle": "b", "type": "smoothstep" },
|
|
192
|
+
{ "id": "e-r2-b", "source": "q1", "target": "r2", "sourceHandle": "b", "targetHandle": "in", "type": "smoothstep" },
|
|
193
|
+
{ "id": "e-r2-g1", "source": "r2", "target": "g1", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
194
|
+
{ "id": "e-cin-b", "source": "cin", "target": "q1", "sourceHandle": "out", "targetHandle": "b", "type": "smoothstep" },
|
|
195
|
+
{ "id": "e-rc-c", "source": "rc", "target": "q1", "sourceHandle": "out", "targetHandle": "c", "type": "smoothstep" },
|
|
196
|
+
{ "id": "e-c-cout", "source": "q1", "target": "cout", "sourceHandle": "c", "targetHandle": "in", "type": "smoothstep" },
|
|
197
|
+
{ "id": "e-q1-re", "source": "q1", "target": "re", "sourceHandle": "e", "targetHandle": "in", "type": "smoothstep" },
|
|
198
|
+
{ "id": "e-re-g1", "source": "re", "target": "g1", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
199
|
+
{ "id": "e-cout-spk", "source": "cout", "target": "spk1", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
200
|
+
{ "id": "e-spk-g1", "source": "spk1", "target": "g1", "sourceHandle": "gnd", "targetHandle": "in", "type": "smoothstep" }
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"title": "MOSFET Boost Converter",
|
|
205
|
+
"description": "A switching DC-DC boost converter using an NMOS switch driven by a 50kHz PWM source, stepping up 5V to approximately 25V across a filter capacitor and resistor load.",
|
|
206
|
+
"nodes": [
|
|
207
|
+
{ "id": "v5v", "type": "voltage", "position": { "x": 50, "y": 250 }, "data": { "label": "5V Input" } },
|
|
208
|
+
{ "id": "l1", "type": "inductor", "position": { "x": 250, "y": 150 }, "data": { "label": "100u" } },
|
|
209
|
+
{ "id": "sw1", "type": "nmos", "position": { "x": 450, "y": 300 }, "data": { "label": "NMOS Switch", "vto": 2.0, "kp": 0.5 } },
|
|
210
|
+
{ "id": "pwm1", "type": "signalgen", "position": { "x": 50, "y": 450 }, "data": { "label": "PWM 50kHz", "waveform": "square", "frequency": 50000, "amplitude": 5, "dutyCycle": 80 } },
|
|
211
|
+
{ "id": "d1", "type": "diode", "position": { "x": 550, "y": 150 }, "data": { "label": "Schottky Diode", "v_drop": 0.3 } },
|
|
212
|
+
{ "id": "c1", "type": "capacitor", "position": { "x": 750, "y": 250 }, "data": { "label": "100u" } },
|
|
213
|
+
{ "id": "rload", "type": "resistor", "position": { "x": 900, "y": 250 }, "data": { "label": "1k Load" } },
|
|
214
|
+
{ "id": "mm_out", "type": "multimeter", "position": { "x": 1000, "y": 250 }, "data": { "label": "Output Volts" } },
|
|
215
|
+
{ "id": "g1", "type": "ground", "position": { "x": 450, "y": 550 }, "data": { "label": "GND" } }
|
|
216
|
+
],
|
|
217
|
+
"edges": [
|
|
218
|
+
{ "id": "e-v5v-l1", "source": "v5v", "target": "l1", "sourceHandle": "pos", "targetHandle": "in", "type": "smoothstep" },
|
|
219
|
+
{ "id": "e-v5v-gnd", "source": "v5v", "target": "g1", "sourceHandle": "neg", "targetHandle": "in", "type": "smoothstep" },
|
|
220
|
+
{ "id": "e-l1-sw", "source": "l1", "target": "sw1", "sourceHandle": "out", "targetHandle": "d", "type": "smoothstep" },
|
|
221
|
+
{ "id": "e-l1-d1", "source": "l1", "target": "d1", "sourceHandle": "out", "targetHandle": "anode", "type": "smoothstep" },
|
|
222
|
+
{ "id": "e-sw-gnd", "source": "sw1", "target": "g1", "sourceHandle": "s", "targetHandle": "in", "type": "smoothstep" },
|
|
223
|
+
{ "id": "e-pwm-sw", "source": "pwm1", "target": "sw1", "sourceHandle": "out", "targetHandle": "g", "type": "smoothstep" },
|
|
224
|
+
{ "id": "e-pwm-gnd", "source": "pwm1", "target": "g1", "sourceHandle": "gnd", "targetHandle": "in", "type": "smoothstep" },
|
|
225
|
+
{ "id": "e-d1-c1", "source": "d1", "target": "c1", "sourceHandle": "cathode", "targetHandle": "in", "type": "smoothstep" },
|
|
226
|
+
{ "id": "e-c1-rl", "source": "c1", "target": "rload", "sourceHandle": "in", "targetHandle": "in", "type": "smoothstep" },
|
|
227
|
+
{ "id": "e-rl-mmout", "source": "rload", "target": "mm_out", "sourceHandle": "in", "targetHandle": "pos", "type": "smoothstep" },
|
|
228
|
+
{ "id": "e-c1-gnd", "source": "c1", "target": "g1", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
229
|
+
{ "id": "e-rl-gnd", "source": "rload", "target": "g1", "sourceHandle": "out", "targetHandle": "in", "type": "smoothstep" },
|
|
230
|
+
{ "id": "mmout-neg", "source": "mm_out", "target": "g1", "sourceHandle": "neg", "targetHandle": "in", "type": "smoothstep" }
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
}
|