I have the following circuit:
simulate this circuit – Schematic created using CircuitLab
A simple voltage source is connected to a resistor. The current flow is controlled via an NPN switch. I also have the INA169 current sensor (Here is the datasheet).
The current measurement from INA169 is driven to my my microcontroller's analog in, and the ground signal of INA169 is connected to my microcontroller's analog ground.
The NPN mosfet is driven by a pwm signal generated from my microcontroller. To effectively drive the mosfet I am using the ICL7667 Mosfet driver. In order for the circuit to work, I have connected the controllers ground to:
- the mosfet drivers ground
- the source of my NPN mosfet.
When the PWM duty cycle is either 0% or 100%, the current measurement is perfect. However, when the duty cycle is between 0% and 100%, I get a completely wrong current reading from my sensor. Is there something wrong with the circuit above or something that is overlooked?