A voltage amplifier produces an output voltage directly. The LM13700 produces an output current whose sensitivity to the input depends on a separate bias current. Add a resistor to turn that current back into voltage, then measure two effects on the same circuit. Changing bias should change the small-signal gain. Increasing the input amplitude at fixed bias should reduce the gain of the fundamental, even while the output remains close to ground and far from either supply rail.
The circuit is a bench exercise in controlling audio gain. It uses one measured 100 Hz sine at a time. The example traces and values are calculated or synthetic, and the Python program was exercised on generated data.
Before connecting any input or output cables, connect the RIGOL DHO804's rear Ground Terminal to earth ground using the supplied ground cable, as required by the DHO800 User Guide. Its Type-C power input does not ground the instrument through the power cord. Use the supplied power adapter. Keep the AFG1022 and SPD3303X protective earth connections intact. The generator cable shield and probe ground clips share G0 as described below; they do not replace this required chassis earth lead.
Use Texas Instruments LM13700MX/NOPB in the 16-pin small-outline integrated circuit package (SOIC, drawing D) on a matching breakout. Find the package's pin-1 marking. Viewed from above, numbers run counterclockwise from pin 1. This operational transconductance amplifier (OTA) converts the voltage difference between its two inputs into output current. Transconductance, written gm, has units of amperes per volt, also called siemens (S).
The bias pin sits approximately two base-emitter junction drops above the negative rail. With about 13.8 V across R4 and R5 together, the nominal bias currents are 13.8 V ÷ 151 kΩ = 91.4 µA and 13.8 V ÷ 40 kΩ = 345 µA. Use the voltage across R4 to determine the current in each run. The exact bias point varies with the device and temperature.
In the ideal unlinearized differential pair, the bias current splits into two branch currents. Subtracting those branch currents gives the model IOUT ≈ IABC × tanh[VDIFF ÷ (2VT)], where VT is about 26 mV at 25 °C and tanh is the hyperbolic tangent. At very small input, the local slope is approximately gm ≈ 19.2 × IABC at that temperature. The 1.00 kΩ load thus gives nominal gains of about 1.76 and 6.62 V/V. Their ratio is about 3.78. TI gives typical 9.6 mS and a 6.7–13 mS range in the electrical table at 500 µA under its specified conditions. Those values provide context for the model rather than a unit-specific gain at the two chosen currents.
When the sine approaches or exceeds about 52 mV peak, the differential pair steers most of the bias into one branch near each crest. The voltage across 1 kΩ then grows more slowly with increasing input. With a nominal 170 mV peak-to-peak sine and 345 µA of bias, the ideal fundamental gain is about 64% of the small-input gain, with a third harmonic about 13.5% of the fundamental. The ideal output-current scale at high bias is about 0.345 mA, giving a few tenths of a volt across 1 kΩ. The actual peak-output rating at 500 µA has its own short-circuit test conditions. Check that the measured waveforms retain headroom and that the generator and oscilloscope themselves show no clipping. The fixture deliberately leaves the linearizing diode inputs open and uses a resistive bench load.
| Capture | R5 | CH1 swing |
|---|---|---|
| Low bias | 150 kΩ | 8–12 mVpp |
| High bias | 39 kΩ | 8–12 mVpp |
| Large input | 39 kΩ | 150–200 mVpp |
| Restore | 39 kΩ | 8–12 mVpp |
time_s,vin_v,vout_v. Convert to seconds and volts, preserve sample order and use the scope's roughly uniform native samples. Use low-small.csv, high-small.csv, high-large.csv, and restore.csv. Do not normalize voltage, change time units without conversion, resample or use a screen export in place of the memory capture. Record the four R4 drop readings in millivolts in the bias worksheet.Download the blank bias worksheet, Python program or archive with example traces and tests. Use Python 3.8 or later and the standard library. The console command takes the measured bias worksheet first, then the four trace files. The included synthetic/ examples contain generated, slightly unevenly sampled waveforms.
python3 ota_gain.py bias.csv low-small.csv high-small.csv high-large.csv restore.csv
python3 ota_gain.py synthetic/bias.csv synthetic/low-small.csv synthetic/high-small.csv synthetic/high-large.csv synthetic/restore.csv
The analyzer interpolates rising crossings at the midpoint between the input extrema, then estimates frequency from the median interval. It discards the outer crossing intervals and fits a DC term and the first three harmonics to each signal by least squares, weighting each retained native sample once. Gain is the ratio of the two fundamental amplitudes. The program reports source frequency, input peak-to-peak amplitude of the fitted fundamental, bias, gain and the output third harmonic as a percentage of the output fundamental. The fit screens source distortion, phase, offset and residual energy. It screens raw input/output extrema at ±0.12 V and ±0.75 V respectively, independently of the fitted components. It cannot establish total harmonic distortion over all frequencies or prove an internal saturation mechanism from the trace alone.
The comparison accepts a low bias indication of 70–115 mV and high indications of 280–430 mV, with the three high readings within 5% of the initial high reading. The small-input gain ratio must track the bias ratio to within 20%. At fixed high bias, the larger input must give 40–82% of the small-input gain and an output third harmonic of 5–35%. The restored gain must return within 8%. These are the fixture's comparison ranges. They account for plausible nonideal data without serving as TI production limits.
Exit 0 qualifies the comparison. Exit 1 reports invalid input format or an unreadable file. Exit 2 indicates that one or more checks could not qualify the experiment. Check source distortion before interpreting harmonics. If bias changes during the large capture, inspect the meter polarity, supply mode and resistor joints. If the restore run fails, verify its actual input amplitude, probe scaling, load and timing first.
#!/usr/bin/env python3
"""Compare four measured LM13700 sine captures and bias-sense readings."""
import argparse
import csv
import io
import math
import statistics
from dataclasses import dataclass
from pathlib import Path
MODES = ("low-small", "high-small", "high-large", "restore")
ROUNDING = 1e-9
class Unresolved(ValueError):
"""A readable capture failed the experiment's controls."""
def within(value, minimum, maximum):
return minimum - ROUNDING <= value <= maximum + ROUNDING
def records(path, header, maximum):
with path.open("rb") as stream:
data = stream.read(1048577)
if len(data) > 1048576:
raise ValueError(f"{path}: CSV exceeds 1 MiB")
table = csv.reader(io.StringIO(data.decode("utf-8-sig"), newline=""), strict=True)
if next(table, None) != list(header):
raise ValueError(f"{path}: expected {','.join(header)}")
for index, row in enumerate(table, 1):
if index > maximum or len(row) != len(header):
raise ValueError(f"{path}: too many data rows or incorrect field count")
yield row
def finite_numbers(row):
numbers = tuple(map(float, row))
if not all(math.isfinite(value) for value in numbers):
raise ValueError("CSV contains a nonfinite number")
return numbers
def read_bias(path):
rows = list(records(path, ("condition", "sense_mv"), 4))
if [row[0] for row in rows] != list(MODES):
raise ValueError("bias.csv needs four conditions in experiment order")
return [finite_numbers(row[1:])[0] for row in rows]
def rising_edges(rows):
inputs = [row[1] for row in rows]
midpoint = (min(inputs) + max(inputs)) / 2
edges = []
for (a, va, _), (b, vb, _) in zip(rows, rows[1:]):
if va < midpoint <= vb:
edges.append(a + (b - a) * (midpoint - va) / (vb - va))
return edges
def solve(matrix, target):
rows = [values + [value] for values, value in zip(matrix, target)]
for col in range(len(rows)):
pivot = max(range(col, len(rows)), key=lambda index: abs(rows[index][col]))
rows[pivot], rows[col] = rows[col], rows[pivot]
scale = rows[col][col]
if abs(scale) < 1e-8:
raise Unresolved("waveform fit is singular")
rows[col] = [value / scale for value in rows[col]]
for index, row in enumerate(rows):
if index != col:
weight = row[col]
rows[index] = [value - weight * reference for value, reference in zip(row, rows[col])]
return [row[-1] for row in rows]
@dataclass(frozen=True)
class Spectrum:
fundamental: float
second_ratio: float
third_ratio: float
residual_ratio: float
phase: float
offset: float
@property
def disturbance(self):
return max(self.second_ratio, self.third_ratio, self.residual_ratio)
def spectrum(basis, matrix, values):
target = [sum(coef * value for coef, value in zip(column, values)) for column in zip(*basis)]
coefficients = solve(matrix, target)
dc, sine, cosine, sine2, cosine2, sine3, cosine3 = coefficients
peak = math.hypot(sine, cosine)
if peak < 0.0001:
raise Unresolved("fundamental amplitude is too small")
residual_sq = sum(
(actual - sum(c * v for c, v in zip(coefficients, trig))) ** 2
for actual, trig in zip(values, basis)
)
return Spectrum(
peak, math.hypot(sine2, cosine2) / peak, math.hypot(sine3, cosine3) / peak,
math.sqrt(2 * residual_sq / len(values)) / peak, math.atan2(cosine, sine), dc
)
def fit_trace(path):
rows = [finite_numbers(row) for row in records(path, ("time_s", "vin_v", "vout_v"), 20000)]
if len(rows) < 250:
raise Unresolved("capture needs at least 250 samples")
if any(abs(time) > 5 or abs(vi) > 0.12 or abs(vo) > 0.75 for time, vi, vo in rows):
raise Unresolved("capture exceeds ±5 s, ±0.12 V input or ±0.75 V output")
if any(not 0 < b[0] - a[0] <= 0.0002 + ROUNDING for a, b in zip(rows, rows[1:])):
raise Unresolved("sample times must increase with gaps no greater than 0.20 ms")
edges = rising_edges(rows)
if not 8 <= len(edges) <= 32:
raise Unresolved("capture needs 8–32 observed rising input-midpoint crossings")
intervals = [b - a for a, b in zip(edges, edges[1:])]
period = statistics.median(intervals)
frequency = 1 / period
if not within(frequency, 98, 102) or any(not within(value / period, .98, 1.02) for value in intervals):
raise Unresolved("input periods are unstable or outside 98–102 Hz")
origin, stop = edges[1], edges[-2]
window = [row for row in rows if origin <= row[0] < stop]
basis = []
for time, _, _ in window:
angle = math.tau * frequency * (time - origin)
basis.append([1.0, *(fn(harmonic * angle) for harmonic in (1, 2, 3) for fn in (math.sin, math.cos))])
columns = list(zip(*basis))
matrix = [[sum(a * b for a, b in zip(left, right)) for right in columns] for left in columns]
vin = spectrum(basis, matrix, [row[1] for row in window])
vout = spectrum(basis, matrix, [row[2] for row in window])
return frequency, vin, vout
def require(value, low, high, label):
if not within(value, low, high):
raise Unresolved(label)
def compare(traces, biases):
require(biases[0], 70, 115, "low bias must be 70–115 mV across the 1 kΩ sense resistor")
for value in biases[1:]:
require(value, 280, 430, "high bias must be 280–430 mV across the 1 kΩ sense resistor")
require(value / biases[1], .95, 1.05, "high bias did not stay within 5%")
gains = []
for mode, (frequency, vin, vout), bias in zip(MODES, traces, biases):
bounds = (150, 200) if mode == "high-large" else (8, 12)
require(2000 * vin.fundamental, *bounds, f"{mode}: differential input amplitude is out of band")
require(abs(vin.offset), 0, .005, f"{mode}: generator DC offset exceeds 5 mV")
require(vin.disturbance, 0, .035, f"{mode}: source waveform has excessive distortion")
require(abs(vout.offset), 0, .12, f"{mode}: output DC offset exceeds 0.12 V")
phase = math.remainder(vout.phase - vin.phase, math.tau)
require(abs(phase), 0, math.radians(15), f"{mode}: fundamental phase mismatch")
gain = vout.fundamental / vin.fundamental
gains.append(gain)
if mode == "high-large":
require(vout.third_ratio, .05, .35, "large-input third harmonic is outside 5–35%")
require(max(vout.second_ratio, vout.residual_ratio), 0, .15, "large-input waveform lacks a clean comparison")
else:
require(vout.disturbance, 0, .08, f"{mode}: small-input waveform distortion exceeds 8%")
require(gain / (.0192 * bias), .55, 1.50, f"{mode}: small-signal gain disagrees with model envelope")
print(f"{mode:<11} {frequency:7.3f} {2000 * vin.fundamental:9.3f} {bias:7.2f} {gain:7.3f} {100 * vout.third_ratio:7.3f}")
require((gains[1] / gains[0]) / (biases[1] / biases[0]), .80, 1.20,
"small-input gain ratio does not track the bias-current ratio within 20%")
require(gains[2] / gains[1], .40, .82, "large-input fundamental gain is not 40–82% of small-input high-bias gain")
require(gains[3] / gains[1], .92, 1.08, "restored small-input gain did not return within 8%")
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("bias_csv", type=Path)
for mode in MODES:
parser.add_argument(mode.replace("-", "_"), type=Path)
args = parser.parse_args()
try:
biases = read_bias(args.bias_csv)
traces = [fit_trace(getattr(args, mode.replace("-", "_"))) for mode in MODES]
print("condition Hz vin_mV_pp bias_uA gain out_H3%")
compare(traces, biases)
except Unresolved as error:
print(f"UNRESOLVED: {error}")
return 2
except (ValueError, OSError, csv.Error) as error:
print(f"INPUT ERROR: {error}")
return 1
print("QUALIFIED: bias changes the small-input gain; a larger input compresses it.")
return 0
if __name__ == "__main__":
raise SystemExit(main())
With sufficient output voltage headroom, a larger resistor converts the same current into a larger voltage. In the ideal model it doubles the fundamental voltage and the harmonic voltages together. The same curvature remains in the input-to-current transfer. A real larger load can also make output compliance matter, so compare the load voltage and the input at unchanged bias to check the result.