I currently plan using INA194 that have a 50x gain. As our max voltage in is 3.3V this means the max voltage over the shunt need to be 3.3/50= 66mV. Given a max current of 2.5A that gives a Shunt resistor R = V/A = 0.066/2.5 = 0,0264 R or 25mOhm.
Now – 2.5A over 25mOhm is 0,156W which is fine since the 1206 resistor is 250mW.
If I use 50mA that gives 0,00125V (1,25mV) into INA194. And with a gain of 50x that is 62,5mV into the MCU. This is where we get into trouble because INA194 starts being inaccurate below 50mV in. I am not at all sure I actually can measure these low currents, but I do have one SW trick to help me.
We are NOT measuring a constant current, we are measuring a PWM pulse current, and the current we will see is 2.5A for 1mS and 0A for 999mS (just an example) due to the nature of the PWM. In software that becomes 2,5A / 1000 = 0,0025mA in average over a sec. So, if I take advantage of the 2,5Msps capability on the STM32 M4 I should be more than ok. I just need to make sure my sample frequency is at least 2 x the PWM frequency, but the higher sample frequency the better in this case.
Yet another trick is that I know then the Pulse is On/Off, and since we have raw data (no electronic filtering) I can eliminate noise then the pulse is off – as I simply know there should not be anything there. This is more difficult to do than I write here, but I will dig into it.
I used 2.5A as an example, but pulse current is V/R and can be higher that the rated max. This is why some MOSFET’s are rated to 160A with a pulse current to 400A etc. If we have motors with low inductive R we reduce PWM duty to maintain 2.5A in average, so I might actually need to cut down even further on the Shunt to avoid clipping on pulse currents, but I will not worry about that for now. I want to experiment with actual values because you can only cover so much in theory. Noise etc also add to the picture and is not easy to predict or model accurately.
The irony is that I removed passive filter components because of lack of space, and those filters would have prevented us to see the pulse currents. Now – since I have raw noise in I can actually use SW and see far more accurately than I would have done with analogue electronics. This is an excellent example where you need a good interaction between a HW and SW engineer.