# Electronics Calculator (`mangudai/electronics-calculator`) Actor

Run the everyday electronics calculations and get a clean table back. Ohm's law and the power wheel, resistor color codes both ways, LED series resistors, voltage dividers, series and parallel networks, RC and RL time constants, reactance with LC resonance, and energy cost. Offline, no API key.

- **URL**: https://apify.com/mangudai/electronics-calculator.md
- **Developed by:** [Mangudäi](https://apify.com/mangudai) (community)
- **Categories:** Developer tools, Automation, Open source
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Electronics Calculator

Run the everyday electronics calculations in one place and get a clean table back. Ohm's law and the power wheel, resistor color codes both ways, the series resistor for an LED, voltage dividers, series and parallel networks, RC and RL time constants, reactance with LC resonance, and the running cost of a load. It is pure offline math with the Python standard library, so there is no API key, no rate limit, and nothing to break.

Values accept plain numbers, SI prefixes, and RKM notation. You can write `4700`, `4.7k`, `4k7`, `100n`, `2R2`, `10mH`, or `1M5` and each is read correctly.

### What it calculates

Each calculation you pass has a `type`. These are the eight types and the fields each one reads.

**ohms-law**: give any two of `voltage` (V), `current` (A), `resistance` (Ω), `power` (W). It returns all four, so two knowns fill in the rest.

**resistor-color-code**: pass `bands` as a list of 3, 4, 5, or 6 colors to decode a resistor into its value and tolerance. Or pass a `resistance` and a `bandCount` (4 or 5) to encode a value into its color bands. Encoding also reads an optional `toleranceColor` (default gold).

**led-resistor**: give `supplyVoltage`, `ledForwardVoltage`, `ledCurrentMa`, and `numberOfLeds` in series. It returns the exact series resistor, the nearest E24 standard value, the power the resistor dissipates, and a suggested power rating.

**voltage-divider**: give `vin`, `r1`, and `r2` for the output voltage and current. Add `loadResistance` to also see the loaded output.

**component-network**: give a `componentType` (resistor, capacitor, or inductor), a `connection` (series or parallel), and a `values` list. It applies the right rule for each, since capacitors add in parallel and resistors add in series.

**rc-filter**: give a `resistance` with either a `capacitance` (RC) or an `inductance` (RL). It returns the time constant, the 5-tau settling time, and the cutoff frequency.

**reactance**: give a `frequency` with a `capacitance` and/or an `inductance` for capacitive and inductive reactance. Give both L and C for the resonant frequency.

**energy-cost**: give `power` (or `voltage` and `current`) with a time as `hours`, or as `hoursPerDay` and `days`. Add an `energyRate` per kWh and a `currency` for the cost.

Every calculation takes an optional `label` that is copied to the output row so you can tell the rows apart.

### Input

The input is a single `calculations` array. One object per calculation, any mix of types in one run. The default input holds one example of every type, so a run with no changes shows what each looks like.

```json
{
  "calculations": [
    { "type": "ohms-law", "voltage": 12, "current": 0.5, "label": "12 V at 0.5 A" },
    { "type": "resistor-color-code", "bands": ["yellow", "violet", "red", "gold"] },
    { "type": "led-resistor", "supplyVoltage": 5, "ledForwardVoltage": 2.0, "ledCurrentMa": 20 },
    { "type": "rc-filter", "resistance": "10k", "capacitance": "100n" }
  ]
}
```

### Output

One row per calculation. The overview table shows the type, your label, a short summary of the inputs, the headline answer, and a one-line result. Every row also carries the full set of numeric fields for that type, for example `resistance`, `power`, `tolerancePercent`, `cutoffFrequency`, `resonantFrequency`, or `cost`, plus a formatted version of each with its unit.

A calculation that cannot be solved, such as Ohm's law with only one value or an LED supply below the forward voltage, returns a row with `ok` set to false and a plain `error` message. One bad calculation never stops the rest of the run.

Example row for the LED resistor above:

```json
{
  "calculationType": "led-resistor",
  "label": "",
  "result": "use 150 Ω (calc 150 Ω), dissipating 60 mW",
  "primaryFormatted": "150 Ω",
  "ok": true,
  "resistance": 150.0,
  "nearestStandard": 150.0,
  "resistorPower": 0.06,
  "recommendedPowerRating": 0.125,
  "actualCurrentMa": 20.0
}
```

### Notes

The results are engineering calculations for design and study. Real parts carry tolerance, temperature drift, and parasitics, so treat the numbers as a starting point and check anything safety related against the component datasheets.

# Actor input Schema

## `calculations` (type: `array`):

Each item is one calculation. Set "type" to one of: ohms-law, resistor-color-code, led-resistor, voltage-divider, component-network, rc-filter, reactance, energy-cost. Values accept SI prefixes and RKM notation, for example 4.7k, 4k7, 100n, 2R2, 10mH. See the README for the fields each type takes.

## Actor input object example

```json
{
  "calculations": [
    {
      "type": "ohms-law",
      "voltage": 12,
      "current": 0.5,
      "label": "12 V at 0.5 A"
    },
    {
      "type": "resistor-color-code",
      "bands": [
        "yellow",
        "violet",
        "red",
        "gold"
      ],
      "label": "Decode a 4-band resistor"
    },
    {
      "type": "resistor-color-code",
      "resistance": "4.7k",
      "bandCount": 5,
      "label": "Encode 4.7 kohm to 5 bands"
    },
    {
      "type": "led-resistor",
      "supplyVoltage": 5,
      "ledForwardVoltage": 2,
      "ledCurrentMa": 20,
      "numberOfLeds": 1,
      "label": "Series resistor for a red LED"
    },
    {
      "type": "voltage-divider",
      "vin": 9,
      "r1": "10k",
      "r2": "4.7k",
      "label": "9 V divider"
    },
    {
      "type": "component-network",
      "componentType": "resistor",
      "connection": "parallel",
      "values": [
        "10k",
        "10k"
      ],
      "label": "Two 10 kohm in parallel"
    },
    {
      "type": "rc-filter",
      "resistance": "10k",
      "capacitance": "100n",
      "label": "RC low-pass cutoff"
    },
    {
      "type": "reactance",
      "frequency": "1k",
      "inductance": "10m",
      "capacitance": "100n",
      "label": "Reactance and LC resonance"
    },
    {
      "type": "energy-cost",
      "power": 60,
      "hours": 720,
      "energyRate": 0.15,
      "currency": "USD",
      "label": "60 W load for a month"
    }
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "calculations": [
        {
            "type": "ohms-law",
            "voltage": 12,
            "current": 0.5,
            "label": "12 V at 0.5 A"
        },
        {
            "type": "resistor-color-code",
            "bands": [
                "yellow",
                "violet",
                "red",
                "gold"
            ],
            "label": "Decode a 4-band resistor"
        },
        {
            "type": "resistor-color-code",
            "resistance": "4.7k",
            "bandCount": 5,
            "label": "Encode 4.7 kohm to 5 bands"
        },
        {
            "type": "led-resistor",
            "supplyVoltage": 5,
            "ledForwardVoltage": 2,
            "ledCurrentMa": 20,
            "numberOfLeds": 1,
            "label": "Series resistor for a red LED"
        },
        {
            "type": "voltage-divider",
            "vin": 9,
            "r1": "10k",
            "r2": "4.7k",
            "label": "9 V divider"
        },
        {
            "type": "component-network",
            "componentType": "resistor",
            "connection": "parallel",
            "values": [
                "10k",
                "10k"
            ],
            "label": "Two 10 kohm in parallel"
        },
        {
            "type": "rc-filter",
            "resistance": "10k",
            "capacitance": "100n",
            "label": "RC low-pass cutoff"
        },
        {
            "type": "reactance",
            "frequency": "1k",
            "inductance": "10m",
            "capacitance": "100n",
            "label": "Reactance and LC resonance"
        },
        {
            "type": "energy-cost",
            "power": 60,
            "hours": 720,
            "energyRate": 0.15,
            "currency": "USD",
            "label": "60 W load for a month"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("mangudai/electronics-calculator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "calculations": [
        {
            "type": "ohms-law",
            "voltage": 12,
            "current": 0.5,
            "label": "12 V at 0.5 A",
        },
        {
            "type": "resistor-color-code",
            "bands": [
                "yellow",
                "violet",
                "red",
                "gold",
            ],
            "label": "Decode a 4-band resistor",
        },
        {
            "type": "resistor-color-code",
            "resistance": "4.7k",
            "bandCount": 5,
            "label": "Encode 4.7 kohm to 5 bands",
        },
        {
            "type": "led-resistor",
            "supplyVoltage": 5,
            "ledForwardVoltage": 2,
            "ledCurrentMa": 20,
            "numberOfLeds": 1,
            "label": "Series resistor for a red LED",
        },
        {
            "type": "voltage-divider",
            "vin": 9,
            "r1": "10k",
            "r2": "4.7k",
            "label": "9 V divider",
        },
        {
            "type": "component-network",
            "componentType": "resistor",
            "connection": "parallel",
            "values": [
                "10k",
                "10k",
            ],
            "label": "Two 10 kohm in parallel",
        },
        {
            "type": "rc-filter",
            "resistance": "10k",
            "capacitance": "100n",
            "label": "RC low-pass cutoff",
        },
        {
            "type": "reactance",
            "frequency": "1k",
            "inductance": "10m",
            "capacitance": "100n",
            "label": "Reactance and LC resonance",
        },
        {
            "type": "energy-cost",
            "power": 60,
            "hours": 720,
            "energyRate": 0.15,
            "currency": "USD",
            "label": "60 W load for a month",
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("mangudai/electronics-calculator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "calculations": [
    {
      "type": "ohms-law",
      "voltage": 12,
      "current": 0.5,
      "label": "12 V at 0.5 A"
    },
    {
      "type": "resistor-color-code",
      "bands": [
        "yellow",
        "violet",
        "red",
        "gold"
      ],
      "label": "Decode a 4-band resistor"
    },
    {
      "type": "resistor-color-code",
      "resistance": "4.7k",
      "bandCount": 5,
      "label": "Encode 4.7 kohm to 5 bands"
    },
    {
      "type": "led-resistor",
      "supplyVoltage": 5,
      "ledForwardVoltage": 2,
      "ledCurrentMa": 20,
      "numberOfLeds": 1,
      "label": "Series resistor for a red LED"
    },
    {
      "type": "voltage-divider",
      "vin": 9,
      "r1": "10k",
      "r2": "4.7k",
      "label": "9 V divider"
    },
    {
      "type": "component-network",
      "componentType": "resistor",
      "connection": "parallel",
      "values": [
        "10k",
        "10k"
      ],
      "label": "Two 10 kohm in parallel"
    },
    {
      "type": "rc-filter",
      "resistance": "10k",
      "capacitance": "100n",
      "label": "RC low-pass cutoff"
    },
    {
      "type": "reactance",
      "frequency": "1k",
      "inductance": "10m",
      "capacitance": "100n",
      "label": "Reactance and LC resonance"
    },
    {
      "type": "energy-cost",
      "power": 60,
      "hours": 720,
      "energyRate": 0.15,
      "currency": "USD",
      "label": "60 W load for a month"
    }
  ]
}' |
apify call mangudai/electronics-calculator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=mangudai/electronics-calculator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/If806jzDfn6dMFuub/builds/BrulSCQL3de6oaQaF/openapi.json
