Pages: 1 2 [3] 4 5   Go Down
Author Topic: Atmega328p Power Saving Techniques  (Read 4327 times)
0 Members and 1 Guest are viewing this topic.
Rapa Nui
Offline Offline
Edison Member
*
Karma: 52
Posts: 1990
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
So you think there's no way I could get an IR receiver that draws 0.35mA to draw less and still work?
You can hardly get it afaik, but you may design such. I am currently coping with the same issue, the standard TSOP1738 from my junk box takes ~1mA. Thinking about a low power IR "detector" (few uAmps draw, detecting 38kHz infra signal), which wakes up the mcu and the mcu then switches on the 1738.
« Last Edit: April 13, 2013, 04:50:13 am by pito » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Nick: a quick comment - when you measure the voltage drop on a 1Meg resistor pls do consider a standard meter has ~10Meg internal resistance. So, 1Meg || 10Meg = 0.909Meg, thus your nA values will be 9% off.. smiley-wink

That's a very good point, and it shows the flaw in my plan. I don't normally measure current like that, and was trying to help the OP resolve whether or not his meter was wildly out. The uCurrent device doesn't have that flaw, as it amplifies the voltage drop across its internal resistor.

In fact, my reading was out by about 10% and you have explained why, thanks!
Logged

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Lefty - I think I know what you mean by latency time.

Mr. Gammon - With bare minimum code running on 3.3V, the atmega draws 46.6 mA. In its sleep mode, it draws .01mA. Correct me if I'm wrong,  but it seems the only way to wake the chip from sleep mode without drawing additional current from the system is through the internal watch dog timer. If this is the case, then is it possible to save more power using the watch dog timer to sleep for 200ms and wake for 7ms and during that 7ms of wake, you can power up the chip and pins and do an external pin interrupt to receive signal?

Also, is it possible to save even more power by achieving a "pulsed supply voltage" such that the voltage and current is just enough to receive signal as apposed to continuously drawing a constant power from the source?

Thanks for keeping up with my thread.

 



Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't have to use the watchdog, in itself that draws quite a lot of current.

My tests of interrupts (eg. pin change interrupts) show that you can be down to nano-amps until a key is pressed. See:

http://www.gammon.com.au/forum/?id=11497&reply=4#reply4

100 nA until a key is pressed.
Logged

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just tested your setup and it's really nice. I didn't have the keypad, so I just used a push button. But the real challenge here is how do I incorporate this setup with an ir receiver instead of a push button. The receiver needs a constant 0.35mA supply current in order to work. So it seems that there's no better way to save more power than use a watch dog timer fluctuating from 100nA to 0.35mA to wake the chip intermitedly.

Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Normally IR receivers are in mains-powered equipment (eg. a TV) and the sender (the remote) is battery powered. Trying to save power whilst detecting IR pulses is going to be problematic.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4534
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm between Sketch C and D in the link and reading 0.40mA after by turning ADC off. I should expect a huge power reduction according to his method, but I'm not. I don't know if I'm missing any steps leading up to that reduction, but if you could help, that'll be fantastic!

How are you measuring it? The error might be in the measuring device once you get down to these values.

Logged

No, I don't answer questions sent in private messages...

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@fungus - I got that problem solved. Thanks

@Mr. Gammon - Okay, so that concludes that for IR! I don't know much about rf transceiver, but could you help clear this up for me? I found an rf transceiver model nRF24L01 that takes about 900 nanoAmps in sleep mode, 22 microAmps in standby mode, and above 10milliA when transmit and/or receive. My questions are when this transceiver is in sleep or standby mode, can it receive signal or do you have to power it up for it to receive or does the signal cause it to power up from sleep mode?


Here's a link: Page 14 is where power consumption is at:

https://docs.google.com/viewer?a=v&q=cache:ANWvWgCEyaMJ:www.nordicsemi.com/eng/content/download/2730/34105/file/nRF24L01_Product_Specification_v2_0.pdf+&hl=en&gl=us&pid=bl&srcid=ADGEESjvGkOhVwt8_Dp3LKqfqZeASZGVzVX04R0alriMhtZwfG4NXR5ufvPKsYPNKC-FgnVFwibbZbhyXNJ_YDYMNdSkiMG-LrY544m2CsxP1ApsJ3LVzEBT2u_mmwS8yxC39q1PbF6R&sig=AHIEtbTIzEoK25INVW44oQYBPP-vWYbArw
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4534
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, so I tried your method and measured the voltage across the circuit which comes to about 4.8V. Putting a 1M Ohmz resistor in series and measured the drop across it comes out to 4.1V. Did Ohmz law and got 4100 nanoAmps.

I'm doing the same thing right now and getting very similar numbers (measured about 0.33mA current with my cheapo meter, got 4.1V with the 1M resistor).

I'm confused about what's happening though:

If the voltage drop across the 1M resistor is 4.1V, that means there's only 0.9V across the chip - not enough to keep running! How do I know it's sleeping properly?

« Last Edit: April 24, 2013, 09:20:29 pm by fungus » Logged

No, I don't answer questions sent in private messages...

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You know it sleeps properly when you are able to measure the current dissipation across the chip to be less than .1mA. The chip can go as low as .1uA if you set the fuses and clock correctly.

Make sure you don't have ANY other sensors or leds or "stuff" hooked up into your circuit, because they may be drawing power and current from the system. Don't have anything on your breadboard except for your atmega chip.
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4534
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You know it sleeps properly when you are able to measure the current dissipation across the chip to be less than .1mA. The chip can go as low as .1uA if you set the fuses and clock correctly.

I know that...my question is about how to accurately measure the current. I want to confirm that I'm setting the fuses and clock correctly.

Of course we're going to measure a small current if we put a 1 Megaohm resistor in a 5V circuit, Ohms law tells us it can't possibly be more than 5uA.

I want to know how this method tells us the current consumption of the AVR chip. It doesn't make any sense to me.
Logged

No, I don't answer questions sent in private messages...

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4534
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

More thoughts:

If I'm seeing a voltage drop of about 4V across my 1M resistor in a 5V circuit, that means the AVR chip has a resistance of about 250K at that moment in time.

Using that resistance value I can calculate current consumption with a real working voltage, eg. 2.5V from a coin cell.

At 2.5V the chip would use about 10uA (assuming the resistance stays the same). This is far more than the datasheet says it should draw. The datasheet says it should draw less than 4uA at 2.5V in sleep mode with watchdog timer enabled.

(nb. This is a Tiny85V, not a Mega328P...)

I guess what I need to do is find a resistor which gives me a voltage drop closer to the 2.5V target voltage.
Logged

No, I don't answer questions sent in private messages...

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 118
Posts: 4534
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok...some results.

I tried a 100K resistor and got about 4V drop across it (the same as the 1M resistor - weird!)

I tried a 10K resistor and got 2.27V drop across it. That gives 2.73V across the chip, which is in the right range.

But...2.27V across a 10K resistor is .227mA - two orders of magnitude higher than it should be.

So I'm as confused as ever. Going into sleep mode definitely uses less power (I can measure the difference!) but consumption doesn't seem to be anywhere near as low as it should be.

FWIW my sleep code is:
Code:
  set_sleep_mode(SLEEP_MODE_PWR_DOWN);
  sleep_enable();
  sleep_mode();

Brownout detection is disabled by fuse bits and the watchdog timer wakes the chip up after the correct amount of time (I've timed it).

Logged

No, I don't answer questions sent in private messages...

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So I'm as confused as ever. Going into sleep mode definitely uses less power (I can measure the difference!) but consumption doesn't seem to be anywhere near as low as it should be.

Did you read my reply #18 ?
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 33
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you set ADCSRA = 0?

Our measurements may not likely be the same based on several factors. Firstly, you're using a different chip. Secondly, I don't know what your setup looks like to determine what's wrong. It could be a software issue or hardware issue, such as something wrong with the wiring.

Are you asking how to accurately measure current of the chip using a multi-meter or with the 1M Ohmz method Nick showed?

Here, follow these steps to get your power readings: http://www.gammon.com.au/forum/?id=11497

I was able to get the Attiny85V chip down to pretty low power in the uA as well using these steps.
Logged

Pages: 1 2 [3] 4 5   Go Up
Jump to: