Go Down

Topic: Getting Atmega into uA Standby? (Read 1 time) previous topic - next topic

Jiggy-Ninja

The datasheet shows:
Power Consumption at 1MHz, 1.8V, 25°C
Power-down Mode: 0.1μA

So I was going for that.
I'll repeat what olf2012 said: The clock frequency does not matter, because it is OFF while the micro is asleep. That's what sleeping means in a microcontroller.

Also, you won't reach 100 nA like this. That spec is with literally everything possible turned off. You are using the watchdog timer to wakeup, which IIRC consumes 10 uA of current.

Right now you have too many variables. Remove the code that flashes the LED, remove the code that sets up the watchdog timer, and just put the controller to sleep. Focus on learning how to sleep properly first (and get your current consumption down), then learn how to wake up, then learn how to do things while awake.

Do you have decoupling capacitors on the board? If no, fix that now.
Hackaday: https://hackaday.io/MarkRD
Advanced C++ Techniques: https://forum.arduino.cc/index.php?topic=493075.0

pi_and_chips

Do you have decoupling capacitors on the board? If no, fix that now.
Hmm well that's interesting....

Using the breadboard setup as before (just the atmega powered by the Nano 3V3 and GND pins), I've added the decoupling caps of 0.1uF (100nF) across both of the Atmega's VCC and GND pins and the current consumption goes up..

With Decoupling I get 2.88mA and without decoupling I get 1.41mA....


I was using this sketch:



Code: [Select]

//LOW POWER BASE LINE TEST SKETCH H FROM NICK GAMMON FORUMS - https://www.gammon.com.au/forum/?id=11497


#include <avr/sleep.h>
#include <avr/wdt.h>


 
// watchdog interrupt
ISR (WDT_vect)
{
   wdt_disable();  // disable watchdog
}  // end of WDT_vect
 
void setup () {
 
 
  }

void loop ()
{
 
  // disable ADC
  ADCSRA = 0; 

  // clear various "reset" flags
  MCUSR = 0;     
  // allow changes, disable reset
  WDTCSR = bit (WDCE) | bit (WDE);
  // set interrupt mode and an interval
  WDTCSR = bit (WDIE) | bit (WDP3) | bit (WDP0);    // set WDIE, and 8 seconds delay
  wdt_reset();  // pat the dog
 
  set_sleep_mode (SLEEP_MODE_PWR_DOWN); 
  noInterrupts ();           // timed sequence follows
  sleep_enable();
 
  // turn off brown-out enable in software
  MCUCR = bit (BODS) | bit (BODSE);
  MCUCR = bit (BODS);
  interrupts ();             // guarantees next instruction executed
  sleep_cpu (); 
 
  // cancel sleep as a precaution
  sleep_disable();
 
  } // end of loop



Now I am totally confused.... lol



justjohn

You may be having same problem I was having - thinking my meter could measure something that it couldn't, just because it had uA on it, and seemed to have the resolution I needed. I just never measured anything this small. Have a look at this.

justjohn

I figured it to be a "meter problem" after watching  this video,  seeing actual results of various sleep modes on his meter, and then actually running his sample code linked to at that video, getting the same wrong results from my meter. Then, I figured it was a problem with my meter, and finally figured out my meter just wasn't capable of reading uA in that way.

I felt just a little bit like a "nit-wit," but it won't be the first time, and likely not the last. :-/

pi_and_chips

Hi all and thanks once again for all your contributions and help.


PROBLEM NOW SOLVED:-

It turns out my instincts were correct. It was all down to the Atmega328P-PU IC I was using. No matter what I did or tried with it, I couldn't get it to draw below 1.4mA.

Having wasted three days this week waiting in for useless UPS to deliver my Atmega's from Farnell, I decided to have a rummage around my scraps box and I found an old project with an Atmega328P-PU to use.

I uploaded my test code to it and low and behold it worked.


My project dropped down to a current consumption of 200uA which is well under my target of 500uA and that figure also includes the MP1584EN Buck module powering the Atmega at 3.3V :)

So I'm well pleased.


----Side Note Mini Rant Warning------

I am not so pleased with UPS on the other hand whose tracking website stated my Farnell order would be delivered by the end of the day Monday which then became Tuesday which then became - tracking information unavailable.

And as a first time customer, I am also less than impressed with Farnell's customer service / email support responses. Having contacted them Wednesday to chase the issue up with their courier, I got ZERO response or acknowledgement. Sent a second Email on Thursday and still no reply.

Wont be bothering with them again if this is what I can expect.

Sorry for the little rant at the end but I got quite annoyed by it. As a customer, no matter how little I spend, I don't expect to be the one having to do all the chasing around for my goods and getting ignored once you've had my money.


Anyway, I've sorted my issue now and I've got a nice low powered Atmega so I'm happy.


Thanks again!


justjohn

#20
Dec 12, 2017, 10:50 am Last Edit: Dec 12, 2017, 12:08 pm by justjohn
I too got it working down to .2uA in power-down mode - actually just a bit less. Used a friend's uCurrent (the one from Dave Jones - eevblog.com) that I mentioned above. I just took a factory pdip chip, using it at default 8MHz, compiled some power-down code in the arduino IDE, then used Atmel studio to program the chip with the .hex results from the compilation, so I didn't have to deal with putting a bootloader on. Plugged it into a solderless breadboard, and it worked great.

justjohn

Concerning what I just wrote about how I got the code onto the board, most here probably know of the many ways to do this. But for those who may not, the way I did it was with Atmel Studio. I just plugged the atmega328p into the arduino and used it's ISP connected to AVR MKII programmer, which is a pretty easy way to do it along with a solderless breadboard (bare chip set to factory internal 8MHz so no need for xtal or caps). Since the code I used was mostly just direct-write to the chip's registers, I could have also just done the whole thing in the AtmelStudio, but wanted a copy with all my other arduino code stuff.

DrAzzy

#22
Dec 12, 2017, 10:36 pm Last Edit: Dec 12, 2017, 10:39 pm by DrAzzy
----Side Note Mini Rant Warning------

I am not so pleased with UPS on the other hand whose tracking website stated my Farnell order would be delivered by the end of the day Monday which then became Tuesday which then became - tracking information unavailable.
It is December. UPS and all the major shipping carriers always struggle this time of year due to the huge volume of e-commerce shipping for christmas shopping. Even with the extra day they add to ship times at UPS, they still can't be counted on to meet their advertised shipping times in December. It sucks, but like, you should know to expect this just like you would expect crowds in the mall this time of year.

Are you in the USA? If so, you want to use Digikey or Mouser, and you want to use the USPS First Class or USPS Priority shipping options. Farnell is not the same tier of operation over here as Digikey or Mouser. Digikey is IMO a little better in terms of shipping options (mouser won't do first class, which means shipping starts at like 7 instead of 3 bucks), but mouser often has better selection

Were you using a 328 instead of a 328p?
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up