# Single-Pole Operational Amplifier (`opAmp`)

> Amplifies a small input difference, with limited speed and output swing.

![opAmp](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/opAmp.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/ic/opAmp/)

**Group:** ICs · **Kind:** `{"definition":"opAmp","kind":"subsystem"}`

## When to use it

Use it for error amplifiers, filters and level shifting. Use Current-Sense Amplifier on a shunt, and Comparator with Hysteresis for a logic output.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `INP` | electrical | Non-inverting input, draws only ib (0 by default) |
| `INN` | electrical | Inverting input, draws only ib (0 by default) |
| `OUT` | electrical | Output, measured against circuit ground |
| `VCC` | electrical | Positive supply, sets the top of the output |
| `VEE` | electrical | Negative supply, sets the bottom of the output |

## Common parameters

- `gbw`: Gain-bandwidth product (single pole at GBW / a0) (Default: 1200000)
- `a0`: DC open-loop gain (Default: 140000)
- `sr`: Slew rate (0.5 V/us) (Default: 500000)
- `vos`: Input offset voltage (the datasheet gives it as +/-) (Default: 0.0003)

## Parameters

| Key | Unit | Default | Typical range | Description | Datasheet source |
|---|---|---|---|---|---|
| `a0` | V/V | 140000 | 10 – 1g V/V | DC open-loop gain | Section 5.5 AOL typ 140 V/mV (VS = 15 V, RL >= 10 kOhm), p.6 |
| `gbw` | Hz | 1200000 | 1k – 10g Hz | Gain-bandwidth product (single pole at GBW / a0) | Section 5.5 GBW typ, p.6 |
| `sr` | V/s | 500000 | 1k – 10g V/s | Slew rate (0.5 V/us) | Section 5.5 SR typ (G = +1), p.6 |
| `vos` | V | 0.0003 | -100m – 100m V | Input offset voltage (the datasheet gives it as +/-) | Section 5.5 VOS typ +/-0.3 mV (LM358B), p.6 |
| `headHi` | V | 1.35 | 0 – 20 V | Output swing below the positive rail | Section 5.5 VO positive rail, IOUT = 50 uA, p.6 |
| `headLo` | V | 0.1 | 0 – 20 V | Output swing above the negative rail | Section 5.5 VO negative rail, IOUT = 50 uA, p.6 |
| `rOut` | Ω | 300 | 0 – 1meg Ω | Output resistance (0 = ideal output) | Section 5.5 RO open-loop output resistance typ, p.6 |
| `pm` | ° | 0 | 0 – 85 ° | Phase margin at unity gain, set by a second pole (0 = single pole) | Off by default, so results stay those of the single-pole model |
| `cmrr` | dB | 0 | 0 – 200 dB | Common-mode rejection ratio (0 = ideal, no common-mode error) | Off by default, so results stay those of the single-pole model |
| `ib` | A | 0 | -1m – 1m A | Input bias current drawn by each input (positive into the pin) | Off by default, so results stay those of the single-pole model |

_Parameter descriptions are in English in both languages._

## Model

The internal state y follows dy/dt = 2*pi*gbw*(Vid + vos) - (2*pi*gbw / a0) * y, which is a single pole at gbw / a0 with DC gain a0. The rate is limited to plus or minus sr. The state stops integrating while it is beyond a rail and still pushed outward, so there is no wind-up and recovery is immediate. The output is y clamped to VEE + headLo ... VCC - headHi, behind rOut. Three options are off by default. pm (degrees) adds a second pole in front of the first one, placed so a follower has that phase margin: fc = gbw*cos(90 - pm) and fp2 = fc / tan(90 - pm). cmrr (dB) adds the common-mode voltage divided by the CMRR to Vid. ib draws a current from each input net. The common-mode range, noise and the supply current are not modelled, and the phase margin does not fall with a capacitive load.

## Common mistakes

- The output cannot reach the supply rails, since it stops 1.35 V below VCC and 0.1 V above VEE by default. A circuit that needs 14.5 V from a 15 V supply is clipped.
- The output reaches the circuit one to two solver steps late. Keep the step well below one two-hundredth of the period of the highest closed-loop bandwidth, or the bandwidth is off by more than a few percent.
- By default the model is a clean single pole, so a compensator designed near the op-amp bandwidth looks better than it is. Set pm (or use a preset such as TLV9062, which sets pm 55) when the loop crossover is within a decade of gbw.
- The offset vos has one sign, while the datasheet gives plus or minus. Try both signs for a worst-case run, and enter gbw and sr with unit prefixes such as 1.2meg.

Problems rules: `step.too_large`, `param.out_of_range`

## Datasheet and sources

a0 is the typical open-loop gain, converted from V/mV to V/V (140 V/mV is 1.4e5). gbw is the gain-bandwidth product, and sr is the slew rate in V/s (0.5 V/us is 0.5e6). vos is the typical input offset. headHi and headLo are how far the output stays from each rail at the light load in the table, and rOut is the open-loop output resistance. pm is the phase margin row (G = +1), cmrr the CMRR row in dB and ib the typical input bias current; leave pm at 0 when the table gives no phase margin. Pass them to ic.fromSpec with the opAmp template and rename the pins to the datasheet names.

## Example

Open the example with the command `file.openExample` and the name `demo:opAmp`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
