Atmega8A power down current with pull-ups enabled

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good day!

I'm playing with power down sleep mode on ATmega8A (I know that ATmega88 is way better in power consumption, but it is not easily accessible locally).

My test case is bare ATmega8A on a breadboard with Vcc 5V (programmer is detached during measurements)

Here is my code

#include 
#include 
#include 

// LED pin
#define	LED_DDR		DDRB
#define LED_PORT	PORTB
#define LED_BIT		PINB5
   
int main(void) 
{
	// Set pin as output
	LED_DDR |= (1 << LED_BIT);

	for (uint8_t i = 0; i<3; i++)
	{	
		LED_PORT |= (1 << LED_BIT);
		_delay_ms(500);
		LED_PORT &= ~(1 << LED_BIT);
		_delay_ms(500);		
	}   

	LED_DDR &= ~(1 << LED_BIT);


// Outputs, set to low ~ 1uA
	DDRD = 0xFF;
	PORTD = 0;

	DDRB = 0xFF;
	PORTB = 0;

	DDRC = 0xFF; 
	PORTC = 0;


// Inputs, with pull-up ~ 100uA 
/*	DDRD = 0;
	PORTD = 0xFF;

	DDRB = 0;
	PORTB = 0xFF;

	DDRC = 0; 
	PORTC = 0xFF;
*/	
	set_sleep_mode(SLEEP_MODE_PWR_DOWN);
	sleep_enable(); 
	sleep_mode(); 

}

The problem:

- When I configure all pins as outputs low before sleep -- power consumption is around 1uA (as per datasheet)

- When I configure all pins as inputs with internal pull-ups, the power consumption is around 100uA. The datasheet recoments to put all pins with inputs with internal pull-ups for sleep modes and here is such graph:

Questions:

1. Is this current (100uA) is lost in internal pull-ups (20 to 50 kOhm)?

2. Why datasheet suggests to enable pull-ups and not configure as output low?

Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

ATmega8A (I know that ATmega88 is way better in power consumption, but it is not easily accessible locally).

That sounds really strange, as Mega8A is a new model and 88 family has been in production for many years, including new models. Can we ask where you are located?

Quote:

- When I configure all pins as inputs with internal pull-ups, the power consumption is around 100uA.


Tell what is attached to all pins during your test. Internal pullups should draw no current by themselves, if the pins are not connected.

Your code suggests you have LEDs attached. In active-high configuration? That would explain things...

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
Quote:

ATmega8A (I know that ATmega88 is way better in power consumption, but it is not easily accessible locally).

That sounds really strange, as Mega8A is a new model and 88 family has been in production for many years, including new models. Can we ask where you are located?

I'm from Ukraine. That's really strange, and hard to believe from USA :) Here are local prices from low-cost supplier: Atmega8A -- $2.5, ATmega88 - $6 (and out of stock), ATtiny2313 -- $2.5 (all in DIP, SMD prices are lower, but the same story). Locally I can buy only ATmega8A, ATmega16, ATmega32, ATtiny13, ATtiny2313 :)

Quote:

Tell what is attached to all pins during your test. Internal pullups should draw no current by themselves, if the pins are not connected.

Your code suggests you have LEDs attached. In active-high configuration? That would explain things...


Yep, the single pin is in active high. Do you mean that there is a leakage through this LED when pullups are enabled?

Update: when I remove LED it works as expected. Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

artvolk wrote:

Yep, the single pin is in active high. Do you mean that there is a leakage through this LED when pullups are enabled?

Of course - you are just turning the LED on through the pull-up. You should have it output low if you want to have the LED off and avoid any current.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you, now I got it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I'm from Ukraine. That's really strange, and hard to believe from USA Smile Here are local prices from low-cost supplier: Atmega8A -- $2.5, ATmega88 - $6 (and out of stock), ATtiny2313 -- $2.5 (all in DIP, SMD prices are lower, but the same story). Locally I can buy only ATmega8A, ATmega16, ATmega32, ATtiny13, ATtiny2313 Smile

I can never quite understand this. Surely you can buy anything you want via mail-order.

Chinese prices are cheap but you have to wait some 10-14 days for delivery.
You will possibly have to pay customs duties and some local taxes too.

You just have to add up the total cost of 'foreign' mail order, and compare with local mail order.

In England, I can have next-day delivery of most components ever made, but pay more for the parts.

I suppose that there will be some cities in the world that have retail shops you can visit. Be realistic. They are always going to have a smaller range of stock items than a mail order business.

David.