Pages: [1]   Go Down
Author Topic: Groundig unused atmega328 pins?  (Read 1372 times)
0 Members and 1 Guest are viewing this topic.
Palermo
Offline Offline
Full Member
***
Karma: 0
Posts: 168
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everybody,
 I'm currently using a few atmega328 standalone on breadboards and I'm wondering if it may help to ground unused I/O pins like it's been done with any logic gate to prevent floating input values. Not that I have a specific problem as of now. But since I'm going to port those breadboard prototypes to a PCB, I'd like to know if I should ground those pins in advance.

Anyone has a few words to say about that?

Cheers :-)
Logged

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

Hi everybody,
 I'm currently using a few atmega328 standalone on breadboards and I'm wondering if it may help to ground unused I/O pins like it's been done with any logic gate to prevent floating input values. Not that I have a specific problem as of now. But since I'm going to port those breadboard prototypes to a PCB, I'd like to know if I should ground those pins in advance.

Anyone has a few words to say about that?

Cheers :-)

I wouldn't bother with grounding pins. First if there was ever a sketch loaded in error that changed the pin to an output pin and set output to high you could damage the pin. Second, if your concerned about floating inputs, just enable the internal pull-up resistors for those pin you will not be using.

Lefty
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2811
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

 or add 1K pull downs, Lefty's method is best, my method is a quick and dirty patch for when you are in a hurry.

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Palermo
Offline Offline
Full Member
***
Karma: 0
Posts: 168
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

... if your concerned about floating inputs, just enable the internal pull-up resistors for those pin you will not be using ...

Thank you Lefty, clever suggestion :-)
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Anyone has a few words to say about that?

Floating pins usually don't do much.

In a noisy environment, you may want to ground them or pull them to Vcc. You can pick the resistor value to minimum current draw. I typically put them to digital output high and pull them to Vcc, via a 10k - 47k resistor network.
Logged

0
Online Online
Shannon Member
****
Karma: 162
Posts: 10469
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Floating pins though can cause power drain in sleep mode.  Fortunately the 328 has some hysteresis in the input stages which may help.

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

Also a floating input could be sent into oscillation due to capacitive feedback - in theory at least - symptom is increased power drain in that input circuit _and_ gates further down the line.

In sleep mode the 328 and other AVR microcontrollers disconnect the input circuitry from the pins and grounds the input inverter, so none of this is an issue in sleep mode.

In general it is wise to avoid floating inputs in any deployed circuit - for breadboarding you'd only worry if it stopped things working.

For the 328 the advice to use internal pull ups is good I think, but few bother for prototypiing.
Logged

[ I won't respond to messages, use the forum please ]

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23834
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

"In sleep mode the 328 and other AVR microcontrollers disconnect the input circuitry from the pins and grounds the input inverter, so none of this is an issue in sleep mode."

That may be true for inputs - outputs are still driven.
 
I have a remote control that uses keypad.h library.
I was using diodes with anodes to interrupt and cathodes to keypad row pins to create an interrupt to wake up from power down sleep mode.
Couldn't make it work - turns out the keypad library was leaving the column pins high. As part of going to sleep, I had to write the column pins low so a cathode would get pulled low when a key was pressed connecting a row to a column, and then write them back high on waking up.

Atmel recommends taking unused pins High or Low so they don't oscillate. I define all unused pins as inputs with internal pullups enabled.
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.

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2811
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

a 74HCT240 Will oscillate 1 section or many If the inputs are open usually at about 30-60 MHZ. They get real hot and without a scope are really difficult to separate from a shorted output, Add a crystal and a telegraph key and you have a 1/2 watt transmitter. One section for the oscillator one as a buffer and 4 in parallel for the "Power Amp" there was a write up in the ARRL handbook (Great way to learn basic electronics from the ground up) in the early 2000's. As MarkT pointed out an open input is not really a good thing to have. I've always grounded the inputs as ground is usually the easiest thing to find when laying out a PCB. If one makes sure that unused pins are set to output and low there is no issue possible that could really cause damage except as pointed out for Low Current applications.

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Palermo
Offline Offline
Full Member
***
Karma: 0
Posts: 168
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I thank you all for your inputs, quite precious ones!
You gave me ideas to think about in the next few days. I appreciate that :-)
Logged

Palermo
Offline Offline
Full Member
***
Karma: 0
Posts: 168
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...just enable the internal pull-up resistors for those pin you will not be using...

I've read Atmel's datasheet in the meanwhile (why don't I do that before starting a new thread?!!). It clearly suggests enabling those internal pull-ups instead of wiring the free pins to Vcc/GND. I'm glad to see Lefty's suggestions keep proving themselves rock solid :-) I will definetely enable the pull-up resistors and not ground anything at all!

« Last Edit: October 15, 2012, 10:34:44 am by robitabu » Logged

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

...just enable the internal pull-up resistors for those pin you will not be using...

I've read Atmel's datasheet in the meanwhile (why don't I do that before starting a new thread?!!). It clearly suggests enabling those internal pull-ups instead of wiring the free pins to Vcc/GND. I'm glad to see Lefty's suggestions keep proving themselves rock solid :-) I will definetely enable the pull-up resistors and not ground anything at all!



Be careful and judicious with your praise. I think you find anyone around here with a high post count has contributed their fair amount of brain farts to go along with their useful tips.  smiley-grin

Lefty
Logged

Pages: [1]   Go Up
Jump to: