← All tutorials · Ohmforge

Tutorial 9 of 9

Battery budgets, tolerance spreads and the component tools by API

Intermediate 9 min

Estimate battery runtime from duty cycles, sample resistor tolerances in a divider, and call the connectivity, PCB and component-code tools from scripts or AI agents.

Besides the simulator, Ohmforge ships seven smaller engineering tools. Each has a form on its own tool page, a JSON API on the Ohmforge host and an MCP tool for AI agents, and the component dialogs in the workbench use the same code.

Plan a battery budget

Open the Battery Power Budget Planner. Enter one load per line: name, active current (mA), sleep current (mA) and the share of time it is active (%):

Controller,20,0.1,10
Sensor,5,0.01,5

With a 2000 mAh battery of which 80 % is usable, the controller averages 20 × 0.10 + 0.1 × 0.90 = 2.09 mA and the sensor 0.2595 mA. The total of 2.3495 mA gives 681 hours (28.4 days). Enter battery-side currents: a regulator's quiescent current and conversion losses belong in the list, and real capacity drops in the cold and at high discharge rates.

Sample resistor tolerances

A 10 V divider with two 1 kΩ resistors gives 5 V on paper. Open Resistor Tolerance Analysis, keep the netlist

Divider
V1 in 0 10
R1 in out 1k
R2 out 0 1k
.op

and enter R1,5 and R2,5 as tolerances, 100 samples and seed 1. Each sample draws both resistors uniformly within ±5 % and solves the DC operating point. The output ranged from 4.7971 V to 5.2297 V with a mean of 4.9875 V. The same seed always gives the same samples, so you can compare designs fairly. Sampled extremes are not guaranteed worst-case bounds; a true worst case can lie slightly outside them.

Call the tools from a script

Every tool answers POST https://ohmforge.usefulweb.site/api/v1/tools/<id>/calculate with a JSON body of its inputs, and the Ohmforge MCP endpoint https://ohmforge.usefulweb.site/mcp lists the same tools for agents:

ToolAPI idMCP name
Schematic connectivity reviewohmforge-connectivity-reviewohmforge_connectivity_review
PCB trace estimatorohmforge-pcb-trace-estimatorohmforge_pcb_trace_estimator
PCB via estimatorohmforge-pcb-via-estimatorohmforge_pcb_via_estimator
Resistor color codeohmforge-resistor-color-codeohmforge_resistor_color_code
Capacitor codeohmforge-capacitor-codeohmforge_capacitor_code
Battery power budgetohmforge-power-budgetohmforge_power_budget
Resistor tolerance analysisohmforge-component-toleranceohmforge_component_tolerance

For example, {"mode":"encode","bandCount":"5","ohms":4990,"tolerance":"brown"} sent to the resistor tool returns yellow, white, white, brown, brown, 4.99 kΩ ±1 % and preferredSeries: ["E96","E192"]. The connectivity review takes a saved .ohmforge.json project as text in its project field and returns every finding with its part, pin, wire and grid position.

Responses use the usual envelope: a short summary, the structured result, units, assumptions, warnings and the presentation blocks you see on the tool page. Keep an eye on warnings: the trace estimator, for example, flags inputs outside the IPC-2221 chart range instead of failing silently.

Ready to try it?

Launch Ohmforge →