Electronic – Current measuring with PIC

currentcurrent measurementmicrocontrollerpic

I know it is possible to measure analog voltages with the ADC peripheral of advanced PIC microcontrollers. There is no peripheral to measure current though.

Is it possible to convert a current to a voltage so that I can measure that voltage with the ADC peripheral? Or are there ICs with serial or parallel output of a measured current? I'd rather have serial, with I2C or SPI.

I'll have to measure currents up to 200mA with fewer than 5mA deviation. The PIC I'm using is a PIC18F46K22, but that's probably no useful information.
I'll measure the currents of 5V / 3.3V chips connected to the PIC microcontroller (like LCD, RAM, other PIC, …) so the current will go to ground. Also, a few tenths of a volt voltage drop is allowed.

Best Answer

There are many current-to-voltage converters out there. The simplest is a resistor. Make it small to reduce losses or big to make the voltage big enough to cover your entire ADC range. Or, make it small to reduce losses and amplify it with an op-amp circuit to cover your entire ADC range.

Another often overlooked current-to-voltage converter is a MOSFET that's on, which is pretty close to a resistor. Perhaps not as accurate, but many circuits that require current measurement already have a switching MOSFET in them, so this method is cheap and convenient. The datasheet will list the on resistance as \$R_{DS\_ON}\$.

For a step up in sophistication, look for hall effect sensors. Hall effect sensors measure magnetic fields; some of them are configured to measure the magnetic flux associated with a current passing through a wire. Here's an example product page to give you an idea. However, at \$200mA\$, I don't see much need. Typically this sort of product comes into play when the current is high enough that a resistor, even a small one, would represent a significant loss.