ATMEGA328p Standalone 8MHz @ 2.5v

has everyone including nick been ignoring the fact that unconnected inputs can increase current big time? ive seen a 1000:1 variation in consumption when running empty endless loop like used here simply by waving my hand near the chip. internal or external pullups are essential in low current tests like this. and you must remember to disconnect programming leads too before making measurements.

Can you or anyone else post some tests? I can't until I buy a new meter.

I think the unconnected inputs would make a difference, but only once you get into low power modes (ie. sleep). My measurements previously indicated configuring the pins as outputs made a difference, but we are talking around 1 microamp, not milliamps.

A quick test shows that waving the hands over the bare leads (on my bare-bones board) seems to make some minor differences, but the readings weren't steady anyway. Quite possibly because I hadn't grounded the pins.

Another test had all pins set to input with internal pull-ups. That should have been reasonably resistant to noise. However if anything it consumed slightly more (4.82 mA compared to 4.75 mA).

I don't see any evidence of 1000 x more consumption with the pins floating. However once again this was not in sleep mode.

This test (running at 2.5V) consumed 100 nA (0.1 uA):

#include <avr/sleep.h>
 
void setup() 
  {
  for (int i = 0; i <= A5; i++)
    {
    pinMode (i, OUTPUT);
    digitalWrite (i, LOW);
    }
  // disable ADC
  ADCSRA = 0;  
  // turn off various modules
  PRR = 0xFF; 
  set_sleep_mode (SLEEP_MODE_PWR_DOWN);  
  sleep_enable();
  sleep_cpu ();          
}

void loop() { }

So, sleep mode is the way to go. :slight_smile:

Setting the pins output and low seemed to rule out having to worry about floating inputs.

[quote author=Nick Gammon link=topic=138473.msg1042891#msg1042891 date=1356307812]My measurements previously indicated configuring the pins as outputs made a difference, but we are talking around 1 microamp, not milliamps. [/quote]

ive seen it range into amps with unconnected pins on at90s1200. the chip not only got too hot to hold but started smoking. rare but ive seen that happen more than once. probably due to lockup or oscillation rather than sitting at threshold but definitely caused by floating pins. modern avrs have improved design to help with this but still not to be ignored. of course we are entitled to our own design practices but imo good idea to be careful when doling out advice to those less experienced.

in virtually all avr docs:

atmel: One of the most important considerations is to ensure a defined level on all I/O pins. A floating pin will give a significant increase in the overall power consumption.

also here:

MarkT: Basically any "standard" CMOS input stage is an inverter and will consume non-trivial power if the input is somewhere in the middle of the range (the "forbidden region"). Here non-trivial means its an issue for battery-powered circuitry in sleep mode - something on the scale of 1mA might flow from that one input circuit when the whole chip is supposed to be shutdown (a few uA usually).

atmel recommends at least activating the built-in pull ups. considering it costs nothing i suggest its good advice.

On my power saving page: Gammon Forum : Electronics : Microprocessors : Power saving techniques for microprocessors

I have this:

  • All pins as outputs, and LOW: 0.35 uA (same as before).
  • All pins as outputs, and HIGH: 1.86 uA.
  • All pins as inputs, and LOW (in other words, internal pull-ups disabled): 0.35 uA (same as before).
  • All pins as inputs, and HIGH (in other words, internal pull-ups enabled): 1.25 uA.

All pins inputs and low is the one case where floating voltages might affect it. My test above had outputs and low, so that should not be susceptible to floating voltages.

Page 43 of the Atmega328P datasheet says:

9.10.6 Port Pins

When entering a sleep mode, all port pins should be configured to use minimum power. The most important is then to ensure that no pins drive resistive loads. In sleep modes where both the I/O clock (clkI/O) and the ADC clock (clkADC) are stopped, the input buffers of the device will be disabled. This ensures that no power is consumed by the input logic when not needed. In some cases, the input logic is needed for detecting wake-up conditions, and it will then be enabled. Refer to the section ”Digital Input Enable and Sleep Modes” on page 79 for details on which pins are enabled. If the input buffer is enabled and the input signal is left floating or have an analog signal level close to VCC/2, the input buffer will use excessive power.

This suggests that the input pins are disabled anyway (especially since I do not have any configured to wake it up).

So it would seem you don't need to obsessively put pull-down (or pull-up) resistors on all unused pins, since in the deep sleep modes the pins will be disabled. And if you had one configured as an interrupt to wake it up, presumably that would not be floating.

However I take it as a good point that in some sleep modes, floating voltages on input pins could well be a bad idea.

id have to agree that disabling input buffers is a better solution for unused pins. that way it dont matter what they might be connected to or what mode the chip is in. out of habit i use the pull ups because not all avrs have that capability and it is a little easier.

btw thanks for directing me to your field programmer project a while back. not so much for the usbasp problem but very useful being able to quickly burn lots of chips w/o having to lug around a pc.

Its probably like my meter, the regular (non shunted) terminal has a max 200ma current measue ability and it works just like that
You could alternatively put a precision 1 or .1ohm resistor in series with the supply and measure the mv across it to get the current

precision 1 or .1ohm resistor

They are tough to find.

Alternatively, you can use a small power resistor (0.1, 0.22, or 0.47ohm, or in parallel), to measure the current. You can calibrate / measure the resistor's value via a constant current source.

Hard part is having a reliable precision device to start with to calibrate thr rest, unless its a precision current source it won't be accurate, unless its a precision resistor it won't be accurate, might as well just buy a better multimeter lol

unlikely you need one part per million accuracy. 10% is probably fine. and power resistor is definitely not required. regular tiny 1ohm, 10ohm, or 100ohm of any low wattage will do here. at really low reading even 1k may work. or maybe replace the fuse in that meter. #1 cause of bad meters is using any of the the current ranges to measure across a high current supply like a battery. guaranteed to blow the fuse or smoke the leads on no-fuse setting.

even cheapo $3 harbor frieght meters are accurate within fraction of a percent. not like the ol’ day where mechanical meter could be 2% or even 3% off. still ok here though. accuracy and should not be confused with sensitivity either. however both are cheap these days.

It doesn't seem like anyone in this thread is aware of "Burden Voltage" - You cannot measure the current the chip is using without adjusting the voltage of the power supply, so it's correct at the target.

Have a look here on what i'm talking about http://www.alternatezone.com/electronics/ucurrent/

// Per.

Have a look here on what i'm talking about http://www.alternatezone.com/electronics/ucurrent/

Way exaggerated.

If you truly care about it, put a current sensing amplifier there and call it a day.

dhenry:

Have a look here on what i'm talking about http://www.alternatezone.com/electronics/ucurrent/

Way exaggerated.

I wouldn't call it exaggerated when you set your power supply at 2,5V, put your meter in series with the chip and then the chip only gets maybe 1,9V and you wonder what happened!

// Per.

I would argue that if a chip draws so much current that it causes that substantial of a voltage drop over the meter, the chip is no good; and/or the person doing the measurement is no good.

The issue he raised can be easily addressed.

dhenry: I would argue that if a chip draws so much current that it causes that substantial of a voltage drop over the meter, the chip is no good; and/or the person doing the measurement is no good.

The burden voltage of a multimeter is the same, regardless if you pull 1 mA or 200 mA trough it.... It does not change.

// Per.

The burden voltage of a multimeter is the same, regardless if you pull 1 mA or 200 mA trough it.... It does not change.

Take out your multimeter and measure it.

There is a reason that "burden voltage" is specified in mv/ma. And it is typically lower for high amperage settings - for good reason.

Well of course the 'burden' of the fixed shunt resistance of the amp meter will have an effect on the actual voltage applied to the load being measured. It forms a simple voltage divider with the load resistance and follows ohms law. A simple 'fix' is to simply measure the voltage actually being applied to the load with a second meter and adjust the source voltage for the value you wish the load to be operated at as you measure it's current consumption at that applied voltage.

Understanding ones basic test equipment is important if you want to account for all the possible sources of variation and error in taking precise measurements, if that is indeed the task at hand.

Lefty

The particular meter that David Jones was talking about has a equivalent resistance of 1.8ohm (1.8mv/ma), in the 200ma current setting.

As the current we are talking about here in this threads are on the tune of 2ma, the "burden" induced by the meter is 4mv, or about 0.1% of the supply voltage.

I think the avrs can deal with that without any problem.