Go Down

Topic: Atmega328p Power Saving Techniques (Read 6800 times) previous topic - next topic

Nick Gammon

Are you sure you have an Atmega328P and not just an Atmega328? Take a close look at the chip.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon


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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

bradley

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

dc42


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.
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.

CrossRoads

Atmel has picopower recommendations here as well, altho I suspect Nick has implemented most already. Floating inputs are definitely to be avoided.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

retrolefty

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

Nick Gammon

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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

bradley

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?




Nick Gammon


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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

bradley

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  XD. 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.

Nick Gammon

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?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

bradley

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?

buton

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...
visit www.diveduino.com

pito

#28
Apr 13, 2013, 10:49 am Last Edit: Apr 13, 2013, 10:53 am by pito Reason: 1
@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.. ;)

retrolefty


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

Go Up