Page 1 of 1

Re: Could the Pi monitor its own power consumption?

Posted: Sat Feb 18, 2012 8:34 am
by prodata
I guess that's actually not quite the right question. Of course it could, but anyone have any views on whether it could be done fairly easily and, if so, how?

The Pi will have a single DC power input so getting some sensing of instantaneous power being used shouldn't be difficult in principle. Then is there some way that GPIO inputs could be used (probably a little external circuitry being needed too, but keeping this as minimal as possible) to interface the sensing to the Pi? And finally a background task needs to be running that could eg log mean power consumption to a file every eg 5 or 10 or 60 minutes continuously for later analysis.

Why? Well I think that one of the most interesting applications for the Pi is going to be in off-grid computing applications. It's then really helpful when designing the PSU to have as good a fix on the actual power budget as possible and - if it were possible - it would be both neat and elegant to achieve this within the Pi itself

Re: Could the Pi monitor its own power consumption?

Posted: Sat Feb 18, 2012 10:37 am
by Joules
The use of data loggers or USB multimeters to monitor voltage/current would achieve this. I would do the initial testing via another computer so you don"t count phantom loads from your test circuitry.

Re: Could the Pi monitor its own power consumption?

Posted: Sat Feb 18, 2012 11:51 am
by prodata
Joules said:


The use of data loggers or USB multimeters to monitor voltage/current would achieve this. I would do the initial testing via another computer so you don"t count phantom loads from your test circuitry.


Speaking from experience, using an external logger is messy though for long-term logging (which is what's needed here for in-field monitoring - not just test-bench stuff). Power for the logger long-term can be a problem. And while voltage monitoring is simple enough (plenty of loggers do that) - this obviously isn't what's needed to monitor power consumption. Current/power monitoring by an external device on a precision 5v supply isn't quite so easy. But maybe I've missed a suitable unit when I've searched around previously. if you could point me towards a unit that is able to log say 200mA current for extended periods and with frequent sampling without significantly impacting the supply to which it's attached, with minimal (battery) power demands of its own and not costing a fortune then that would be hugely appreciated.

Just seems to me that the Pi already provides much of the logging and power provision that's needed for the monitoring and it would be much neater all-round if there was some way of getting the Pi to do the job for itself.

Re: Could the Pi monitor its own power consumption?

Posted: Sat Feb 18, 2012 11:59 am
by rurwin
I'm wondering this myself, since I've just purchased the bits to upgrade my bench power supply to 5V at 6A with four USB sockets and 3.3V at 100mA.

If you put a 0.01 ohm resistor in the line, then at 5A it will drop 0.05V, which will not be too much to take the output out of spec. Put an op-amp across that with an amplification factor of around 100, and feed a 12- or 16-bit SPI DAC from the output. With care, and suitable filtering in software, you should be able to achieve 1mA resolution.

It's probably too much work for me to bother.