Hi there,
I am working on a project and I wanna measure how much energy that the pi consumes while I am running that different tasks on the pi. Is it possible by just doing a software on the raspberry pi that graphically shows me my energy consumptions?
Sincerely
-
- Posts: 38
- Joined: Tue Jun 24, 2014 4:42 pm
Re: Energy or Power Consumptions
No , it is not possible by software only.
ghans
ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org
-
- Posts: 690
- Joined: Tue Jun 16, 2015 6:01 am
Re: Energy or Power Consumptions
Hardware options aren't all that expensive, only about US$7.50 for this option: https://www.adafruit.com/products/1852? ... fgoduHIHIw
Account Inactive
- Jim Manley
- Posts: 1600
- Joined: Thu Feb 23, 2012 8:41 pm
- Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
- Contact: Website
Re: Energy or Power Consumptions
Oh ye of little faith. Let's expand our minds a bit and recall what the Law of Conservation of Energy and Mass says - matter and energy can neither be created nor destroyed - they can be transformed, but not created nor destroyed. We just happen to have a sensor buried deep in the SoC that measures what? Temperature. What determines that temperature? The amount of power being consumed by the SoC, and the relationship is well understood. All of the power going in eventually results in electromagnetic radiation coming out, most of it in the form of heat in the infrared spectrum. The SoC can't store the heat (at least not for very long, especially at the junction level where that sensor is!ghans wrote:No , it is not possible by software only. ghans


The recently-claimed detonation of a hydrogen nuclear fusion device by North Korea was neither a nuclear fusion device nor detonation. Discuss and show your work.

The best things in life aren't things ... but, a Pi comes pretty darned close! 
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!
Re: Energy or Power Consumptions
That post is a reminder why I love Jim Manley's sometimes bonkers looking posts. Good on ya Jim.
Re: Energy or Power Consumptions
Or for those less inclined to bend over and grab their ankles:SonOfAMotherlessGoat wrote:Hardware options aren't all that expensive, only about US$7.50 for this option: https://www.adafruit.com/products/1852? ... fgoduHIHIw
http://www.ebay.com/itm/121834393995?_t ... EBIDX%3AIT
Considering shipping you could literally buy a dozen for the cost of one from ada"fruit". I've been using a couple now for over a year and much larger number in the physics lab. Amazing deal for current and voltage logging. Yery accurate too.
-
- Posts: 690
- Joined: Tue Jun 16, 2015 6:01 am
Re: Energy or Power Consumptions
Thanks for the pointer Emma I just picked up a couple. I try to keep my head from entering any unsavory locations, as tends to happen whence one assumes that position...emma1997 wrote:Or for those less inclined to bend over and grab their ankles:
http://www.ebay.com/itm/121834393995?_t ... EBIDX%3AIT
Considering shipping you could literally buy a dozen for the cost of one from ada"fruit". I've been using a couple now for over a year and much larger number in the physics lab. Amazing deal for current and voltage logging. Yery accurate too.
Account Inactive
Re: Energy or Power Consumptions
Generally the phrase hints at entry from an external source but IMO there may be an element of both when people flock to places like Sparkfun and other domestic wheelers/dealers. You can guess where these places might obtain their stock. Even cheaper from Aliexpress or Alibaba where bigger quantities might be involved but no Ebay/Paypal fees which can be significant.
Fanboys will rebuff with claims of excellent service and technical assistance but personally I don't mind a little research to avoid hundreds of percent markup. In my book pocketbook trumps patriotism almost every time.
Fanboys will rebuff with claims of excellent service and technical assistance but personally I don't mind a little research to avoid hundreds of percent markup. In my book pocketbook trumps patriotism almost every time.
Last edited by emma1997 on Thu Jan 07, 2016 10:45 pm, edited 1 time in total.
- alexeames
- Forum Moderator
- Posts: 2874
- Joined: Sat Mar 03, 2012 11:57 am
- Location: UK
- Contact: Website
Re: Energy or Power Consumptions
Just don't expect a great deal of accuracy at the low end of the consumption scale (e.g. <=0.1A) with those Charger Doctor things (wherever you buy them from). There was a guy using one of these to measure Pi Zero current consumption the week after the Zero came out. His results were significantly lower than mine, the official specifications, Dave Akerman's and Mike Redrobe's readings.
He bought himself a better meter and the figures went up to something resembling Dave's Fluke, My eMeter and Mike's bench PSU.
He bought himself a better meter and the figures went up to something resembling Dave's Fluke, My eMeter and Mike's bench PSU.
Alex Eames RasPi.TV, RasP.iO
Re: Energy or Power Consumptions
I do remember that thread and can't explain it.
In our experience most were less than 1% off on voltage scale and 3% on current compared against Keithley lab grade instrument. That last probably due to variations in shunt resistance. Very few were much worse than that. Either way not bad for a buck.
In our experience most were less than 1% off on voltage scale and 3% on current compared against Keithley lab grade instrument. That last probably due to variations in shunt resistance. Very few were much worse than that. Either way not bad for a buck.
- alexeames
- Forum Moderator
- Posts: 2874
- Joined: Sat Mar 03, 2012 11:57 am
- Location: UK
- Contact: Website
Re: Energy or Power Consumptions
emma1997 wrote:I do remember that thread and can't explain it.
In our experience most were less than 1% off on voltage scale and 3% on current compared against Keithley lab grade instrument. That last probably due to variations in shunt resistance. Very few were much worse than that. Either way not bad for a buck.
Yeah. Maybe there are good ones and bad ones, just like with lots of cheap stuff? Cheap doesn't automatically mean low quality and expensive doesn't guarantee high quality. As long as it's good enough for the intended purpose, cheap is fine by me.

Alex Eames RasPi.TV, RasP.iO
Re: Energy or Power Consumptions
@Jim,
So Jim, if the temperature reported from my SoC is T, what is the power consumption of my Pi? Show your working for full marks.

I don't believe it's as easy as you make out.
Off the top of my head the only way to use temperature measurement to accurately determine the Pi power consumption is to build it into a Callendar and Barnes' continuous-flow calorimeter.
In which case the SoC temperature reading is of no use.
Do they still teach this stuff in high schools?
All in all it would be much easier just to get a cheap multimeter, preferably an old style analogue moving coil model, and measure the amps and volts. Power = I * V. Job done.
Is it?We just happen to have a sensor buried deep in the SoC that measures what? Temperature. What determines that temperature? The amount of power being consumed by the SoC, and the relationship is well understood.
So Jim, if the temperature reported from my SoC is T, what is the power consumption of my Pi? Show your working for full marks.

I don't believe it's as easy as you make out.
Off the top of my head the only way to use temperature measurement to accurately determine the Pi power consumption is to build it into a Callendar and Barnes' continuous-flow calorimeter.
In which case the SoC temperature reading is of no use.
Do they still teach this stuff in high schools?
All in all it would be much easier just to get a cheap multimeter, preferably an old style analogue moving coil model, and measure the amps and volts. Power = I * V. Job done.
Memory in C++ is a leaky abstraction .
- Jim Manley
- Posts: 1600
- Joined: Thu Feb 23, 2012 8:41 pm
- Location: SillyCon Valley, California, and Powell, Wyoming, USA, plus The Universe
- Contact: Website
Re: Energy or Power Consumptions
Well, you can believe whatever you want, but I'm a scientist and an engineer, and I rely on facts and evidenceHeater wrote:I don't believe it's as easy as you make out.


To quote Tina Turner, "We nevah, evah, do anything nice ... and easy ... " If any of us here were into doing things the easy way, we certainly wouldn't be banging our heads against intractable problems using reduced instruction sets, constrained clock speeds and DRAM amounts, single USB 2.0 channels, non-UHS SD card access, and well, you know the rest. Where is your sense of intellectual curiosity, my friend?Heater wrote:All in all it would be much easier just to get a cheap multimeter, preferably an old style analogue moving coil model, and measure the amps and volts. Power = I * V. Job done.

The best things in life aren't things ... but, a Pi comes pretty darned close! 
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!

"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!
Re: Energy or Power Consumptions
Jim,
That is why I asked: "if the temperature reported from my SoC is T, what is the power consumption of my Pi?"
Still waiting for the answer....
I'm still not convinced it's as easy as you make out. Your results will also be grossly inaccurate.
Well, this Sputnik Kid is still curious.Where is your sense of intellectual curiosity, my friend?
That is why I asked: "if the temperature reported from my SoC is T, what is the power consumption of my Pi?"
Still waiting for the answer....
I'm still not convinced it's as easy as you make out. Your results will also be grossly inaccurate.
Memory in C++ is a leaky abstraction .
Re: Energy or Power Consumptions
The thermal resistance of a PoP BGA chip of that size, with that degree of under-chip heat-sinking must be well-known. I don't know it but chip manufacturers must. Thermal resistance is in degrees C per watt. QED.
- davidcoton
- Posts: 5685
- Joined: Mon Sep 01, 2014 2:37 pm
- Location: Cambridge, UK
- Contact: Website
Re: Energy or Power Consumptions
You will need to know the ambient temperature too. What you need is heat flow, not absolute temperature. If the ambient is controlled and therefore constant. the calculation should not be difficult (though I would be inclined to simply calibrate SOC temp against power measured conventionally, thus minimising inaccuracies). It's a little bit harder if the ambient temperature varies. It's not possible
if you don't know the ambient temperature.
.

Unfortunately that doesn't make you right all the time. I knowI'm a scientist and an engineer, and I rely on facts and evidence.





Location: 345th cell on the right of the 210th row of L2 cache
Re: Energy or Power Consumptions
rurwin,
Certainly knowing the thermal resistance gets you nowhere unless you know the ambient temperature. With knowledge of ambient that might get you to some ball park figure of energy consumption.
That assumes of course that the Pi SoC on a Pi PCB is providing exactly the same thermal environment that the manufacturer used in characterizing their chips.
All kind of inaccuracies will creep in. Board orientation. Random draughts over the board. Perhaps I fitted a heat sink (God forbid).
It's also totally ignoring the power consumption of any other devices on the board. And the effects of the PoP RAM chip.
And so on and so on.
Still, Jim is a "scientist and engineer". I look forward to seeing the results of his experiments and calculations using this technique. The "facts and evidence" as he so rightly says.
All in all it's quicker, easier and more accurate to use a 2 dollar multimeter.
Not quite QED yet I think.QED
Certainly knowing the thermal resistance gets you nowhere unless you know the ambient temperature. With knowledge of ambient that might get you to some ball park figure of energy consumption.
That assumes of course that the Pi SoC on a Pi PCB is providing exactly the same thermal environment that the manufacturer used in characterizing their chips.
All kind of inaccuracies will creep in. Board orientation. Random draughts over the board. Perhaps I fitted a heat sink (God forbid).
It's also totally ignoring the power consumption of any other devices on the board. And the effects of the PoP RAM chip.
And so on and so on.
Still, Jim is a "scientist and engineer". I look forward to seeing the results of his experiments and calculations using this technique. The "facts and evidence" as he so rightly says.
All in all it's quicker, easier and more accurate to use a 2 dollar multimeter.
Memory in C++ is a leaky abstraction .
Re: Energy or Power Consumptions
So I was thinking....
If we take up Jim's temperature measurement idea the missing ingredient is the thermal resistance of the Pi and the ambient temperature.
So, all we need is for some volunteer, say Jim
, to step up to the plate and measure the thermal resistance of all the Pi models.
With that data published and a knowledge of the ambient temp any one could arrive at a rough and ready estimate of their Pi power consumption.
If we take up Jim's temperature measurement idea the missing ingredient is the thermal resistance of the Pi and the ambient temperature.
So, all we need is for some volunteer, say Jim

With that data published and a knowledge of the ambient temp any one could arrive at a rough and ready estimate of their Pi power consumption.
Memory in C++ is a leaky abstraction .
Re: Energy or Power Consumptions
No need to measure the thermal resistance per se. For a rough n ready power estimate do it empircally. Plot measured current versus delta T & you have a curve which you can then use to estimate power on other similar Pis. You might even fit a curve to it (maybe it's straight line even) - call it Jim's Law. One problem thereafter - you either have to assume the ambient temp is the same as the plotted data, or measure it for more refined rough n ready guestimate.
-
- Posts: 690
- Joined: Tue Jun 16, 2015 6:01 am
Re: Energy or Power Consumptions
But to get you delta T don't you need another piece of hardware (like a DHT11)? I thought the original quest was to discover the consumption via software only, no other hardware required. Now we're just switching a US$1 power meter with a US$1 DHT11...gregeric wrote:No need to measure the thermal resistance per se. For a rough n ready power estimate do it empircally. Plot measured current versus delta T & you have a curve which you can then use to estimate power on other similar Pis. You might even fit a curve to it (maybe it's straight line even) - call it Jim's Law. One problem thereafter - you either have to assume the ambient temp is the same as the plotted data, or measure it for more refined rough n ready guestimate.
Account Inactive
Re: Energy or Power Consumptions
https://www.idt.com/document/apn/842-th ... -selection
Which gives example numbers of 20.5 C/W with 98% of the heat going out of the bottom, so PoP would not be an issue.
The major fly in the oinment is that it is the Ethernet chip that get hotter and I don't believe that comes with a temperature sensor. Because most of the heat goes out of the bottom*, even an IR sensor may not give a useful reading.
---
* Look at the heatsinking here: http://raspi.tv/wp-content/uploads/2015 ... t_1500.jpg
Which gives example numbers of 20.5 C/W with 98% of the heat going out of the bottom, so PoP would not be an issue.
The major fly in the oinment is that it is the Ethernet chip that get hotter and I don't believe that comes with a temperature sensor. Because most of the heat goes out of the bottom*, even an IR sensor may not give a useful reading.
---
* Look at the heatsinking here: http://raspi.tv/wp-content/uploads/2015 ... t_1500.jpg
Re: Energy or Power Consumptions
@gregeric,
It's the same thing.
In a known constant ambient temperature measure the input power I * V vs SoC temperature for two or more different power levels.
Stick a line through those points. To a first order it is straight. The slope of the line is degrees C per Watt. i.e. The units of thermal resistance.
OK. You might say that is a bit of a stretch because we are not taking into account other heat sources on the board. But, as you say, it's a calibration curve we could use.
SonOfAMotherlessGoat
I agree, a power meter would be better. But assuming the supply is 5v a multimeter will do and is a lot more useful elsewhere. Oh, and doesn't every home have a multimeter or two knocking around?
No need to measure the thermal resistance per se. For a rough n ready power estimate do it empircally. Plot measured current versus delta T & you have a curve which you can then use to estimate power on other similar Pis.
It's the same thing.
In a known constant ambient temperature measure the input power I * V vs SoC temperature for two or more different power levels.
Stick a line through those points. To a first order it is straight. The slope of the line is degrees C per Watt. i.e. The units of thermal resistance.
OK. You might say that is a bit of a stretch because we are not taking into account other heat sources on the board. But, as you say, it's a calibration curve we could use.
I like it. It will be as accurate as JimJim's Law

Not really (or I don't follow what you mean). The thermal resistance we have measured is a temp difference vs power. The user of that curve only needs to measure their ambient temp and take the difference between that and the SoC temp. As long as we are working around room temperature this will be accurate enough.One problem thereafter - you either have to assume the ambient temp is the same as the plotted data, or measure it for more refined rough n ready guestimate.
SonOfAMotherlessGoat
Yes, like a thermometer. I have never lived anywhere that did not have a thermometer or two around the house.But to get you delta T don't you need another piece of hardware (like a DHT11)?
I agree, a power meter would be better. But assuming the supply is 5v a multimeter will do and is a lot more useful elsewhere. Oh, and doesn't every home have a multimeter or two knocking around?
Memory in C++ is a leaky abstraction .
Re: Energy or Power Consumptions
T of the chip won't give you much precision at all.
Since the supply is a nominally constant 5V, you need at least a reasonably good log of the current. That is definitely external hardware to design and test. Expecting 0.2 to 0.6 Amps for most of the time (up towards ?2A at times?) is enough to choose a thing for that. Whilst an op amp and chart recorder could do that (using 1970's tech which can easily be borrowed in a university lab) there will be other ways now which take longer to set up but look tidier. The quickest to set up might be a multimeter and you write down with pen and paper mA with and without your test busyprogram running.
Since the supply is a nominally constant 5V, you need at least a reasonably good log of the current. That is definitely external hardware to design and test. Expecting 0.2 to 0.6 Amps for most of the time (up towards ?2A at times?) is enough to choose a thing for that. Whilst an op amp and chart recorder could do that (using 1970's tech which can easily be borrowed in a university lab) there will be other ways now which take longer to set up but look tidier. The quickest to set up might be a multimeter and you write down with pen and paper mA with and without your test busyprogram running.
Re: Energy or Power Consumptions
Ha haHeater wrote:I like it. It will be as accurate as Jimgregeric wrote:Jim's Law![]()

I didn't phrase that at all well. Was trying to say we can either assume the ambient temp, or we are forced to add another temperature sensor for ambient.heater wrote:Not really (or I don't follow what you mean). The thermal resistance we have measured is a temp difference vs power. The user of that curve only needs to measure their ambient temp and take the difference between that and the SoC temp. As long as we are working around room temperature this will be accurate enough.gregeric wrote: One problem thereafter - you either have to assume the ambient temp is the same as the plotted data, or measure it for more refined rough n ready guestimate.
-
- Posts: 690
- Joined: Tue Jun 16, 2015 6:01 am
Re: Energy or Power Consumptions
My immediate response was going to be "I have never lived anywhere that didn't have a multimeter or two around the house"... (And I didn't even think about the thermometer aspect, point well taken.)Heater wrote: Yes, like a thermometer. I have never lived anywhere that did not have a thermometer or two around the house.
I agree, a power meter would be better. But assuming the supply is 5v a multimeter will do and is a lot more useful elsewhere. Oh, and doesn't every home have a multimeter or two knocking around?
Account Inactive