AMP02 + LM311 Conditioner: Fix Gain Set and -V, Not the PCB

Ryan Tanaka8 min read
Other ManufacturerSerial CommunicationTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Bench symptom: push a couple of volts of sine into the front end and the LM311 gives you clean edges. Drop to a few hundred millivolts at the low end of your frequency range and the output smears, chatters, or parks at one level and stays there. Then the breadboard prototype that passed months ago fails the same way, in two different locations.

That last detail is the whole diagnostic. A fabrication defect does not follow a design back onto a breadboard. The fault travels with the schematic. Start at the analog bias points, not the copper.

Skip These Fixes First

  • Re-ordering or reworking the PCB. Two build technologies, two locations, identical failure. The boards are not the variable.
  • Blaming the bench supply or ambient EMI. Supply-dependent spurs are a real phenomenon in GHz work. A repeatable, amplitude-dependent failure in a low-frequency in-amp plus comparator chain is a design flaw, and treating it as interference just gives you permission not to fix it.
  • Shielding, ferrites, twisted pair, star grounds. None of that restores gain that was never set.
  • Swapping the AMP02 or the LM311 for a "better" part. If the gain-set pins are open, every instrumentation amp you drop into that footprint runs at unity.
  • Turning up the generator until edges look clean. That is not a fix; low amplitude is in your spec.
  • Adding filtering ahead of the comparator. You are attenuating a signal that already cannot reach the trip window.
Bench symptom Not this Actual cause First measurement
Output amplitude tracks input amplitude 1:1 Bad in-amp No resistor across the AMP02 gain-set pins → gain = 1 Ohm the gain-set pins with power off
Works on large signals, dead on small ones Noise floor Insufficient comparator overdrive at unity gain Scope both LM311 inputs together
Output clipped or pinned near one rail Saturated input Missing or inadequate negative rail on the AMP02 DC-probe V+ and V- at the device pins
Comparator output does nothing at all Blown comparator Output transistor emitter not returned to ground; no pull-up Continuity, emitter pin to logic ground
Edges dirty only at low frequency Slew limiting Differentiator response plus feedback loading the previous stage Scope the AMP02 output node while the comparator switches

What Actually Broke

Three defects in the same signal path, and each one alone is enough to produce the symptom.

The AMP02 is running at unity. An instrumentation amplifier sets its gain with an external resistor between the gain-set pins. Leave those pins open and the part is a unity-gain differential buffer. A 200 mV sine in gives you 200 mV out, which is nowhere near the overdrive an LM311 needs to produce a fast, bounce-free edge. Everything downstream then looks like a comparator problem.

The negative rail. The AMP02 datasheet calls for at least -5 V on V-. If that pin sits at ground, the output cannot swing below the negative limit, so a bipolar input gets rectified against the bottom of the range and the comparator sees a one-sided, offset waveform. Rail-to-rail output claims do not help; the part still needs the specified supply span. Schematics that leave the rails implicit hide exactly this class of fault, which is why the rails and the ground returns belong on the drawing.

The comparator has no ground return for its output stage. The LM311 output is an open collector. The emitter must be tied to logic ground and the collector pulled up to the logic rail. Miss either and the output is not a logic signal, no matter how good the analog side is.

Two more items degrade whatever margin is left. The positive-feedback path takes a 201 kΩ element back into the node that drives the comparator, so the AMP02 output impedance rises with frequency and it is fighting the hysteresis network at the switching instant. And the differentiator ahead of it gives gain that rises with frequency, which is the wrong shape when your worst case is the low-frequency, low-amplitude corner. With R1 already in series with C1, the high-frequency gain of that stage tops out around 7 anyway, so you are paying in low-frequency response for very little.

Measure in This Order

  1. Power the board with no signal. DC-probe V+ and V- at the AMP02 pins, not at the supply terminals. Confirm the negative rail meets the datasheet minimum.
  2. Measure the reference pin. It must be driven from a low-impedance node at your intended output zero. A resistive divider there wrecks CMRR and shifts the comparator threshold.
  3. Power down and ohm across the gain-set pins. Open circuit means unity gain, and you have found the fault.
  4. Inject a known low-amplitude sine and measure the AMP02 output peak-to-peak. Divide by the input to get actual gain, then compare to the gain you designed for.
  5. Scope both LM311 inputs on the same trigger, DC-coupled. Read the differential swing at the trip point. If it is single-digit millivolts of overdrive, the comparator is doing what it was told.
  6. Buzz the comparator emitter to logic ground and confirm the collector pull-up to the logic rail.
  7. Check bypassing: a ceramic at every supply pin of every active device, lead lengths short. Breadboards fail this quietly.

Rework the Front End

  1. Install the gain-set resistor. Take the gain equation from the AMP02 datasheet, solve for the resistor that gives your worst-case input the swing the comparator needs, and use a low-drift metal-film part — that resistor's tolerance and tempco appear directly in your gain.
  2. Bring up a real negative rail. You already have ±15 V available; wire it to the part and draw it on the schematic.
  3. Ground the emitter of the LM311 output transistor and fit the collector pull-up.
  4. Re-topologize the comparator input. Ground the left-hand side of the 1 kΩ and apply the signal to the inverting input. Add a matching 1 kΩ on the other input to balance source impedance and cancel input bias current error. If output polarity then comes out inverted, swap the V+ and V- inputs at the circuit's differential input rather than patching it after the comparator.
  5. Keep the hysteresis network off the previous stage's output node. Positive feedback should land on a node the previous amplifier does not have to drive against.
  6. Justify the differentiator or delete it. If you do not need gain that climbs with frequency, a flat gain stage plus a defined band-pass costs you less margin.

Prove It Across the Corners

  • Test at the worst corner first: minimum amplitude at minimum frequency. If that passes with margin, the easy cases follow.
  • Drive a slow triangle through the threshold and confirm a single clean transition. Any chatter means your hysteresis window is smaller than your noise.
  • Measure the hysteresis directly — the difference between the rising and falling trip voltages — and confirm it exceeds the noise you see at the comparator input by a comfortable factor.
  • Verify output rise and fall times at the logic input with the pull-up loaded as it will be in service.
  • Repeat at both supply extremes and after a warm-up soak. A circuit that only passes cold is still failing.
  • Re-run the amplitude sweep with the generator's DC offset deliberately shifted a few millivolts. If that breaks it, your reference and operating points are not defined well enough.

Pitfalls That Repeat on This Topology

  • "It worked in January." Marginal is not working. A design that sits close to a rail, or relies on stray breadboard capacitance, will pass one day and fail the next with no visible change. Design for margin and it becomes reproducible.
  • Open gain-set pins. They are high impedance and they will pick up whatever is nearby. Never leave them floating, even when you want unity gain — check the datasheet for the correct unity-gain connection.
  • High-impedance reference pin. The in-amp reference is a signal input, not a bias node. Buffer it.
  • Single-supply habits on a bipolar signal. If the input crosses zero, the amplifier and the comparator both need a rail below the lowest excursion, or a deliberate mid-supply reference used consistently through the chain.
  • Schematics with implied power. If the rails and the output-stage grounds are not drawn, nobody — including you — can review the circuit.

If the measured gain matches the resistor you installed, both rails and the reference read correctly at the device pins, the comparator emitter is grounded with a working pull-up, and the low-amplitude corner still fails, you are past field debug. Package the schematic with rails and ground returns drawn, the gain-set resistor value, and the measured DC voltage at every AMP02 and LM311 pin, and open a case with the manufacturer's applications support for each device.

FAQ

Why does my AMP02 output amplitude equal the input amplitude?

Because there is no resistor across the gain-set pins. Without it the instrumentation amplifier runs at unity gain. Power down, ohm the gain-set pins, and install the resistor calculated from the datasheet gain equation.

Why does the LM311 output stay at one level with a good analog signal on its input?

The LM311 has an open-collector output: the emitter of the output transistor must be returned to logic ground and the collector pulled up to the logic rail. Missing either connection leaves the output non-functional regardless of input overdrive.

Why did the circuit work on a breadboard months ago and fail on the PCB and the breadboard now?

The design has no margin, so it was passing on stray capacitance, generator offset, and operating points sitting close to a rail. Because the breadboard fails too, the fault is in the schematic — gain setting, negative rail, and comparator ground return — not in the fabricated board.

Back to blog