Current measurement with shunt and with no defined ground reference
This is an interesting problem to solve, and you have over complicated the reasoning (you don't need a voltage reference in the front end) and are probably confused further by the simulator.
Lets start with a very simple measuring device based on a single opamp.
- The device is battery powered.
- The device is fully floating with no defined ground reference point.
- The output measuring range is 0-3.3V into an A/D.
- The device can measure +/-100A relative to two points (ie across the shunt).
- V1 and V2 do not matter, only the voltage developed across the sense resistor matters.
The circuit below shows a single opamp that amplifies the input signal (+/- 150mV) to +/-3.3V. I've used a typical opamp (not rail to rail) and the simulator assumes +/-15V supply rails. I know this is not what the target is but it serves as a starting point.
NOTE: The ground I show here is ONLY to satisfy the simulator. I could have applied the ground symbol to anywhere in the circuit. I chose to ground Probe_A to make it easier to understand the next change to be made.
simulate this circuit – Schematic created using CircuitLab
If Probe_A is positive relative to Probe_B then the output will be negative.
If Probe_A is negative relative to Probe_B then the output will be positive.
The ground reference shown is only needed for the simulator to run, but it does then define the relative voltages for the opamp output and the probe inputs.
To get +/-3.3V fullscale output for 150mV (100A in the shunt) input we need a gain of 22.
Now on to your problem. I am assuming your battery powered instrument uses two probes to connect to the shunt resistor which is permanently in place. The instrument can therefore be touched to the shunt with Probe_A being positive or negative relative to Probe_B.
So there are two connection variables:
- We don't know which battery voltage is highest.
- We don't know which way around the Probes will connect.
Therefore it would be helpful to be able to measure +/-100A and perhaps light an LED next to the probe touching the highest voltage battery.
As I assume the voltage being measured across the shunt is being digitized by an A/D we can do the following:
simulate this circuit
Now I have biased the input for the opamp to 3.3V/2, this is buffered by an opamp and fed to the negative input. This does not need to be a reference voltage, you simply need the MCU VDD/2 so you can measure either polarity signal.
I've also changed the gain of the opamp so that it outputs +/-1.65 relative to the supply center point of the 3.3V supply.
If Probe_A is positive relative to Probe_B then the output will be positive but below VCC/2. Ov output to the A/D = 100A.
If Probe_A is negative relative to Probe_B then the output will be positive but above VCC/s. 3.3V. 3.3V output to the A/D = 100A.
Mid point on your A/D = 0A.
Most MCU A/D's use the supply voltage as the reference voltage and this causes some loss of accuracy. You could get higher accuracy by using an external reference for the A/D rather than using 3.3V as the FSD reference then use a D/A to set the mid point voltage.
You can then decide in code whether to light an LED next to Probe A or B to designate the higher voltage point.