Author Topic: Measure current Moteino  (Read 9143 times)

baicunko

  • Newbie
  • *
  • Posts: 2
Measure current Moteino
« on: November 23, 2015, 06:45:50 PM »
Hey there,
I got two Moteino R4 and I'd like to improve my low power techniques. Therefore I need to be able to measure the current currently being used by the Moteino. How can I achieve this?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
  • Country: us
    • LowPowerLab
Re: Measure current Moteino
« Reply #1 on: November 23, 2015, 07:22:15 PM »
Hi,
With a RMS multimeter in "current measurement mode" would be a great start.
Remember current is not measured in parallel like voltage, but in series ;)

baicunko

  • Newbie
  • *
  • Posts: 2
Re: Measure current Moteino
« Reply #2 on: November 24, 2015, 05:27:27 PM »
Hey
I tested the current and I have some problems with what other people have said about power consumption.
Right now I have everything powered off and the Moteino measures 8 mA. whereas some people have said they manage to get 3 uA.
What am I doing wrong?
Code: [Select]
#include <LowPower.h>
#include <RH_RF69.h>
#include <SPI.h>
RH_RF69 radio;
void setup() {
 
  // put your setup code here, to run once:
 
}



void loop()
{
 

  // ATmega328P, ATmega168
  radio.sleep();
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); 


}

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Measure current Moteino
« Reply #3 on: November 24, 2015, 05:38:20 PM »
Hey
I tested the current and I have some problems with what other people have said about power consumption.
Right now I have everything powered off and the Moteino measures 8 mA. whereas some people have said they manage to get 3 uA.
What am I doing wrong?
Code: [Select]
#include <LowPower.h>
#include <RH_RF69.h>
#include <SPI.h>
RH_RF69 radio;
void setup() {
 
  // put your setup code here, to run once:
 
}



void loop()
{
 

  // ATmega328P, ATmega168
  radio.sleep();
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); 


}
Let's see...
  • I don't recognize the library you're using, it's not the standard Moteino radio library.
  • You're not initializing the radio so sleep might not be doing all you want.
  • If you have flash, you should initialize that and put that to sleep as well
  • You should change SLEEP_8S to SLEEP_FOREVER or, at least, put the LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF) statement inside an infinite while loop - don't rely on arduino loop because you don't know what's going on outside your own loop and you end up calling radio.sleep() everytime through the loop. 

Tom

syrinxtech

  • Sr. Member
  • ****
  • Posts: 310
  • Country: us
    • Syrinx Technologies
Re: Measure current Moteino
« Reply #4 on: November 25, 2015, 12:35:57 AM »
Tom,

He is using the RFM69 drivers from RadioHead.  I haven't compared their sleep() function to the LowPower sleep() function so I can't say how comparable they are.

I can say that just today my partner and I connected up a Moteino and initialized and put to sleep both the radio and the flash.  With a "SLEEP_FOREVER" parameter and a reed switch to wake up the Moteino, we were able to get the current down to 180 uA without really trying any of the fancier options.  I wouldn't swear to it but it seemed from our limited testing that initializing and then sleeping both the radio and the flash chip seemed to work the best.

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Measure current Moteino
« Reply #5 on: November 25, 2015, 07:20:55 AM »
Tom,

He is using the RFM69 drivers from RadioHead.  I haven't compared their sleep() function to the LowPower sleep() function so I can't say how comparable they are.

I can say that just today my partner and I connected up a Moteino and initialized and put to sleep both the radio and the flash.  With a "SLEEP_FOREVER" parameter and a reed switch to wake up the Moteino, we were able to get the current down to 180 uA without really trying any of the fancier options.  I wouldn't swear to it but it seemed from our limited testing that initializing and then sleeping both the radio and the flash chip seemed to work the best.
With that kind of combination, assuming that you're using the VR and running at 16MHz, I'd expect the current to be in the mid 20s (uA that is), maybe 30s (it's been so long since I ran a 328P at 16MHz I don't remember the current consumption).

Tom


obeard

  • Newbie
  • *
  • Posts: 5
Re: Measure current Moteino
« Reply #6 on: December 15, 2015, 09:06:20 AM »
Tom,

You've said here that you're running the Moteino at a lower speed than 16 MHz. Have you done this by changing the fuses on the 328P, or in software (such as some kind of clock prescalar)? I'm trying to implement this but I don't want to lock up my Moteino by messing with the fuses if I don't have to! Any advice you can give would be really helpful.

Cheers

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: Measure current Moteino
« Reply #7 on: December 15, 2015, 09:23:09 AM »
Quote
With that kind of combination, assuming that you're using the VR and running at 16MHz, I'd expect the current to be in the mid 20s (uA that is), maybe 30s (it's been so long since I ran a 328P at 16MHz I don't remember the current consumption).

Why so much? In power-down the oscillator doesn't run and the clock frequency shouldn't matter. Let's break it down. If everything sleeps you get

0.150uA for the 328p
0.1uA for the radio
1uA flash
2uA regulator

So should be < 3.5uA, no?

obeard

  • Newbie
  • *
  • Posts: 5
Re: Measure current Moteino
« Reply #8 on: December 15, 2015, 10:30:16 AM »
Hi Joe,

Yes, that was the impression I was under. However, I still seem to be drawing around 31uA, having executed all the ideas stated in the Nick Gammon tutorial (except the reduction of the clock speed), put the radio to sleep using radio.sleep(), put the flash to sleep using flash.sleep(), and put the Moteino into powerDown mode. I have attached my code for reference (if anyone can be bothered to glance through it!).

It is all rather puzzling to be honest! Shaving off these final few uA is proving rather difficult. I feel there is something in the microcontroller that I haven't turned off properly, but I cant seem to find out what.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1296
  • Country: us
Re: Measure current Moteino
« Reply #9 on: December 15, 2015, 11:04:44 AM »
@obeard: how exactly are you measuring the current?  I've read many a thread now where the discrepancy was ultimately traced to that.

@joelucid: For those of us relying on listen-mode to wake up the atmega328p, it occurs to me that if I were using the Moteino's regulator (as in the example under discussion), I'd be better off running at 16mhz instead of 8mhz.  At least in my case, the radio stays in Rx mode after it does a sync word match in Listen Mode, so the faster the atmega328p wakes up and handles whatever packets were received, the sooner the radio can be returned to listen mode.  Is that correct?

Within that framework, am I right that the only reason for running at 8mhz (or 4mhz for that matter) is to be able to run reliably directly off battery without a voltage regulator down to the lower voltages?

(For the benefit of others reading this, the RFM69 can, according to its datasheet, also operate on a minimum of 1.8v).
« Last Edit: December 16, 2015, 01:28:04 PM by WhiteHare »

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: Measure current Moteino
« Reply #10 on: December 15, 2015, 11:13:46 AM »
@obeard, I think you need to initialize the flash before you can put it to sleep. That could be the remaining problem. I use LowPower.powerDown, so I can't comment on the specific measures you took in your loop();

Joe


joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: Measure current Moteino
« Reply #11 on: December 15, 2015, 11:26:16 AM »
Quote
Within that framework, am I right that the only reason for running at 8mhz (or 4mhz) is to be able to run reliably without a voltage regulator down to the lower voltages?

It's that and being able to run with the internal oscillator. 16mhz takes a little less than double of 8mhz in terms of power consumption so if you don't have any busy waits 16mhz should save energy. However there are busy loops in many places (e.g. waiting for acks, waiting for rssi to come down in canSend(), sensor libraries etc). Therefore 8mhz will probably still save power in realistic settings.

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Measure current Moteino
« Reply #12 on: December 15, 2015, 03:03:39 PM »
@obeard, I think you need to initialize the flash before you can put it to sleep. That could be the remaining problem. I use LowPower.powerDown, so I can't comment on the specific measures you took in your loop();

Joe
I agree with Joe about initializing the flash before doing flash.sleep().  Also, try LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF) and see if that gives you different results.

Tom

obeard

  • Newbie
  • *
  • Posts: 5
Re: Measure current Moteino
« Reply #13 on: December 16, 2015, 06:26:57 AM »
Thanks for all the advice guys.

I have solved the issue now and am consuming around 2.3uA, as expected.

The issue I found was that the flash was not sleeping properly. Even when I initialize and then sleep the flash I was still getting an additional ~28uA current draw for some unknown reason. When I removed the flash chip the consumption was at the level I expected it to be.

Do any of you use the flash chip, or is it something to avoid for low power? I think I must not have been setting it up correctly, but I based my code on the examples which I assume could sleep the flash memory.

I've also found that when I use LowPower.powerDown the BOD isn't turned off (get around 19uA more current drawn) than when I do it at a lower level, as in the attachment I provided. Very strange, but I do seem to have found a way around these problems now!

Thanks again for all your help

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
  • Country: us
    • LowPowerLab
Re: Measure current Moteino
« Reply #14 on: December 16, 2015, 08:24:52 AM »
When you call the flash.sleep() it puts the chip in power-down mode. According to the datasheet this makes it only draw about 1uA. In standby (when chip not accessed or used) it draws around 10uA.

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Measure current Moteino
« Reply #15 on: December 16, 2015, 09:36:10 AM »
Thanks for all the advice guys.

I have solved the issue now and am consuming around 2.3uA, as expected.

The issue I found was that the flash was not sleeping properly. Even when I initialize and then sleep the flash I was still getting an additional ~28uA current draw for some unknown reason. When I removed the flash chip the consumption was at the level I expected it to be.

Do any of you use the flash chip, or is it something to avoid for low power? I think I must not have been setting it up correctly, but I based my code on the examples which I assume could sleep the flash memory.

I've also found that when I use LowPower.powerDown the BOD isn't turned off (get around 19uA more current drawn) than when I do it at a lower level, as in the attachment I provided. Very strange, but I do seem to have found a way around these problems now!

Thanks again for all your help
Did the flash chip ID match that coded in the SPIflash library?  If not, it won't initialize properly.  I've been using a flash chip from Adesto AT25XE041B that has pretty good ultra-low power down current (200nA) but you'll have to make changes to SPIFlash library to use it. 

Tom

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
  • Country: us
    • LowPowerLab
Re: Measure current Moteino
« Reply #16 on: December 16, 2015, 10:01:33 AM »
I've been using a flash chip from Adesto AT25XE041B that has pretty good ultra-low power down current (200nA) but you'll have to make changes to SPIFlash library to use it. 
Tom, nice power down current on that chip, I noticed it has the extra ultra power down mode, which gives the .2uA.
Unfortunately it's low count or not stocked at the major distros, also more pricey.
When I initially did my testing between different chips, the windbond came out as a clear winner in terms of speed of various operations also.
The windbond chip is abundant and still pretty good at 1uA in power down. I have yet to find a better alternative that is really worth to switch over to.

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Measure current Moteino
« Reply #17 on: December 16, 2015, 06:03:54 PM »
I've been using a flash chip from Adesto AT25XE041B that has pretty good ultra-low power down current (200nA) but you'll have to make changes to SPIFlash library to use it. 
Tom, nice power down current on that chip, I noticed it has the extra ultra power down mode, which gives the .2uA.
Unfortunately it's low count or not stocked at the major distros, also more pricey.
When I initially did my testing between different chips, the windbond came out as a clear winner in terms of speed of various operations also.
The windbond chip is abundant and still pretty good at 1uA in power down. I have yet to find a better alternative that is really worth to switch over to.
Sorry, I should have added that I'm not using this chip on a Moteino project.  I'm using it on another project that has a very aggressive power budget and requires flash.  There are others that claim to be lower but, as you say, not stocked...

Tom

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: Measure current Moteino
« Reply #18 on: December 17, 2015, 04:13:56 AM »
Quote
For those of us relying on listen-mode to wake up the atmega328p, it occurs to me that if I were using the Moteino's regulator (as in the example under discussion), I'd be better off running at 16mhz instead of 8mhz.

You know it strikes me that if you have a Moteino with regulator removed, and thus the external 16mhz clock it might be best to keep using it but program the CKDIV8 fuse to start up at 2mhz. You can then measure VCC on startup to select the lowest clock prescaler compatible with your current battery conditions and thus optimize performance.

Drawback is some of the Arduino library functions (e.g. delay()) won't work correctly since they're hard coded for a given CPU speed.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 310
  • Country: us
    • Syrinx Technologies
Re: Measure current Moteino
« Reply #19 on: December 17, 2015, 05:34:13 AM »
@obeard, I think you need to initialize the flash before you can put it to sleep. That could be the remaining problem. I use LowPower.powerDown, so I can't comment on the specific measures you took in your loop();

Joe

@joelucid, I agree.  I have found that first initializing the flash before putting it to sleep does help a little in current savings.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 310
  • Country: us
    • Syrinx Technologies
Re: Measure current Moteino
« Reply #20 on: December 17, 2015, 05:41:35 AM »
Tom,

You've said here that you're running the Moteino at a lower speed than 16 MHz. Have you done this by changing the fuses on the 328P, or in software (such as some kind of clock prescalar)? I'm trying to implement this but I don't want to lock up my Moteino by messing with the fuses if I don't have to! Any advice you can give would be really helpful.

Cheers

@obeard, when I want to drop down the clock speed I use the following code:

#include <avr/power.h>

CLKPR = 0x80;               // enable clock prescalar change
CLKPR = 0x4;                 // clock division = 16, 1 MHz

you can replace the 0x4 in the second line above to set the prescalar to whatever value you want

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Measure current Moteino
« Reply #21 on: December 17, 2015, 08:07:54 AM »
You know it strikes me that if you have a Moteino with regulator removed, and thus the external 16mhz clock it might be best to keep using it but program the CKDIV8 fuse to start up at 2mhz. You can then measure VCC on startup to select the lowest clock prescaler compatible with your current battery conditions and thus optimize performance.

Drawback is some of the Arduino library functions (e.g. delay()) won't work correctly since they're hard coded for a given CPU speed.
I like this, especially if you have a Moteino with the 16MHz crystal already attached.   Many of my motes run on 2 Lithium AA/AAA with the voltage nominally 3.4 V.  Having the option to tic up to 16MHz or down to 1 is very useful. 

And, if you know you're doing this, selecting a Divisor specific delay factor shouldn't be an issue (as long as you know WHERE the adjustments need to be made.)

Good suggestion!  Of course, the startup with CKDIV8 is essential for this to work reliably.

Tom

syrinxtech

  • Sr. Member
  • ****
  • Posts: 310
  • Country: us
    • Syrinx Technologies
Re: Measure current Moteino
« Reply #22 on: December 17, 2015, 08:11:33 AM »
@TomWS, you make a good point because the clock speed is used for timing with millis() and if you change the clock speed you need to adjust any appropriate timing routines.

I don't have any hard numbers but I know I've measured a drop in current usage as I go down in speed.  Particularly for motes like the mailbox, who needs a super-fast processor for one packet?

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Measure current Moteino
« Reply #23 on: December 17, 2015, 08:19:31 AM »
Tom,

You've said here that you're running the Moteino at a lower speed than 16 MHz. Have you done this by changing the fuses on the 328P, or in software (such as some kind of clock prescalar)? I'm trying to implement this but I don't want to lock up my Moteino by messing with the fuses if I don't have to! Any advice you can give would be really helpful.

Cheers
Sorry I missed this earlier...   Yes, I've changed the fuses to operate with internal 8MHz RC oscillator but will probably change future designs (at least those with 16MHz crystal - my own designs don't use a crystal) based on the suggestion Joe made: https://lowpowerlab.com/forum/index.php/topic,1431.msg10360.html#msg10360

I use a Pocket AVR Programmer (https://www.sparkfun.com/products/9825) to program fuses and haven't trashed a processor yet.  It's fairly easy to program the fuses (Sparkfun's tutorial is useful).   If you use this on a Moteino, be sure to put a 10K pullup resistor on D10.

Tom

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
  • Country: us
    • LowPowerLab
Re: Measure current Moteino
« Reply #24 on: December 17, 2015, 09:55:31 AM »
I use a Pocket AVR Programmer (https://www.sparkfun.com/products/9825) to program fuses and haven't trashed a processor yet.  It's fairly easy to program the fuses (Sparkfun's tutorial is useful).   If you use this on a Moteino, be sure to put a 10K pullup resistor on D10.
FYI this programmer cannot program an atmega1284p (MoteinoMEGA) or anything that has more than 64k flash.

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Measure current Moteino
« Reply #25 on: December 17, 2015, 11:54:41 AM »
I use a Pocket AVR Programmer (https://www.sparkfun.com/products/9825) to program fuses and haven't trashed a processor yet.  It's fairly easy to program the fuses (Sparkfun's tutorial is useful).   If you use this on a Moteino, be sure to put a 10K pullup resistor on D10.
FYI this programmer cannot program an atmega1284p (MoteinoMEGA) or anything that has more than 64k flash.
Why not?

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6265
  • Country: us
    • LowPowerLab
Re: Measure current Moteino
« Reply #26 on: December 17, 2015, 12:58:23 PM »
FYI this programmer cannot program an atmega1284p (MoteinoMEGA) or anything that has more than 64k flash.
Why not?
I read into the guide a little and they specify that it can't program anything above 64k.

TomWS

  • Hero Member
  • *****
  • Posts: 1924
Re: Measure current Moteino
« Reply #27 on: December 17, 2015, 06:41:59 PM »
FYI this programmer cannot program an atmega1284p (MoteinoMEGA) or anything that has more than 64k flash.
Why not?
I read into the guide a little and they specify that it can't program anything above 64k.
Well I don't understand why a serial programmer would have an addressing limitation unless it was written by a bone-head programmer ((or short sighted) or both)  9 years ago when I was a little kid  ::)

In any case...
Sounds to me like a software issue/challenge!

Tom
« Last Edit: December 17, 2015, 06:55:03 PM by TomWS »

WhiteHare

  • Hero Member
  • *****
  • Posts: 1296
  • Country: us
Re: Measure current Moteino
« Reply #28 on: December 17, 2015, 07:36:59 PM »
Quote
For those of us relying on listen-mode to wake up the atmega328p, it occurs to me that if I were using the Moteino's regulator (as in the example under discussion), I'd be better off running at 16mhz instead of 8mhz.

You know it strikes me that if you have a Moteino with regulator removed, and thus the external 16mhz clock it might be best to keep using it but program the CKDIV8 fuse to start up at 2mhz. You can then measure VCC on startup to select the lowest clock prescaler compatible with your current battery conditions and thus optimize performance.

Drawback is some of the Arduino library functions (e.g. delay()) won't work correctly since they're hard coded for a given CPU speed.

The ability to change frequency "on-the-fly"  also seems like it may be necessary if you want the option of utilizing every bit of available energy all the way down to 1.8v, especially in your coincell scenario where the voltage might nosedive while in use and not recover until later.  I guess you could sample the voltage from time to time and if the voltage is running low at the current frequency, force a reboot and then do as you suggest above.  Or maybe there's a more elegant way to transition from one frequency to another?

Somewhat related: I get the impression the bootloader is  hardcoded to run at a particular clock speed (mostly 16mhz or 8mhz on this forum).  Is that true?  If so, maybe it should be harcoded to run at 4mhz (or perhaps even less) if you want to maintain the option to do wireless programming all the way down to rock bottom 1.8v?

Anyhow, sorry for my ignorance, or if this has already been covered in depth somewhere else, but I'm just trying to visualize the final target so I can better steer my development toward it.

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: Measure current Moteino
« Reply #29 on: December 18, 2015, 01:18:46 AM »
Quote
The ability to change frequency "on-the-fly"  also seems like it may be necessary if you want the option of utilizing every bit of available energy all the way down to 1.8v, especially in your coincell scenario where the voltage might nosedive while in use and not recover until later.

Not really. Voltage dives when the load is greatest, and that's during rx/tx. During rx/rx the power consumption of the 328p can be pretty much neglected. So coin cell optimization is primarily about deciding if and when to use the radio and to introduce recovery periods before using it when vcc comes down. Obviously you also can't just sit in a busy loop forever but that's a secondary problem.

Btw the clock prescaler can be selected at runtime no problem. No reboot necessary. Check out the data sheet.

I do have my fuses set so I boot at 1mhz. My boot loader the pauses until voltage recovers. But that's for the case where something has gone wrong and the BOD caused a reset because battery voltage declined too much. Eg a never ending busy loop. Then the boot loader changes to 8mhz and does a careful dance of using the radio, sleeping until voltage comes back up etc until an updated version is completely installed.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1296
  • Country: us
Re: Measure current Moteino
« Reply #30 on: December 18, 2015, 09:39:26 AM »
Does that mean you're running off the internal resonator then?  If so, have you experienced anything negative (aside from possibly slower serial baud rates) from doing that?

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: Measure current Moteino
« Reply #31 on: December 18, 2015, 02:12:32 PM »
Yeah I always use the internal one for the bare bones battery nodes. For one thing the Tinos don't have an external crystal. And then it's just easier to treat all bare bones nodes the same. I have the wireless boot loader so I don't need serial. An advantage with crystal would be having an accurate clock at least when you're not sleeping. And as discussed yesterday the option of going to 16mhz with good batteries.

No real practical downside to speak of.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1296
  • Country: us
Re: Measure current Moteino
« Reply #32 on: December 18, 2015, 07:35:50 PM »
Thanks, that's good to hear there's no problem with SPI communication with the RFM69 if using the internal RC oscillator. 

Assuming I'm reading the datasheet properly, there's an additional benefit to using the internal RC oscillator, and that would be much faster start-up times when waking up from powerdown sleep:  just 6 clock cycles (750ns, if 8Mhz) if using internal RC oscillator (from Table 9-12) versus 16,000 clock cycles (2 milliseconds if 8Mhz) if using a crystal oscillator (Table 9-4).

Is that significant?  Well, if you were relying on Listen-Mode and you were waking up the radio once a minute, then that would equate to a savings of more than 17 minutes of "waking up" time for the moteino, and the same amount of time savings for the radio if it's in Rx mode waiting for the atmega328p to respond to its packet received interrupt.

So, assume current utilized by the radio is 16mA while in Rx mode.  So, that would be a savings of about 4.7mah for just the radio over the year, or about 47mah over 10 years. 

Well, it's not nothing, but if running off a couple of AA's, I'd struggle to call it significant. 

I need to measure how long it takes for the atmega328p to read a packet waiting for it from the radio's queue.  If it's 2ms or less at 8mhz, then staying at 8Mhz would save about the same amount (i.e. not much) as compared to running at 4mhz.  In that case, for simplicity, I think an argument could be made to just run at 4mhz (so I can chase declining battery voltage all the way down to 1.8v) and not worry about changing frequency.

However, if running from energizer utimate lithium batteries, even that might not be significant either, as I'd only recover about 5% (guestimate) of otherwise wasted battery energy, because the discharge curve is apparently so steep between 2.4v to 1.8v (i.e. 1.2v to 0.9v per cell). 

So, unless I'm overlooking something (?), then if running off a non-coincell battery, it seems I'm already at the point of diminishing returns, even if using an atmega328p that's running off a 16Mhz/8Mhz crystal.     :D

On the other hand, if running off a coincell for as long as possible, I can see how these optimizations might prove significant in a frequent usage scenario.

[Edit: On the other hand, if running on Alkaline batteries instead of energizer L91 lithium batteries, maybe running at 4Mhz does buy significant extra time.  8Mhz is good down to 2.4v, and there looks to be meaningful energy between 1.2 to 0.9v (per cell) in the alkaline discharge curve:

I have no idea what the dischare curves would look like for the much lower currents that would be drawn (certainly much lower than a constant 50ma), so it's hard for me to extrapolate.  Is it qualitatively similar?  Anyhow, I guess it's worth looking into--or perhaps just setting the clock frequency to 4Mhz and moving on--since for indoor use Alkaline's are certainly much cheaper than lithium's.  It would be nice to build just once for a probable worst-case and then have a single standardized platform going forward and never need to revisit this].
« Last Edit: December 19, 2015, 05:57:40 PM by WhiteHare »

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: Measure current Moteino
« Reply #33 on: December 19, 2015, 02:07:50 AM »
Not really. The Moteino uses a low fuse of DE which translates to 256 cycles on wake from powerDown. Still I wasn't aware of the difference. Thanks for pointing it out.

ulli

  • Jr. Member
  • **
  • Posts: 82
Re: Measure current Moteino
« Reply #34 on: December 24, 2015, 05:13:03 AM »
Has anybody thought about how a moteino could measure it's own power consumption?
Is there a way to do so with a shunt for example?

joelucid

  • Hero Member
  • *****
  • Posts: 867
Re: Measure current Moteino
« Reply #35 on: December 24, 2015, 09:57:36 AM »
Quote
Has anybody thought about how a moteino could measure it's own power consumption?

Not clear if that applies to your situation, but I've been doing some experiments with a moteino boosting it's own vcc lately and have used the time it takes a capacitor to discharge down to a certain voltage to measure it's power consumption.

This is particularly useful for sleep where just about everything you connect distorts measurements. E.g. my scope with it's 1MO impedance draws about 2-3uA. Better not to connect anything and report voltage after sleeping a minute.