A current source is meant to hold a steady bias current. The simplest LM334 circuit changes that current as the part warms. Its internal voltage rises with temperature. Add a silicon diode with a falling forward voltage, then measure how much drift the two voltage changes cancel.

Build both configurations with one LM334

Plain and compensated circuits for a Texas Instruments LM334Z/NOPB. Both feed a 1 kilohm sense resistor. In the compensated circuit, a 133 ohm resistor links R to V minus, a 1N457 diode leads from V minus to SENSE with its cathode band at SENSE, and a 1.33 kilohm resistor also links R to SENSE. The bottom-view inset identifies all three pins.
Build one configuration at a time with the same current source and sense resistor. The compensated circuit sends both branches through the sense resistor. Full-size PNG · Editable SVG

Use the Texas Instruments LM334Z/NOPB, the three-lead LP plastic TO-92 package. Look at the bottom, toward the leads, and orient the flat edge above them as shown. From left to right the leads are pin 1 V+, pin 2 R and pin 3 V−. Match Texas Instruments Figure 4 and the LP0003A package drawing on PDF page 28 before connecting it. V+ receives the positive supply, R sets the branch current and V− is the device's return. The printed operating range for this exact suffix is 0 to 70 °C. Use the room-temperature to moderately warm range below.

Use a SIGLENT SPD3303X independent channel at 3.50 V and a 5 mA current limit. Its negative terminal joins the circuit return, G0. Put a 1.00 kΩ, 0.1% sense resistor RS from the SENSE node to G0. Keep it outside the warm enclosure so its resistance stays near the same value in both runs.

Keep the current-setting resistor connections short and mechanically secure. Turn the supply output off before rearranging them. The diode introduces a forward drop between pin 3 and the load. Measure voltages at both V+ and V− to find the voltage left across the chip. Its datasheet gives minimum operating voltage around 0.9–1.0 V at the current levels here and specifies several regulation figures from 1.5 V upward. This experiment requires at least 1.50 V across V+ and V− at every recorded point. For example, 3.50 V at V+, 1.00 V at SENSE and a 0.60 V diode drop leave 3.50 − 1.00 − 0.60 = 1.90 V.

Why two slopes can cancel

The adjustment voltage between R and V− is about 64 mV at 25 °C and is proportional to absolute temperature. In the plain circuit the internal bias current makes the effective setting voltage about 67.7 mV. The nominal room-temperature estimate is 67.7 mV / 68 Ω ≈ 0.996 mA. Around 25 °C, a proportional-to-absolute-temperature current changes by about 1 / 298.15, or +0.335%, per degree Celsius. A 20 °C rise therefore adds about 6.7% to the plain current, before smaller circuit effects.

With the diode fitted, approximate total current as the sum of the bias-adjusted first branch and the second resistor branch. At 25 °C the first is 67.7 mV / 133 Ω ≈ 0.509 mA. A diode forward voltage of 0.60 V would give the second branch (0.064 + 0.60) V / 1.33 kΩ ≈ 0.499 mA. This gives about 1.01 mA at that assumed diode voltage. The 64 mV in the second expression is the raw R-to-V− voltage. The larger 67.7 mV in the first accounts approximately for the chip's bias current.

An illustrative diode slope of −2.5 mV/°C and the raw adjustment-voltage slope of about +0.215 mV/°C make the second branch fall by about 1.72 µA/°C. The first branch rises by about 1.71 µA/°C. Texas Instruments uses this approximation to pick a resistor ratio near ten. The onsemi datasheet gives a maximum forward voltage of 1.0 V at 20 mA for the 1N457. It gives no guaranteed forward-voltage slope at the roughly 0.5 mA branch current here. Treat cancellation as a result to measure. The diode's in-circuit slope also includes the effect of its changing branch current.

Take matched room, warm and return readings

Use a small dry insulated enclosure with room for air to circulate around the parts. For the warm stages, use a separate closed warm-water bottle or a temperature-controlled dry chamber. Keep the board dry, suspended above the warm source and away from surfaces heated directly. The supply, voltmeters and sense resistor stay outside. Never immerse the circuit. Keep the chamber at or below 53 °C for the qualified recordings.

Use a Fluke 52 II with two 80PK-1 type K thermocouples. Put one electrically insulated bead on the LM334 case and the other on the diode body. Thin polyimide tape can hold each bead in place. Verify isolation from leads before power-up. Keep the diode in the same position with both leads disconnected and insulated for the plain trial. Bring both beads together at room temperature to screen for obvious disagreement before separating them. Both readings are package-temperature proxies. Allow enough time for the two parts to equilibrate at each stage.

Park one Fluke 115 in direct-current voltage mode across SENSE and G0. A second Fluke 115 checks V+ and V− in turn against G0 at each recorded point. Use the voltage input and COM (common) sockets. Confirm the supply stays in constant-voltage mode. Leave the parked meter on the same voltage range in both runs. Its nominal DC input resistance is greater than 10 MΩ. In parallel with 1 kΩ it contributes about 0.01% to the estimated source current.

Repeat these stages for each circuit
StageTemperatureWhat to verify
room18–28 °CSENSE and both temperature readings settle.
warm39–53 °CAt least 15 °C above the reference, with adequate headroom.
return18–28 °CBack near the first temperature and current.

After equilibration, log at least three readings per stage, separated by at least 15 seconds and spanning at least 40 seconds. For example, use elapsed times 0, 20 and 40 seconds within a settled stage. Record both temperatures, V+, SENSE and V− in the blank worksheet, using volts and degrees Celsius. For the modes use plain and comp. Preserve the same warming sequence and match each stage's temperatures. If the return current is displaced or the two package readings disagree, repeat after checking contacts and temperature placement.

Calculate drift and compare the two circuits

Each stage uses the median of its settled readings. Average the room and return medians to get the reference voltage Vref and temperature Tref. Because the shunt is unchanged, the normalized current slope equals 100 × (Vwarm − Vref) / [Vref × (Twarm − Tref)] in percent per degree Celsius. Use the chip's temperature for this slope. The program separately reports the diode forward-voltage slope using the diode's own temperatures and V− − VSENSE.

Run python3 comp_drift.py observations.csv --shunt-ohm 1000. Substitute the measured unpowered shunt value if available. The script checks thermal agreement and stability, headroom, stable supply, similar room currents and the return control. It accepts a positive plain slope from 0.22 to 0.46%/°C for this fixture. The experiment's criterion is at least 50% less absolute drift in the compensated record. A small negative slope can still meet it.

Exit 0 means the qualified observations meet the reduction criterion. Exit 1 reports unresolved readings or a usable comparison with insufficient reduction, with separate messages for those outcomes. Exit 2 reports a file or CSV parsing error. The meter, thermal gradients and self-heating all contribute uncertainty. The program compares these particular records and supplies no precision temperature-coefficient guarantee. The example and host tests are synthetic. Physical measurements are left to your bench.

Challenge

The plain circuit rises 6.8% over a 20 °C span. The compensated circuit falls 1.2% over the same span. Does it meet the reduction criterion? Which change in R2 moves a negative slope toward zero?

Answer

The slopes are +0.34%/°C and −0.06%/°C. The latter has about 18% of the original magnitude, a reduction of about 82%. Increasing R2 weakens the falling branch in the approximate model. It also changes room-temperature current, so a new comparison requires new readings for all three stages.

Complete Python analyzer

Download the standalone analyzer or use the experiment archive for the editable diagram, worksheet, synthetic readings and test program.

Complete source for comp_drift.py
#!/usr/bin/env python3
"""Compare measured temperature drift of plain and compensated LM334 circuits."""

import argparse
import csv
from dataclasses import dataclass
import math
from pathlib import Path
from statistics import mean, median
import sys


MODES = ("plain", "comp")
STAGES = ("room", "warm", "return")
HEADER = ("mode", "stage", "elapsed_s", "chip_c", "diode_c", "supply_v", "sense_v", "minus_v")
ROUNDING = 1e-9


class EvidenceError(ValueError):
    """Readings do not establish a controlled thermal comparison."""


@dataclass(frozen=True)
class Reading:
    time: float
    chip: float
    diode: float
    supply: float
    sense: float
    minus: float


def require(ok, label, reason):
    if not ok:
        raise EvidenceError(f"{label}: {reason}")


def parse(rows):
    rows = iter(rows)
    require(tuple(next(rows, [])) == HEADER, "CSV", "use the exact worksheet header")
    captures = {(mode, stage): [] for mode in MODES for stage in STAGES}
    for number, row in enumerate(rows, 2):
        label = f"line {number}"
        require(number <= 61 and len(row) == 8, label, "expected eight fields and at most 60 readings")
        key = tuple(row[:2])
        require(key in captures, label, "unknown circuit mode or temperature stage")
        try:
            sample = Reading(*map(float, row[2:]))
        except ValueError as error:
            raise EvidenceError(f"{label}: enter numeric seconds, degrees Celsius and volts") from error
        require(all(math.isfinite(x) for x in (sample.time, sample.chip, sample.diode,
                                                 sample.supply, sample.sense, sample.minus)),
                label, "readings must be finite")
        captures[key].append(sample)
    return captures


def stage_means(rows, mode, stage, measured_ohm):
    label = f"{mode}/{stage}"
    require(3 <= len(rows) <= 10, label, "need at least three and no more than ten readings")
    times = [r.time for r in rows]
    require(0 <= times[0] <= times[-1] <= 3600
            and all(b - a >= 15 - ROUNDING for a, b in zip(times, times[1:])),
            label, "readings must have increasing elapsed times at least 15 seconds apart")
    require(times[-1] - times[0] >= 40 - ROUNDING, label, "capture at least 40 seconds of settled readings")
    t_min, t_max = (39, 53) if stage == "warm" else (18, 28)
    for r in rows:
        require(t_min <= r.chip <= t_max and t_min <= r.diode <= t_max
                and abs(r.chip - r.diode) <= 1.0 + ROUNDING,
                label, "temperature probes must agree within 1 °C and stay in stage range")
        require(3.47 <= r.supply <= 3.53, label, "supply must remain near 3.50 V")
        require(r.supply - r.minus >= 1.50 - ROUNDING, label, "IC headroom V+ minus V- below 1.50 V")
        require(.75 - ROUNDING <= 1000 * r.sense / measured_ohm <= 1.22 + ROUNDING, label, "shunt current outside fixture range")
        drop = r.minus - r.sense
        if mode == "plain":
            require(abs(drop) <= .025 + ROUNDING, label, "plain V- should join SENSE directly")
        else:
            require(.35 - ROUNDING <= drop <= .80 + ROUNDING, label, "unexpected forward diode voltage")
    require(max(r.chip for r in rows) - min(r.chip for r in rows) <= .50 + ROUNDING
            and max(r.diode for r in rows) - min(r.diode for r in rows) <= .50 + ROUNDING
            and max(r.sense for r in rows) - min(r.sense for r in rows) <= .003 + ROUNDING,
            label, "temperature or current stability failed")
    return {"chip": median(r.chip for r in rows), "diode": median(r.diode for r in rows),
            "sense": median(r.sense for r in rows),
            "drop": median(r.minus - r.sense for r in rows),
            "headroom": min(r.supply - r.minus for r in rows)}


def compare(captures, measured_ohm):
    require(990 <= measured_ohm <= 1010, "fixture", "shunt must be close to 1000 ohms")
    averages = {(mode, stage): stage_means(captures[mode, stage], mode, stage, measured_ohm)
                for mode in MODES for stage in STAGES}
    supplies = [r.supply for group in captures.values() for r in group]
    require(max(supplies) - min(supplies) <= .020 + ROUNDING, "fixture", "supply voltage changed across trials")
    require(all(abs(averages["plain", s]["chip"] - averages["comp", s]["chip"]) <= 1.5 + ROUNDING
                for s in STAGES), "fixture", "plain and compensated stage temperatures must match")
    modes = {}
    for mode in MODES:
        room, warm, returned = (averages[mode, s] for s in STAGES)
        require(abs(room["chip"] - returned["chip"]) <= 1 + ROUNDING, mode, "return temperature did not recover")
        require(abs(room["sense"] - returned["sense"]) <= .006 + ROUNDING, mode, "return current did not recover")
        base_c = mean((room["chip"], returned["chip"]))
        base_v = mean((room["sense"], returned["sense"]))
        span = warm["chip"] - base_c
        require(span >= 15 - ROUNDING, mode, "need at least a 15 °C temperature change")
        slope = 100 * (warm["sense"] - base_v) / (base_v * span)
        base_drop = mean((room["drop"], returned["drop"]))
        diode_span = warm["diode"] - mean((room["diode"], returned["diode"]))
        # The parked DC-voltmeter in parallel draws a small part of the source current.
        base_ma = 1000 * base_v * (1 / measured_ohm + 1 / 10_000_000)
        modes[mode] = {"base_ma": base_ma, "slope_pct": slope, "span_c": span,
                       "vd_slope_mv": 1000 * (warm["drop"] - base_drop) / diode_span,
                       "min_headroom": min(x["headroom"] for x in (room, warm, returned))}
    plain, comp = (modes[mode] for mode in MODES)
    require(.85 - ROUNDING <= comp["base_ma"] / plain["base_ma"] <= 1.15 + ROUNDING, "fixture", "room currents must match within 15%")
    require(.22 - ROUNDING <= plain["slope_pct"] <= .46 + ROUNDING, "plain", "expected a clear positive baseline slope")
    return {"modes": modes, "reduced": abs(comp["slope_pct"]) <= .5 * plain["slope_pct"] + ROUNDING}


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("observations")
    parser.add_argument("--shunt-ohm", type=float, default=1000)
    args = parser.parse_args()
    try:
        with Path(args.observations).open(newline="", encoding="utf-8-sig") as stream:
            result = compare(parse(csv.reader(stream, strict=True)), args.shunt_ohm)
    except EvidenceError as error:
        print(f"UNRESOLVED: {error}", file=sys.stderr)
        return 1
    except (OSError, UnicodeError, csv.Error) as error:
        print(f"ERROR: {error}", file=sys.stderr)
        return 2
    print("mode     room mA   span C   pct/C      min headroom V")
    for name, r in result["modes"].items():
        print(f"{name:5} {r['base_ma']:10.4f} {r['span_c']:8.2f} {r['slope_pct']:+8.3f} "
              f"{r['min_headroom']:15.3f}")
    diode = result["modes"]["comp"]["vd_slope_mv"]
    print(f"Compensated diode forward-voltage slope in this circuit: {diode:+.3f} mV/C")
    if result["reduced"]:
        print("SUPPORTED: at least 50% less absolute normalized drift in these records")
        return 0
    print("NOT ESTABLISHED: the qualified records did not show at least 50% less drift")
    return 1


if __name__ == "__main__":
    sys.exit(main())

Related experiments and primary sources