Electrical arithmetic and resistor colour codes

$0.005 USDC per call · Business, finance and compliance · POST /api/v1/electrical-calc · Id electrical-calc

Computes Ohm's law and power from any two of V, I, R, P; series and parallel resistance with optional tolerance bounds; a voltage divider (with optional load); an LED series resistor rounded up to a preferred E-series value; conductor voltage drop from a caller-supplied resistivity; decodes or encodes 3 to 6 band IEC 60062 resistor colour codes; and tests whether a value is an official E3 to E192 value. For engineers and agents checking a circuit number before acting on it. It does not simulate AC, reactive or non-linear circuits, choose a part by power rating or look up a material's resistivity. Exact decimal arithmetic. An optional claim map (output name to number, with a percent tolerance) turns it into a pass/fail check.

What you get

Exact decimal circuit arithmetic and colour-code decoding for one $0.005 call; no LLM arithmetic drift.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/electrical-calc. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/electrical-calc \
  -H 'content-type: application/json' \
  -d '{"op":"colour-decode","bands":["brown","black","red","gold"]}'

Input

FieldTypeRequiredDescription
opstring; one of "ohm", "series", "parallel", "divider", "led-resistor", "line-drop", "colour-decode", "colour-encode", "e-series"yesohm | series | parallel | divider | led-resistor | line-drop | colour-decode | colour-encode | e-series.
voltagenumber; -1000000000000000..1000000000000000noohm: volts.
currentnumber; -1000000000000000..1000000000000000noohm, led-resistor, line-drop: amperes.
resistancenumber; -1000000000000000..1000000000000000noohm: ohms. colour-encode and e-series: the value in ohms.
powernumber; -1000000000000000..1000000000000000noohm: watts.
resistancesarray<number; -1000000000000000..1000000000000000>; max 100 itemsnoseries/parallel: ohms, at most 100.
tolerancePctnumber; 0..100noseries/parallel: shared tolerance percent for min/max bounds. colour-encode: tolerance percent to encode.
vinnumber; -1000000000000000..1000000000000000nodivider: input volts.
r1number; -1000000000000000..1000000000000000nodivider: top resistor, ohms.
r2number; -1000000000000000..1000000000000000nodivider: bottom resistor, ohms.
rLoadnumber; -1000000000000000..1000000000000000nodivider: optional load across r2, ohms.
supplyVoltagenumber; -1000000000000000..1000000000000000noled-resistor: supply volts. line-drop: optional, enables dropPercent.
forwardVoltagenumber; -1000000000000000..1000000000000000noled-resistor: LED forward volts.
seriesstring; one of "E3", "E6", "E12", "E24", "E48", "E96", "E192"noled-resistor (default E24) and e-series: preferred-value series.
lengthMnumber; 0..1000000000000000noline-drop: one-way length in metres.
areaMm2number; 0..1000000000000000noline-drop: conductor cross-section in mm^2.
resistivityOhmMnumber; 0..1noline-drop: conductor resistivity in ohm-metres, supplied by the caller (not looked up).
roundTripbooleannoline-drop: count out and return conductors (default true).
maxDropPercentnumber; 0..100noline-drop: fail when the drop exceeds this percent of supplyVoltage.
bandsarray<string; length 0..12>; max 6 itemsnocolour-decode: 3 to 6 colours read from the head end.
bandCountinteger; 3..6nocolour-encode: 3, 4 (default), 5 or 6 bands. 5 and 6 bands carry three digits.
tcrPpmnumber; 0..1000nocolour-encode with 6 bands: temperature coefficient in ppm/K.
claimobjectnoOptional map from an output value name (e.g. resistance, vout, minResistance) to the number you expect.
claimTolerancePctnumber; 0..100noRelative tolerance for claim values, percent (default 0: exact).

Example request body

{
  "op": "colour-decode",
  "bands": [
    "brown",
    "black",
    "red",
    "gold"
  ]
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass.
operationstringno
valuesobjectnoNamed numeric results (a value is null where undefined, e.g. an unbounded ratio) in SI base units (ohm, volt, ampere, watt); null where undefined. colour-decode adds tolerancePct, min/maxResistance and tcrPpmPerK.
bandsarray<string>nocolour-decode: the normalised colour names. colour-encode: the colours to print, head end first. Omitted for other ops.
rolesarray<string>nocolour-decode: the meaning assigned to each band position. Omitted for other ops.
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways true: pure code, no model.

Pay and connect

Available through: x402 (USDC on Base), MCP. MCP clients reach it through the physical-ops-kit package.

Machine-readable