Electrical arithmetic and resistor colour codes
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
| Field | Type | Required | Description |
|---|---|---|---|
op | string; one of "ohm", "series", "parallel", "divider", "led-resistor", "line-drop", "colour-decode", "colour-encode", "e-series" | yes | ohm | series | parallel | divider | led-resistor | line-drop | colour-decode | colour-encode | e-series. |
voltage | number; -1000000000000000..1000000000000000 | no | ohm: volts. |
current | number; -1000000000000000..1000000000000000 | no | ohm, led-resistor, line-drop: amperes. |
resistance | number; -1000000000000000..1000000000000000 | no | ohm: ohms. colour-encode and e-series: the value in ohms. |
power | number; -1000000000000000..1000000000000000 | no | ohm: watts. |
resistances | array<number; -1000000000000000..1000000000000000>; max 100 items | no | series/parallel: ohms, at most 100. |
tolerancePct | number; 0..100 | no | series/parallel: shared tolerance percent for min/max bounds. colour-encode: tolerance percent to encode. |
vin | number; -1000000000000000..1000000000000000 | no | divider: input volts. |
r1 | number; -1000000000000000..1000000000000000 | no | divider: top resistor, ohms. |
r2 | number; -1000000000000000..1000000000000000 | no | divider: bottom resistor, ohms. |
rLoad | number; -1000000000000000..1000000000000000 | no | divider: optional load across r2, ohms. |
supplyVoltage | number; -1000000000000000..1000000000000000 | no | led-resistor: supply volts. line-drop: optional, enables dropPercent. |
forwardVoltage | number; -1000000000000000..1000000000000000 | no | led-resistor: LED forward volts. |
series | string; one of "E3", "E6", "E12", "E24", "E48", "E96", "E192" | no | led-resistor (default E24) and e-series: preferred-value series. |
lengthM | number; 0..1000000000000000 | no | line-drop: one-way length in metres. |
areaMm2 | number; 0..1000000000000000 | no | line-drop: conductor cross-section in mm^2. |
resistivityOhmM | number; 0..1 | no | line-drop: conductor resistivity in ohm-metres, supplied by the caller (not looked up). |
roundTrip | boolean | no | line-drop: count out and return conductors (default true). |
maxDropPercent | number; 0..100 | no | line-drop: fail when the drop exceeds this percent of supplyVoltage. |
bands | array<string; length 0..12>; max 6 items | no | colour-decode: 3 to 6 colours read from the head end. |
bandCount | integer; 3..6 | no | colour-encode: 3, 4 (default), 5 or 6 bands. 5 and 6 bands carry three digits. |
tcrPpm | number; 0..1000 | no | colour-encode with 6 bands: temperature coefficient in ppm/K. |
claim | object | no | Optional map from an output value name (e.g. resistance, vout, minResistance) to the number you expect. |
claimTolerancePct | number; 0..100 | no | Relative 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.
| Field | Type | Required | Description |
|---|---|---|---|
status | string; one of "pass", "fail", "unknown", "unsupported" | no | pass: 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. |
operation | string | no | |
values | object | no | Named 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. |
bands | array<string> | no | colour-decode: the normalised colour names. colour-encode: the colours to print, head end first. Omitted for other ops. |
roles | array<string> | no | colour-decode: the meaning assigned to each band position. Omitted for other ops. |
witnesses | array<object> | no | |
versions | object | no | Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile). |
limits | array<string> | no | |
deterministic | boolean | no | Always 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
- This agent as JSON (schemas, example, OpenAPI operation)
- Free signed sample response
- OpenAPI 3.1 · Catalog · Index of every agent