Skip to Content

← All functionalities

Fuse test benchRaspberry PLC 19RI2CAcquisition

Differential ADC readings with automatic gain switching

ADS1015 differential measurement is the cheapest reliable way to read a high-current shunt from a Linux PLC. This example wires the 60 mOhm shunt to channels A0-A1 and the fuse voltage drop to A2-A3, then switches the programmable gain automatically between 2/3 (±6.144 V, safe) and 16 (±256 mV, maximum resolution). The exact conversion formulas come from a real fuse test bench deployment measuring up to 220 A.

Why differential beats single-ended here

A shunt floats at whatever potential the power circuit imposes, and its useful signal is millivolts riding on noise. Differential inputs reject the common-mode component and double the usable range. Single-ended would force a ground reference into a 220 A loop — a recipe for offset errors and ground bounce.

The auto-gain trick

Every reading starts at gain 2/3 so a large signal can never clip. If the estimated voltage fits inside the ±256 mV window, the channel is re-read at gain 16, multiplying resolution by 24. Two conversions instead of one, but the ADS1015 does 1600 samples per second — the 500 ms monitoring loop never notices.

From raw counts to amps

The full chain is one line: I = (raw/65535) · 2 · 0.256 · 200 / 0.06 · 1.02 — raw counts to volts at the PGA, through the 200:1 conditioning, divided by the 60 mOhm shunt, times a 1.02 calibration factor measured against a reference instrument. Voltage drop across the fuse uses the same pattern on A2-A3.

A snippet from the implementation

Straight from the example as deployed on the Raspberry PLC 19R — copy it freely:

def create_adc():
    i2c = busio.I2C(board.SCL, board.SDA)
    ads = ADS.ADS1015(i2c, address=0x48)
    return ads

The full example is a complete program — wiring header, setup and main loop — ready to adapt to your application.

Frequently asked questions

ADS1015 or ADS1115 for this application?

The ADS1015 (12 bit, 1600 SPS) is enough because the auto-gain keeps the signal near full scale. Choose the ADS1115 (16 bit) if you must resolve very small currents without external conditioning.

Can I read both differential pairs at the same time?

No, the ADS1015 has a single multiplexed converter. The example reads shunt and voltage drop sequentially; at 1600 SPS both fit comfortably inside one 500 ms monitoring cycle.

Where does the 1.02 factor come from?

It is an end-to-end calibration constant obtained by comparing the computed current against a reference meter. It absorbs shunt tolerance, divider error and PGA gain error in a single number.

Related functionalities