Differential ADC readings with automatic gain switching
Why differential beats single-ended here
The auto-gain trick
From raw counts to amps
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 adsThe 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.