JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Calibration, Linearity, and the 4-20 mA Loop

The first four guides turned the world into a clean voltage and handed it to the ADC. This last one is about making that number actually true — linearizing the sensor's curve, calibrating it to the world, cancelling excitation drift with ratiometric measurement, surviving a long wire with the 4-20 mA loop, and the honest truth that the sensor, not the ADC, sets your accuracy.

The chain is built — now make it true

Across this rung you assembled a whole front end. A transducer turned some piece of the world into a voltage; a Wheatstone bridge pulled a tiny resistance change out of hiding; an instrumentation amp lifted that small differential signal cleanly; and the last guide scaled it, shifted its level, and anti-alias filtered it to hand the ADC a tidy waveform. That is the signal conditioning done. What is left is the part beginners skip — and the part that separates a number from a measurement: making that reading actually mean something true about the world.

Here is the framing that organizes everything below. Down the whole signal chain, the ADC's bits are the cheapest, easiest accuracy you will ever buy — you simply pick a part with enough of them. The hard, expensive, irreducible accuracy lives upstream, in the sensor and its conditioning. Every stage before the converter has already stamped its own error onto the signal, and no number of bits downstream can un-stamp it.

Linearity: the curve nature actually gave you

The dream sensor is a straight line: double the input, double the output. Real transducers each have their own bent shape. A platinum RTD is beautifully near-linear over a wide span; a thermocouple is gently curved, its volts-per-degree drifting with temperature; a thermistor is wildly nonlinear — roughly exponential, hugely sensitive but only across a narrow window. Linearity is just how faithfully the output tracks a straight line, and it is a property of the physics, not something you can amplify away.

You have three honest ways to deal with a curve. Restrict your range so a short arc of it looks straight — that is the real meaning of a datasheet's "linear over 0 to 50 degC." Or model the curve with math — a polynomial, or the known physics equation (Steinhart-Hart for a thermistor, the standard tables for a thermocouple or RTD). Or store a lookup table in the microcontroller. Notice the pattern: the analog front end almost never tries to bend the curve back. You digitize the curved signal accurately, then straighten it in software where bending costs nothing.

Calibration: tying volts to the world

Linearity gives you the shape of the line; calibration gives you its two anchors — where it actually sits. Two systematic errors need pinning down. Offset is the whole line shifted up or down, so zero input does not read zero (think of an in-amp's input offset voltage or a load cell's own weight). Gain, or span, is the slope being wrong. A one-point calibration fixes offset alone — that is exactly what "tare" does on a kitchen scale. A two-point calibration fixes both by measuring two known references and solving for the line through them.

  1. Remove all load and read the raw output. That is your zero point — say the system reads Vzero = 0.20 V at 0.00 kg.
  2. Place a known reference mass at or near full scale and read again — say Vfull = 4.20 V at exactly 50.00 kg.
  3. Compute the span: span = (Vfull - Vzero) / mass = (4.20 - 0.20) / 50 = 0.080 V per kg.
  4. From now on, convert any reading: mass = (V - Vzero) / span = (V - 0.20) / 0.080. A reading of 2.20 V then means (2.20 - 0.20) / 0.080 = 25.0 kg.
  5. Record the conditions — temperature, supply voltage — because the calibration is only valid near them. Sensors drift with heat and age, so schedule recalibration.

Be clear about what calibration can and cannot do. It removes systematic, repeatable error — the steady offset and the wrong slope. It does nothing to random noise (only averaging beats that down), and it does not fix nonlinearity (only more calibration points or a curve model do). And calibration itself is perishable: thermal coefficients and slow aging walk the zero and span away over weeks and months. That is the whole reason real instruments carry a "calibrate by" date — the truth you anchored today slowly drifts loose.

Ratiometric measurement: cancel what you cannot control

Here is a trick worth more than an extra ADC bit. A Wheatstone bridge does not put out a fixed voltage — it puts out a fraction of its excitation voltage. A 2 mV/V load cell gives 2 mV for every volt of excitation: at 5 V excitation, full scale is 10 mV. But if the excitation supply sags to 4.9 V, the output drops to 9.8 mV all by itself. To an ADC with a fixed reference, that 2 percent droop is indistinguishable from a real 2 percent change in weight — a flat-out lie in your data.

The fix is beautifully simple: feed the same voltage that excites the bridge into the ADC's reference input. An ADC reports input divided by reference, so it is now reporting a pure ratio. Let the excitation drift wherever it likes — numerator and denominator move together and the ratio is untouched. This is ratiometric measurement, and it is why a bridge sensor and its converter are designed to share one supply: you have made the reading immune to the very thing you could not hold steady.

Notice what this buys you for free. Ratiometric wiring relaxes the spec on your excitation and on the reference: you no longer need an ultra-stable, expensive voltage source, only a reasonably quiet one — because slow drift now cancels (though fast noise on the shared rail still rides through, so it must still be clean). It is an accuracy upgrade you earn by how you connect the parts, not by paying for better parts. Technique, again, beating silicon.

The 4-20 mA loop: analog that survives a long wire

Now a different problem: send one analog reading 200 metres across a noisy factory. A voltage is the wrong messenger — it sags across the wire's resistance and picks up interference, so it arrives wrong. The classic answer is to encode the value as a current instead. In a single series loop the current is identical at every point along it (Kirchhoff's current law), no matter how long or thin the wire is, so the receiver reads exactly what the transmitter sent. That is the 4-20 mA current loop, the workhorse of industrial sensing.

  THE 4-20 mA CURRENT LOOP     (transmitter -> long wire -> receiver)
  ------------------------------------------------------------------
   +24V --+
          |
     [ TRANSMITTER ]   sensor + conditioning SET the loop current
          |
          |    I = 4..20 mA   (one series loop: same I at EVERY point)
          |
        ( long 2-wire cable -- its resistance does NOT change I )
          |
     [ Rsense = 250 ohm ]   turns the current into a voltage for the ADC
          |
         GND
  ------------------------------------------------------------------
   live zero :  4 mA = 0%     20 mA = 100%     0 mA = broken wire (FAULT)
   at Rsense :  4 mA -> 1.0 V    12 mA -> 3.0 V    20 mA -> 5.0 V
   decode    :  value% = (I_mA - 4) / 16 x 100
The whole loop on one card. The transmitter forces a current between 4 and 20 mA; that current is the same everywhere in the series loop, so the cable's resistance cannot corrupt it. The receiver drops it across a precise 250 ohm resistor to get a clean 1 to 5 V for the ADC.

Why does zero map to 4 mA, not 0? This is the elegant "live zero." Because even a true zero reading still carries 4 mA, the wire always has current flowing — so a reading of exactly 0 mA can only mean a broken cable or a dead transmitter, a fault you can detect instead of mistaking for a real zero. Decoding is just the calibration line again: value percent = (I - 4) / 16 times 100, so 12 mA reads 50 percent. Many transmitters are two-wire, drawing their own power from the loop, which forces them to live on less than 4 mA — and the receiver's job is simply to keep its loop burden low and digitize the voltage across that sense resistor.

Where the accuracy really lives

Now the rung's honest punchline. It is tempting to chase accuracy by buying a fancier converter. But a plain 16-bit ADC already gives 2^16 = 65536 steps — a resolution of about 0.0015 percent. Put that same converter behind a sensor whose tolerance is plus or minus 1 percent, with conditioning that adds its own offset, gain error, and drift, and your measurement is plus or minus 1 percent. The spare bits are resolving noise and your own errors in exquisite detail; they are not resolving truth.

Think of accuracy as a budget that sums every stage's error: sensor tolerance and nonlinearity, the in-amp's offset, drift, and finite CMRR, the resistor tolerances in your scaling, reference drift, and finally the ADC's own effective number of bits (always fewer than the nameplate once its own noise is counted) and the signal-to-noise ratio of the whole front end. Add those in quadrature and the dominant term almost always sits far upstream, in the sensor and its analog conditioning — long before the converter ever gets a vote.