I've been reading Nick Gammon's post ( Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors) on power management for the ATMEGA 328p and I am having trouble reaching the same level of efficiency. I configured the fuses to use the internal 8MHz clock and it is connected to 2.5v. According to the post, it should be consuming 0.51ma. However, I'm measuring 5ma (yes I double checked, it says "ma"). I loaded script A (from Nick's post) to the ATMEGA as a baseline test.
void setup(){}
void loop(){}
My power supply is unregulated.
These are the fuses as read from avrdude:
lfuse: 0xe2
hfuse: 0xde
efuse: 0x07
That's "Sketch A" from Nick's article. He claims, "Running on 5V through the +5V pin, it draws about 46.6 mA." You're measuring 5 mA but expecting 0.51 mA. He also claims: Sketch A on a bare-bones board draws 15.15 mA (which is similar to your configuration).
Why are expecting the current consumption to be so low? 5 mA seems reasonable to me at half the clock speed, half the voltage, and no external crystal.
Or were you expecting the current consumption to be much higher than 5 mA and got the decimal in the wrong place (51 mA versus 0.51 mA)?
Or were you expecting the current consumption to be much higher than 5 mA and got the decimal in the wrong place (51 mA versus 0.51 mA)?
As I stated in my original question...
According to the post, it should be consuming 0.51ma
Search for "0.51 mA" in Nick's tutorial, it's titled "More savings with lower voltages" and is just over halfway down. That is the section I am referring to. According to the chart, it should be consuming 0.51 mA, unless I am misunderstanding something.
There's always a danger when writing lengthy articles like that, that you get something wrong. And indeed in this case, my test today does not confirm the results exactly.
I loaded the "empty" sketch. I set the low fuse to 0xE2. I supplied 2.5V to the device. And I measured 0.298 mA. So this is substantially better than the 0.51 mA. Not quite sure why.
I think you need to show a photo of your setup, including confirmation that you are supplying 2.5V.
I tried another multimeter and that one is measuring 2.7 mA. Closer, but not quite where I would expect. Yes, I confirmed the 2.5 V using both multimeters. I am using two NiMH rechargeable batteries in series. They are rated for 1.2 V, but I am measuring a little over from each. Is it possible the multimeters are just off? I noticed the second multimeter reads "Connect Test Leads". I can't make it go away.
The test leads should be in the "current" part of the meter (that is what the message is probably trying to tell you) and you put the meter between the battery and the circuit, not in parallel with it.
I didn't have an enclosure to keep the batteries in so I held them together. The meter is in series between the battery and the positive end of the circuit. I also tried another ATMEGA328p, same results.
I hope this helps. You will notice the meter has since changed, the other one was borrowed and since returned. This is the original meter I measured 5 mA with. The power source is two AA NiMH rechargeable batteries connected in series. The first image is confirmation on the voltage reading. The second image is how I am measuring the current.
Measure the current through just a resistor.
I measured through just a 10k resistor and read 0.46 mA. I'm not sure if that is what you were asking for. How does this measure the accuracy of the meter?
If you look at Fig. 30-334 on the atmega328p datasheet, it indicates that the typical active supply current @ 2.5V when using the internal 8MHz oscillator is about 2.4mA. So 2.7mA is about right. To get lower power consumption, you need to put the device in one of the sleep modes for most of the time.
btw your decoupling is inadequate. You should have a 0.1uF or greater ceramic decoupling capacitor between the Vcc and ground pins, as close to the chip as possible (put it over the top of the chip).
Every meter I've seen requires you to move the + lead to the "amps" socket (the one on the left in your case). Take a careful look at how it is labelled (I can't really read it from your photo). It looks to me like the RH socket says V / ohms, and the LH socket says amps.
That is because it has to put a shunt in series with the leads, and measure the voltage drop across it.
What model meter do you have? Judging by the manual I found for one of the Radio Shack meters you may have the lead in the right socket, but this is guess-work a bit.
I measured through just a 10k resistor and read 0.46 mA. I'm not sure if that is what you were asking for. How does this measure the accuracy of the meter?
If you connect a 10K resistor to your 2.5V battery, and measure the current, you should get 0.25 mA.
That is: current = voltage / resistance, or 2.5 / 10000, which is 0.00025 A
If you have this model: RadioShack® 29-Range Digital Multimeter Model: 22-813
I found this review:
This meter is just plan bad. I bought it to use with some solar projects. It works ok for things like say measuring a 20V panel but anything else it just seems to not work. I have the same problem of a negative reading on a battery or showing no voltage not matter what setting I try. Doesn't read any small things acurately, was not happy I spend a good chunk of change for something so bad.
(Caveat: under testing I found that it did not seem to work reliably much under 2.8V at 8 MHz).
When testing the power consumption I found it somewhat higher at first, presumably the bootloader was doing stuff. If you are not supplying enough voltage it might be resetting and using more power than you expect.
I've received quite a few responses and I would like to thank everyone for their input. I've come to accept the multimeter I bought is terrible. Thank you RadioShack. I should have realized that if it doesn't cost much, it's probably because it's not worth much. I recommend it to no one.
With that aside, I added the .01uF capacitors between the ground and Vcc pins as close to the chip as possible per dc42's request (and in Nick's page).
Nick, the socket on the right you couldn't read in the picture says V / ohms / mA. However, I moved to the left socket as suggested and I am seeing a reading that jumps between .002 and .003 Amps (2 - 3 mA). That's the highest resolution I can get from the socket. This reading is consistent with what I had from the borrowed (non RadioShack) meter and is also consistent with the ATMEGA328p datasheet as pointed out by user dc42.
Regarding the note on the ATMEGA328p's reliability under 2.8V @ 8MHz, I will keep this in mind. I tested with a 3V CR2032 and saw the roughly the same results for current. I also loaded a sketch to blink pin 13 and I didn't see any inconsistent blinking to indicate it is rebooting. The project this will be used in will run @ 3.3V, I just don't have an unregulated 3.3V power source at the moment.
Overall, I'm quite happy to see the current drop from about 16 mA to just under 3 mA, but I do see a conflict between what the ATMEGA328p datasheet states and what Nick's test is showing me.
I'm curious to see what other people are reading for current.
As dc42 points out, 2.5 mA or so is what the datasheet predicts. So, I'm setting up some new tests ...
Voltage Clock Current
(MHz) (mA)
5.0 16*a 16.5
4.0 16 9.1
3.3 16 6.7
3.0 16 6.0
2.5 16 1.0 did not run
5.0 8*b 12.3
4.0 8 5.5
3.3 8 3.7
3.0 8 3.3
2.8 8 3.0
2.5 8 0.4 did not run
*a Low fuse = 0xFF
*b Low fuse = 0xE2
You can see that the really low current I reported was an anomaly. Although it supposedly runs at 2.5V at 8 MHz in this case it wasn't. I uploaded the Blink sketch to check that the chip was alive, and measured the current during the "off" part of the blink cycle.
The figure above roughly agrees with the datasheet.
So, you might say that your measurements were correct, and my page was wrong. I had better fix it.
I originally had the same issue with 2.5V not running the sketch. I disabled brown-out detection by setting the extended fuse to 0x07 and that fixed it.
So it looks like 2.5 mA is normal for this circuit. That's still much better than 16.5 mA and is going to increase battery life in my project quite a bit.
Looks like I'm going to invest in a better meter. Merry Christmas me!