What to do with unused pins

I know this might be a noob questions, and I think I know the answer but;
For long term, is it best to set unused pins as OUTPUT or INPUT, HIGH or LOW?
Setting them as INPUT,HIGH would enable the internal pullup and a small amount of current would flow.
I'm thinking setting them as OUTPUT,LOW would be best.

Setting them as INPUT,HIGH would enable the internal pullup and a small amount of current would flow.

Flow where?

output LOW !

Skizo !

As long as you don't put in wrong wires, it does not matter. ( OUTPUT, LOW does not like to drain 5V without a resistor )

Rather tape the unused pins :wink:

michael_x:
As long as you don't put in wrong wires, it does not matter. ( OUTPUT, LOW does not like to drain 5V without a resistor )

Rather tape the unused pins :wink:

I didn't know if the undefined/unused pins would or could cause issues if left "floating" so to speak. Like intermittent interference or something.

I might be talking out of my arse here, but don't I/O pins on microcontrollers tri-state if you don't tell them what to do? So you don't REALLY need to do anything to them? I've never bothered doing anything special to my unused pins on arduino projects and nothing weird's happened so far.

While it is normal to tie unused logic inputs to a level on logic ICs, I don't think it matters on the processor because the floating pickup on them is not going to make it's way into the rest of the logic unless the code invites them in.
I don't do anything with unused inputs and I have not experienced any problems.

but don't I/O pins on microcontrollers tri-state

They default to inputs not tri-state.

Good to know, thanks

Grumpy_Mike:
While it is normal to tie unused logic inputs to a level on logic ICs, I don't think it matters on the processor because the floating pickup on them is not going to make it's way into the rest of the logic unless the code invites them in.
I don't do anything with unused inputs and I have not experienced any problems.

but don't I/O pins on microcontrollers tri-state

They default to inputs not tri-state.

Thanks for the correction :smiley: Every day's a school day!

If you leave unused pins unconnected and unprogrammed, they default to (input, low). In this state the pin may float at a voltage that is neither high nor low, which slightly increases the current consumption of the input buffer. Unless you're using the sleep mode of the processor, you probably won't notice the difference. Programming unused pins as (input, high) to enable the internal pullup avoids the issue. So does programming them as outputs.

The recommended practice, only if the processor will be put to sleep...

13.2.6 Unconnected Pins
If some pins are unused, it is recommended to ensure that these pins have a defined level. ... The simplest method to ensure a defined level of an unused pin, is to enable the internal pull-up.

Doesn't that cause a bit more current consumption by the processor? If it's pulled to a 5v level via internal resistors, power must be flowing.

Not very much because the input has so high an impedance.

Jassper:
Doesn't that cause a bit more current consumption by the processor? If it's pulled to a 5v level via internal resistors, power must be flowing.

I have a handheld gadget that: runs from 2 AA alkaline batters, is used a few times every day, for 30 minutes to one hour. This is the third year of its existence and it is still running problem-free on the original AA batteries. The unused pins are held high by internal pullups.

In my experience, any current consumption from the internal pullups enabled on unconnected pins is so very small as to be essentially zero.

Again, good to know 8)