Author Topic: How to measure average power use over time for small fluctuating circuit?  (Read 4074 times)

0 Members and 1 Guest are viewing this topic.

Offline ziplock9000Topic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: gb
I have a microcontroller project that has a few electrically moving parts including lots of sensors and power hungry WIFI modules and such. I want to get an accurate power use profile of the device that I can use to systematically reduce the device's power usage with the aim to hopefully get it working on batteries. To be able to do this, I need to be able to measure how effective each change I make to the device's code and electronics to compare to previous states of the system. This means I need to take a power snapshot of the device over a certain time window that is at least as large as a complete cyclic repetition of its power cycle. (This just happens to be 1 minute at the moment, each time the WIFI triggers)

I immediately realised that a DMM is no good for this so I used my DSO in roll mode to measure voltage (and by way of a dodgy 1 ohm current shunt resistor) and current over time. Using the DSO's built in maths function I multiplied the two two give me power over time.

Well.. It's not good enough for the following reasons:

1) On my DSO (Rigol DS1054) the maths function only works with data shown on-screen. This is not nearly accurate enough on either axis. On the Y axis there's just simply not enough bits of data and the output is quite quantised even when I use as much of the display as possible. The problem is even worse on the X axis (time) as data will fall off the end of the screen if the roll speed is too fast and sub-pixel data will not be registered if it's too slow. There's no good happy compromise between the two either, not without massive errors anyway.

2) Even if it did work well, the data is power over time and I really want *average* power over time for a certain time window.. Say 10 minutes, 1 minute, 1 hour, whatever I choose. Currently the repeating cyclical phases is about 1 minute but that might change.


How can I proceed with this on a budget?

(Just an FYI.. we are talking about current draws that are (very roughly) 0ma, 25ma, 75ma and spikes of 300mA)

I've attached an image of my crude attempts with my DSO
 

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #1 on: September 21, 2018, 06:56:14 am »
There are small, inexpensive power monitors that will do this. For example, I own one of these PortaPow devices and it works well.
 
The following users thanked this post: ziplock9000

Offline ziplock9000Topic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: gb
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #2 on: September 21, 2018, 06:58:40 am »
Interesting thanks. Do they measure down to a few mA and sample in the milliseconds?
Also can you specify the sample window duration?

Thanks.
 

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #3 on: September 21, 2018, 07:07:26 am »
Resolution is 1 microamp. I don’t know the sampling rate - but good question. You might need to contact the manufacturer. They’re in the UK.

Sample duration is manual - i.e. time it yourself... :)
 
The following users thanked this post: ziplock9000

Offline ziplock9000Topic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: gb
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #4 on: September 21, 2018, 07:12:56 am »
I've just realised it's a UK company for once, so no huge price hike from a US import for a change, bonus!  ;D

Yep, I've just sent them an email.

1 microamp is more than enough for me, but it's the sample rate that I'm worried about. Most of the example uses are for things like charging phones that don't have spikes etc.

Anyway this is a fantastic suggestion, thanks!  :D

(UPDATE: The display seems to update once a second.. If that's indicative of the sample rate then it's far too slow :/)
« Last Edit: September 21, 2018, 07:17:16 am by ziplock9000 »
 

Offline mzzj

  • Super Contributor
  • ***
  • Posts: 1245
  • Country: fi
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #5 on: September 21, 2018, 07:30:52 am »
RC filter with big capacitor can be very helpful in many cases when you need to average something. 
 
The following users thanked this post: ziplock9000

Offline ziplock9000Topic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: gb
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #6 on: September 21, 2018, 07:44:24 am »
Yeah that might work in the interim thanks.. I'm also toying with an idea of making something Arduino based but I really need something now.
 

Offline ziplock9000Topic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: gb
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #7 on: September 21, 2018, 08:28:16 am »
I found the answer from an mjlorton video. It's 3 samples/sec which is not even close to being fast enough....

 

Offline gamalot

  • Super Contributor
  • ***
  • Posts: 1305
  • Country: au
  • Correct my English
    • Youtube
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #8 on: September 21, 2018, 08:42:34 am »
Try your luck on ebay, those used DAQ equipment meets your requirements, I bought a Keithley KUSB-3108 (MCC DT9806 ) and spent only $80.
 
The following users thanked this post: ziplock9000

Offline ziplock9000Topic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: gb
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #9 on: September 21, 2018, 08:53:45 am »
Keithley stuff is usually very expensive in the UK and gets snapped up quickly. A bit out of my price range too.

But you've got me thinking about cheaper simple data acquisition USB devices. I'm taking a look at them now but don't see a sampling rate in the descriptions
 

Offline maukka

  • Supporter
  • ****
  • Posts: 107
  • Country: fi
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #10 on: September 21, 2018, 09:00:55 am »
If you're not in a hurry you could take a battery with a known capacity in Wh and see how long it lasts and calculate from that. If operating voltage is a concern, take into account the efficiency of the regulator.
« Last Edit: September 21, 2018, 09:04:16 am by maukka »
 
The following users thanked this post: ziplock9000

Offline ziplock9000Topic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: gb
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #11 on: September 21, 2018, 09:02:50 am »
Yeah that would work, but I was hoping for something a bit more elegant. It's looking more and more like a new Arduino based project maybe based on TM7705 based Data Acquisition Module. But I'd have to read up more on it.

500sps might be good enough:
https://www.instructables.com/id/Arduino-16-bit-500SPS-Dual-Channel-DAQ/
« Last Edit: September 21, 2018, 09:05:37 am by ziplock9000 »
 

Offline mzzj

  • Super Contributor
  • ***
  • Posts: 1245
  • Country: fi
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #12 on: September 21, 2018, 10:34:23 am »
One trick you can use for very low average currents is to use capacitor as a charge integrator. Measure voltage at the start and after 1 minute, calculate current from voltage drop and capacitance.
(For best results measure the capacitance)

If the capacitor size gets non-practical for higher currents or longer durations you can use Li-ion battery as a charge integrator.
Li-ion coulombic efficiency(amh-hours in vs amp-hours out)  is very high, for a good quality cell something in the range of 99% to 99,9% (you discharge 1Ah and charge 1.001Ah)
Measure the current during charge and charge to exactly same voltage where battery was when you started the discharge and you can get better than 1% accuracy.
 
The following users thanked this post: ziplock9000, schmitt trigger

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #13 on: September 21, 2018, 10:42:28 am »
Yeah that would work, but I was hoping for something a bit more elegant. It's looking more and more like a new Arduino based project maybe based on TM7705 based Data Acquisition Module. But I'd have to read up more on it.

500sps might be good enough:
https://www.instructables.com/id/Arduino-16-bit-500SPS-Dual-Channel-DAQ/

You don't need ultrahigh sped sampling in case only thing you want to measure - average power. The trick is - additional bulk capacitor between current shunt and device under test, to smooth current spikes and be able to run lower sampling rate.
 
The following users thanked this post: mtdoc

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3238
  • Country: gb
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #14 on: September 21, 2018, 02:52:13 pm »
Another possibility I have used in the past is to power the circuit from a pre-charged capacitor and measure the total voltage drop over a fixed period.  More suited to very low power circuits, so the wifi might discount this.
 
The following users thanked this post: ziplock9000

Offline mtdoc

  • Super Contributor
  • ***
  • Posts: 3575
  • Country: us
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #15 on: September 21, 2018, 05:56:57 pm »
You don't need ultrahigh sped sampling in case only thing you want to measure - average power. The trick is - additional bulk capacitor between current shunt and device under test, to smooth current spikes and be able to run lower sampling rate.

Yes, excellent point.  If the OP has a limited budget, that is really likely the only way he will be able to do what he wants.
 

Offline ziplock9000Topic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: gb
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #16 on: September 23, 2018, 03:39:14 pm »
One trick you can use for very low average currents is to use capacitor as a charge integrator. Measure voltage at the start and after 1 minute, calculate current from voltage drop and capacitance.
(For best results measure the capacitance)

If the capacitor size gets non-practical for higher currents or longer durations you can use Li-ion battery as a charge integrator.
Li-ion coulombic efficiency(amh-hours in vs amp-hours out)  is very high, for a good quality cell something in the range of 99% to 99,9% (you discharge 1Ah and charge 1.001Ah)
Measure the current during charge and charge to exactly same voltage where battery was when you started the discharge and you can get better than 1% accuracy.

What size capacitor would you recommend? 90% of the time the device is using ~26-40mA, with spikes up to maybe 400mA. The power cycle repeats itself after 1 minute, but I'd like to get a few repetitions of this if possible to average out over several cycles.

Thanks.
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #17 on: September 23, 2018, 04:30:53 pm »
What size capacitor would you recommend? 90% of the time the device is using ~26-40mA, with spikes up to maybe 400mA.

You shall specify "spike". Ambient temperature spike can last few days ;)
 

Offline ziplock9000Topic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: gb
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #18 on: September 23, 2018, 04:34:34 pm »
DSO screenshot in the OP.
I'd need to take further measurements at a higher time base to get accurate figures, but it's in the order of ~1ms  ;)
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #19 on: September 23, 2018, 04:57:30 pm »
DSO screenshot in the OP.
I'd need to take further measurements at a higher time base to get accurate figures, but it's in the order of ~1ms  ;)

It's easy then:



Source: https://en.wikipedia.org/wiki/Capacitance
 
The following users thanked this post: ziplock9000

Offline mzzj

  • Super Contributor
  • ***
  • Posts: 1245
  • Country: fi
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #20 on: September 23, 2018, 05:10:56 pm »
One trick you can use for very low average currents is to use capacitor as a charge integrator. Measure voltage at the start and after 1 minute, calculate current from voltage drop and capacitance.
(For best results measure the capacitance)

If the capacitor size gets non-practical for higher currents or longer durations you can use Li-ion battery as a charge integrator.
Li-ion coulombic efficiency(amh-hours in vs amp-hours out)  is very high, for a good quality cell something in the range of 99% to 99,9% (you discharge 1Ah and charge 1.001Ah)
Measure the current during charge and charge to exactly same voltage where battery was when you started the discharge and you can get better than 1% accuracy.

What size capacitor would you recommend? 90% of the time the device is using ~26-40mA, with spikes up to maybe 400mA. The power cycle repeats itself after 1 minute, but I'd like to get a few repetitions of this if possible to average out over several cycles.

Thanks.
Bit high current for ordinary electrolytic cap but totally doable with ultracapacitors
Lets say that your circuit uses about  50mA average and you want to measure 5 minutes = 60*5*0,05 = 15 Amp-seconds, if you use 15 farad capacitor the voltage would drop 1 volt.
1 volt drop is bit exessive unless its battery powered equipment, maybe aim for ~0.3 volt drop if its supposed to run from 5v fixed voltage supply, that would mean 45F ultracapacitor.
2x100F ultracapacitors  in series would handle 5 volt supply and give you 50F capacitance. Leakage current might need a further look depending on case.

Or just filter the crap out of it with enough big electrolytic after the shunt resistor, 1 ohm shunt and 100000uF capacitor will filter the 400mA 1ms peak down to 4mA
 
The following users thanked this post: ziplock9000

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4780
  • Country: pm
  • It's important to try new things..
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #21 on: September 23, 2018, 05:17:16 pm »
Quote
What size capacitor would you recommend? 90% of the time the device is using ~26-40mA, with spikes up to maybe 400mA.
You may try with two 600F 2.7V supercaps wired in series. That may give you a few minutes with 2A spikes max, with a drop from 5V to 4.5V. It may cost you $80 however.
Doublecheck the calculation, estimate only.

 
The following users thanked this post: ziplock9000

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #22 on: September 23, 2018, 05:39:10 pm »
If we assume that 0.1V drop is tolerable during 1ms spike @0.4A:

(0.4Amp * 0.001sec)/0.1Volts = 0.004 farads = 4000 uF. No need for supercapacitor.
 
The following users thanked this post: ziplock9000

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4780
  • Country: pm
  • It's important to try new things..
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #23 on: September 23, 2018, 06:07:37 pm »
The OP wants to measure over several minutes, afaik. Also, he/she is using a few "electrically moving parts", maybe servos. Therefore 2A peaks are possible..
 

Offline ogden

  • Super Contributor
  • ***
  • Posts: 3731
  • Country: lv
Re: How to measure average power use over time for small fluctuating circuit?
« Reply #24 on: September 23, 2018, 07:07:25 pm »
The OP wants to measure over several minutes, afaik. Also, he/she is using a few "electrically moving parts", maybe servos. Therefore 2A peaks are possible..

Several minutes? What you are talking about? If you need power supply for several minutes - don't use capacitor but power supply!  :D You know - one that is mains powered, ok? Bulk capacitor is needed to store enough energy for high current spike which is specified by OP as 0.4A, to decrease dV/dT - so you can sample current/voltage at lower sample rates.

If you wonder what I and OP are talking about here, you are advised to read my  post:

Yeah that would work, but I was hoping for something a bit more elegant. It's looking more and more like a new Arduino based project maybe based on TM7705 based Data Acquisition Module. But I'd have to read up more on it.

500sps might be good enough:
https://www.instructables.com/id/Arduino-16-bit-500SPS-Dual-Channel-DAQ/

You don't need ultrahigh sped sampling in case only thing you want to measure - average power. The trick is - additional bulk capacitor between current shunt and device under test, to smooth current spikes and be able to run lower sampling rate.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf