Pages: 1 [2] 3 4 5   Go Down
Author Topic: Atmega328p Power Saving Techniques  (Read 5161 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you sure you have an Atmega328P and not just an Atmega328? Take a close look at the chip.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

What meter are you using? I'm going to get one like it.

Me? It's an HP 3457A bench multimeter I got from eBay. It wasn't cheap, I warn you.
Logged

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

Definitely says Atmega328P-PU. I will try the method you offered earlier and see what I get. Will report back tomorrow!
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
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

The only pins connected to the chip comes from the AVRISP mkii pinout for uploading sketches.  

Then you have floating pins, which increases the power consumption. Either connect all the I/O pins to +5V or ground (through resistors if you like), or enable the internal pullup resistors, or set them to be outputs, or disable the digital data input buffers.
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.

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 518
Posts: 26378
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Atmel has picopower recommendations here as well, altho I suspect Nick has implemented most already. Floating inputs are definitely to be avoided.

* AtmelAVR4013 picoPower.pdf (92.43 KB - downloaded 11 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17261
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Measuring very low current is fraught will inaccuracies due to 'meter burden' even with very expensive DMMs. If you really want accurate readings to try and optimize power saving tests and such consider buying or building a proper four wire current sensing device with proper low level amplification. This one is very nice, useful, and affordable:

http://www.adafruit.com/products/882

And all the info and video explaining it's design:
http://www.alternatezone.com/electronics/ucurrent/

Lefty
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh, yeah, I'd forgotten I had one of those. For around $60 it's very useful for measuring low currents. On the nanoamp range it puts the device through a 10K resistor, and then amplifies the result, giving 1 mA of output voltage (which you read with a voltmeter) per 1 nA of current.

I did what I described above, shorted the terminals while the Atmega328P powered up, and then removed the short. I read 119 mV which corresponds to 119 nA, which agrees pretty closely with the other figures I reported.

And to be honest, I hadn't tied any pins to ground or anything, so you might possibly achieve extra savings by doing that. Although once asleep I suspect it doesn't make a lot of difference.
Logged

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 33
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.

So I went back to reading your first question which was "Are other devices drawing power, eg. voltage regulators?". I looked at my board and yep, there a speaker pin and led pin that was drawing power which wasn't connected to the chip. I unplugged all of them and now it really is "bare-bone" (also disconnected the programmer) and re-measured the current and finally it's at 120 nanoAmps! Now I can continue to sketch E on your site.

Also, is it possible to wake the chip from sleep using a button press without using keypad2.h, but instead with a pin Interrupt function?



Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I unplugged all of them and now it really is "bare-bone" (also disconnected the programmer) and re-measured the current and finally it's at 120 nanoAmps!

Ahaaa!

At least your reading almost exactly agrees with mine, now that you removed all the extra stuff *cough* .

Also, is it possible to wake the chip from sleep using a button press without using keypad2.h, but instead with a pin Interrupt function?

http://www.gammon.com.au/forum/?id=11488&reply=6#reply6

But basically you adapt reply #4 on the power-saving page. Yes, pin-change interrupts can wake it. Useful for TV remotes, that sort of thing.
Logged

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

Quote
Ahaaa!

At least your reading almost exactly agrees with mine, now that you removed all the extra stuff *cough* .

Aha, definitely my beginner's mistake!

Since you told me about TV remotes, I went out and got an IR receiver and tried out the pin interrupts. I'm almost done reading and testing the page you linked about interrupts  smiley-lol. Very interesting and thorough!

Anyway, I want to ask you a couple of questions. The IR receiver has 3 pins: one for GND, one for voltage, and one for data. The datasheet for it says it takes in a supply current of 0.35mA. In order for it to receiver signal, it must constantly draw this much power from the circuit. Here's what I'm wondering: Is it possible to use the low power interrupt function to give full power to the IR receiver to power it up for the next key press signal?

Let me try to clarify. Instead of having the voltage pin hook up to the voltage rails, I would hook it up to one of the analog pins (let's say pin A0) on the atmega328 chip just outputting a tiny bit of voltage to give it power (much lesser than 0.35mA of course). I would hook the data pin to the interrupt pin 2 and GND pin to GND. Now, when I press a remote button (let's say power button), the interrupt would fire and in turns set the analog pin A0 to high and provide 0.35mA for the voltage pin and awaits for the next key press. After some time of not receiving a signal, it would go back to sleep mode and save power.

Would this work? The point here is to try to draw even less power from external power-drawing sensors.
 
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is it possible to use the low power interrupt function to give full power to the IR receiver to power it up for the next key press signal?

Huh? Normally IR receivers are in some sort of mains-powered device.

It's the transmitter (the battery powered remote) where you need to save power.

What are you really trying to do here?
Logged

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

Well, in my head, I always thought the receiver is the one that's always on listening for the transmitted signals. So it's consuming a lot of power when hooked it up to the the atmega chip.

If I was working with a transmitter, I wouldn't try to save power as much, because the power is only consumed when you press a button.

So you think there's no way I could get an IR receiver that draws 0.35mA to draw less and still work?
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

this is a great thread...

i tested my setup which has a 3.3v regulator and also a tmp102 attached.

first i was having a SMD led for power indicator and while sleep it was asking for 3 mA while sleeping, i took that LED out and now it takes about .1mA sleeping with this code...
Logged


Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2064
Pukao hats cleaning services
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
« Last Edit: April 13, 2013, 03:53:06 am by pito » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17261
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well, in my head, I always thought the receiver is the one that's always on listening for the transmitted signals. So it's consuming a lot of power when hooked it up to the the atmega chip.

If I was working with a transmitter, I wouldn't try to save power as much, because the power is only consumed when you press a button.

So you think there's no way I could get an IR receiver that draws 0.35mA to draw less and still work?

Depends on how much 'latency time' you (or the person operating the IR transmitter) can live with. You could power the IR receiver Vcc pin with a digital output pin set HIGH only when the AVR is awake, so how long you sleep Vs how often you wake to check if there is a IR data stream arriving would dictate the latency time of your IR link if that makes sense?

But if you want the transmitted IR data to be the wake up signal for a sleeping AVR then you can't have the IR receiver powered off of course.

Lefty
Logged

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