Current Sensing problems in PWM-switching circuit
When you control your mosfet and thus current with a PWM, it's either on or off, so your current will either be 100% or 0%.

I guess you are measuring with an ADC in your uC, measurement will be random as you don't know at what point it will sample, it might be when it's on, when it's off, or in between.

Your circuit does not allow to control the current, it is not clear what is the goal of your application. 

If it's some sort of step down converter and you need a somewhat constant currant, you will need an inductor and a diode like a step down buck converter.

If you want to drive LED for example, then you can keep this design, but you need to average the output of the INA to have some correct measurement. 

You can do so with an Lowpass R-C filter or better a L-C filter between the output of the INA and your uC ADC. The capacitor and resistor / inductor value will depend on your PWM frequency and ADC input impedance.

You can also do a better lowpass filter with an op-amp.

You need to check the ADC pin input impedance to make sure you drive it with enough current.







simulate this circuit &ndash; Schematic created using CircuitLab