Author Topic: Measure current Moteino  (Read 8171 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: 5857
  • 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: 1877
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: 306
  • 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: 1877
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: 869
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: 1297
  • 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: 869
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: 869
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: 1877
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: 5857
  • 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.