In my application I need to measure the power consumption of the Raspberry Pi 2 model B board under different conditions: taking pictures, compressing images, encrypting data etc.

As I don't have precision multi-meters with data logging, I thought of using an ADS1115 16bit ADC, hooking up a 0.1ohm shunt on the +5V power line and measuring the voltage drop related to the Pi voltage. The ADC would be connected externally to another device for storage (possibly another Rpi or an Arduino board).

I found an article that proposes this measurement setup: Setup Setup

Is that setup feasible? What are the implications?

  • 2
    \$\begingroup\$ A high-side current shunt requires a differential amplifier in order to create a ground-referenced signal that the ADC can measure. You can get high-side current measurement ICs that integrate all of that into a single package. Look at manufacturers such as Linear Technology and Maxim, among others. \$\endgroup\$ – Dave Tweed Dec 6 '17 at 15:33
  • \$\begingroup\$ @DaveTweed cant I just connect the shunt power line on the ADC configured to use differential inputs? \$\endgroup\$ – Victor Nascimento Dec 6 '17 at 15:48
  • \$\begingroup\$ Updated the question with pictures of what I'm trying to achieve based on this article: ieeexplore.ieee.org/document/6925777/?reload=true \$\endgroup\$ – Victor Nascimento Dec 6 '17 at 15:53

If you use an ADS1115 and power it from 5V you can use two differential inputs on the ADC to sample both sides of the current sense resistor. You should use series resistors and a filter cap on the current sense as the current waveform for the RPi will most likely have components above the 860 sps limit of the ADS1115. Design your low pass filter for at most 860 / 2 cutoff (remember the filter cutoff is only the -3dB point).


simulate this circuit – Schematic created using CircuitLab

The ADS1115 MUST share a common ground with the RPi in this configuration.

Note that there are a few issues with this which will limit accuracy. A much better circuit would to be to use a current sense amplifier with integrated ADC like the TI INA226. Maxim and others also make parts that will work, some including the current sense resistor (or hall element) inside the package.

EDIT - For the ADS1115, the ground connection to the RPi should be short and direct, not something round-about through the USB connection to a PC providing power for both.

  • \$\begingroup\$ I will try this as soon as I can and report back. If I make my circuit on a breadboard will it affect the performance really bad? And could you explain why do I have to put the cutoff at 430 and not 860 (sampling rate)? \$\endgroup\$ – Victor Nascimento Dec 6 '17 at 17:18
  • \$\begingroup\$ The major problem in using ICs for this task like the INA22x is that they are really hard to find (if not impossible) here in my country. I would have to import them and it would take a long time (which I don't have atm) \$\endgroup\$ – Victor Nascimento Dec 6 '17 at 17:30
  • \$\begingroup\$ The maximum frequency you can digitize is half the sample rate (Nyquest limit). That is for a pure sine wave (all other waveforms have harmonics which will be aliased by the sampling, even at 430Hz). If you have an oscilloscope with a long enough sample buffer or one that can stream samples to USB, you can use that to record the current (record the voltage, you'll have to convert to current), just make sure the RPi is running on an isolated ground if you do this. I can provide details if you have the equipment. \$\endgroup\$ – Dean Franks Dec 6 '17 at 20:24
  • \$\begingroup\$ A breadboard is not ideal, but you haven't specified what kind of accuracy you need for the measurements. If you are just looking for a battery life estimate you might be better off doing actual timing tests with batteries of known capacity instead of trying to measure the current. \$\endgroup\$ – Dean Franks Dec 6 '17 at 20:26
  • \$\begingroup\$ If you can order from China there is a prototype board version of the INA226 commonly available as CJMCU-226 (google is your friend) \$\endgroup\$ – Dean Franks Dec 6 '17 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.