No, you are not doing this right. Your concept is good but your calculations are flawed. The gain of the opamp circuit is not R2/R3, but (R2+R3)/R3. Your gain is therefore (400 kΩ)/(100 kΩ) = 4. I'm using the values in your schematic because I shouldn't have to go looking elsewhere. If you don't like that, put the real values right on your schematic next time.
You see a change of 4.04V - 3.64V = 400 mV on the output by switching in the 10 MΩ resistor. Divided by the gain of 4, this means a 100 mV change at the opamp positive input. By Ohm's law, (100 mV)/(10 MΩ) = 10 nA current thru the resistor, which is the opamp input current in this case.
For measuring remaining capacity of a LiPo battery pack, search for Battery Fuel Gauge ICs.
For instance, the Texas Instruments bq34z100 Wide Range Fuel Gauge supports LiFePo4 batteries from single cell through to 18 cells (3V to 65 V range), monitors battery health, charge and discharge, battery aging and self-discharge. It interfaces using I2C 2-wire, and also has direct indication support via an LED direct output pin.
Fuel Gauge or Gas Gauge ICs like this can both estimate remaining capacity, and learn the battery parameters over time, thus improving precision of estimate with use.
To take battery management further, LiPo battery pack manager ICs such as bq3055 not only provide fuel gauging, they also incorporate over and under-voltage protection, overcurrent and over-temperature protection, all in one package.
For measuring current in the 50 Ampere range mentioned in the question, an integrated Hall Effect Current Sensor IC such as Allegro's ACS756 Hall Effect based Linear 50-100A Current Sensor can be used. While sub-50 Ampere current sensors are also available, at lower prices, it would be better to use a sensor rated for higher than the maximum current envisaged.
The down-sides of measuring current flow and thereby attempting to estimate remaining capacity are:
- Current has to be monitored constantly, as any missed readings due to interrupts on the microcontroller, for instance, would lead to imprecision in readings.
- Reactive loads like motors do not have a linear current draw: Besides ripple, they can also back-feed current. With the proper battery protection in place, this back-feed will not harm the batteries, but may be partially used to charge the batteries. This leads to further imprecision.
- A low current draw when the motors are off but the rest of the circuit is operating may not register at all in a high current sensor, and self-discharge certainly will not register. More imprecision.
The current sensor mentioned has an analog voltage output, 20 mV per Ampere, and requires an ADC pin at the microcontroller to constantly poll the readings. Other current sensors exist with direct serial (I2C or SPI) output, saving the ADC pin, and for buffered output devices, the requirement for constant sampling by the microcontroller.
Best Answer
If you need to measure the "leaking" current, then you can use a current transducer from LEM (or similar), you put both wires in, so their magnetic fields cancells each other. If the heater will leak, you will get the exact leaking current.