On a recent project I needed to fairly accurately measure current and power consumption of a handful of parts in real time. We needed to measure current in the range of micro amps, so this was actually somewhat tricky.
I _could_ have just used a bunch of super expensive current meters, but I managed to find a much more convenient and cheap solution using a Raspberry Pi. We were already using a Pi to allow for remote debugging, so I went looking for something I could hook up to that.
I found these ADCs:
– [ADC to measure small delta voltage](https://www.abelectronics.co.uk/products/3/Raspberry-Pi/14/Delta-Sigma-Pi)
– [ADC to measure larger voltage from ground](https://www.abelectronics.co.uk/products/3/Raspberry-Pi/17/ADC-Pi-V2—Raspberry-Pi-Analogue-to-Digital-converter)
They plug right into the GPIO headers on the Pi and even come with some [python libraries for reading them.](https://github.com/abelectronicsuk/ABElectronics_Python_Libraries)
Using a tiny shunt resister inline with Vdd, we can use those ADCs to measure the voltage drop across the shunt resister to get the current, and combine that with the voltage at Vdd to the power. We ended up with a circuit that looks like this:
The resulting circuit lets us measure currents from 1uA to 4.6mA with a precision of +-0.5uA, which is plenty good for our purposes. We can also adjust the gains on the ADCs in software to give us more range at the expense of precision.
And we can do it remotely! The Pi can be wired into our hardware, and we can just ssh into it to get live power measurements. And there are 8 channels on those boards so we can measure (and log!) the power consumption of 8 different components simultaneously. It’s super convenient.