# Wheatstone Bridge API
> Wheatstone-bridge and strain-gauge maths as an API, computed locally and deterministically. The bridge endpoint takes the four arm resistances R1–R4 and an excitation voltage and returns the bridge output voltage between the two midpoints, Vout = Vin·(R2/(R1+R2) − R4/(R3+R4)), in volts and millivolts, the voltage at each midpoint, and whether the bridge is balanced (Vout = 0 when R1·R4 = R2·R3). The balance endpoint inverts it: give any three arms and it solves the fourth resistance that balances the bridge, the classic way a Wheatstone bridge measures an unknown resistance. The strain endpoint models a strain-gauge bridge — quarter, half or full — and converts in both directions between mechanical strain and electrical output: from a gauge factor and a strain (given directly, as microstrain or as a relative resistance change ΔR/R = GF·ε) it returns the output ratio and voltage Vout/Vin = (k/4)·GF·ε where k is the number of active arms, and from an output voltage and excitation it returns the strain and microstrain. Everything is computed locally and deterministically, so it is instant and private. Ideal for instrumentation and sensor tools, load-cell, pressure-sensor and RTD measurement design, strain-gauge and data-acquisition apps, and electronics education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is bridge and strain-gauge measurement; for Ohm's law, voltage dividers and series/parallel resistor combinations use an Ohm's-law API.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/wheatstone-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 25,000 calls/Mo, 8 req/s
- **Pro** ($24/Mo) — 150,000 calls/Mo, 25 req/s
- **Mega** ($74/Mo) — 769,000 calls/Mo, 80 req/s

## Endpoints

### Wheatstone

#### `GET /v1/balance` — Solve the balancing arm

**Parameters:**
- `r1` (query, optional, string) — Arm R1 (Ω) Example: `1000`
- `r2` (query, optional, string) — Arm R2 (Ω) Example: `2000`
- `r3` (query, optional, string) — Arm R3 (Ω) Example: `1500`
- `r4` (query, optional, string) — Arm R4 (Ω) — omit exactly one

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/wheatstone-api/v1/balance?r1=1000&r2=2000&r3=1500"
```

**Response:**
```json
{
    "data": {
        "known": {
            "r1": 1000,
            "r2": 2000,
            "r3": 1500
        },
        "formula": "At balance R1·R4 = R2·R3, so the unknown arm follows from the other three.",
        "unknown_arm": "r4",
        "balanced_resistance_ohm": 3000
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:53.778Z",
        "request_id": "24089ee0-faf9-46c4-acab-d6d6cc27ff16"
    },
    "status": "ok",
    "message": "Solve the balancing arm",
    "success": true
}
```

#### `GET /v1/bridge` — Bridge output voltage

**Parameters:**
- `r1` (query, required, string) — Arm R1 (Ω) Example: `1000`
- `r2` (query, required, string) — Arm R2 (Ω) Example: `1000`
- `r3` (query, required, string) — Arm R3 (Ω) Example: `1000`
- `r4` (query, required, string) — Arm R4 (Ω) Example: `1010`
- `excitation` (query, required, string) — Excitation voltage (V) Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/wheatstone-api/v1/bridge?r1=1000&r2=1000&r3=1000&r4=1010&excitation=10"
```

**Response:**
```json
{
    "data": {
        "r1": 1000,
        "r2": 1000,
        "r3": 1000,
        "r4": 1010,
        "formula": "Vout = Vin·(R2/(R1+R2) − R4/(R3+R4)); balanced when R1·R4 = R2·R3.",
        "balanced": false,
        "v_left_v": 5,
        "v_right_v": 5.02487562,
        "excitation_v": 10,
        "output_voltage_v": -0.0248756219,
        "output_voltage_mv": -24.87562189,
        "balance_product_left": 1010000,
        "balance_product_right": 1000000
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:53.864Z",
        "request_id": "0457c01d-6c91-4536-a7da-7c4091b37417"
    },
    "status": "ok",
    "message": "Bridge output voltage",
    "success": true
}
```

#### `GET /v1/strain` — Strain-gauge bridge output

**Parameters:**
- `bridge_type` (query, optional, string) — quarter|half|full (default quarter) Example: `quarter`
- `gauge_factor` (query, required, string) — Gauge factor (e.g. 2.0) Example: `2.0`
- `strain` (query, optional, string) — Strain ε Example: `0.001`
- `microstrain` (query, optional, string) — Or strain in µε
- `delta_r_over_r` (query, optional, string) — Or ΔR/R
- `excitation` (query, optional, string) — Excitation voltage (V) Example: `10`
- `output_voltage` (query, optional, string) — Or output voltage to back out strain

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/wheatstone-api/v1/strain?bridge_type=quarter&gauge_factor=2.0&strain=0.001&excitation=10"
```

**Response:**
```json
{
    "data": {
        "mode": "output_from_strain",
        "strain": 0.001,
        "formula": "Vout/Vin = (k/4)·GF·ε; ΔR/R = GF·ε.",
        "active_arms": 1,
        "bridge_type": "quarter",
        "microstrain": 1000,
        "excitation_v": 10,
        "gauge_factor": 2,
        "output_ratio": 0.0005,
        "delta_r_over_r": 0.002,
        "output_voltage_v": 0.005,
        "output_voltage_mv": 5,
        "output_per_volt_mv": 0.5
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:53.969Z",
        "request_id": "9316fe51-b65a-4eed-9521-4386c9974fc1"
    },
    "status": "ok",
    "message": "Strain-gauge bridge output",
    "success": true
}
```

### Meta

#### `GET /v1/meta` — Spec

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/wheatstone-api/v1/meta"
```

**Response:**
```json
{
    "data": {
        "api": "wheatstone",
        "note": "Wheatstone-bridge maths — computed locally and deterministically, no key, no third-party service.",
        "endpoints": [
            "/v1/bridge",
            "/v1/balance",
            "/v1/strain",
            "/v1/meta"
        ],
        "bridge_types": [
            "quarter",
            "half",
            "full"
        ]
    },
    "meta": {
        "timestamp": "2026-06-04T10:18:54.085Z",
        "request_id": "4652f028-ee62-43a4-83aa-26fbb91c1f9c"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


---
Marketplace page: https://www.oanor.com/api/wheatstone-api
OpenAPI spec: https://www.oanor.com/api/wheatstone-api/openapi.json
