Does a circuit going into an Arduino pin/GND need a resistor?


If a circuit goes into an Arduino pin, even the GND pin, but does not use something a component that needs a resistor such as an LED, does it still need a resistor for the Arduino pin?

Edit: To clear this question up, here's an example of what I mean.

Imagine a circuit with no components. It's pointless, but it's just for demonstation. Say that the circuit comes out from the 5V pin on the Arduino and goes into the GND pin again immediately; that's all it does. Because the circuit has current going in to the GND pin, does it need a resistor?

Edit again: Here's a picture of what I mean. Would this need a resistor?
enter image description here

Best Answer

The Arduino's GND, 5V and 3.3V pins, have very different behaviour from an Arduino pin being used as a digital Output.

The GND and 5V pins is connected directly to the power supply. They are not connected to the ATmega microcontroller.

When the Arduino is being powered by USB, the 5V pin can supply (source) up to 500mA. The GND pin and can 'absorb' (sink) up to 500mA. This is much more than all of the Arduino's digital out pins combined can handle (source or sink).

The Arduino's ATmega is also using some of that 500mA. The ATmega's maximum current use is approximately 200mA, though it is typically much less.

The 3.3V pin is supplied by a smaller voltage regulator . The Arduino UNO specification syas the 3.3V pin can supply (source) 50mA.

The 5V and 3.3V pins must never be connected directly to any GND pin. There must always be enough resistance to limit the current flowing from 5V to (500mA - ATmega) or less. The ATmega does not use the 3.3V supply, so the resistance limiting the current flowing from 3.3V must limit current to 50mA or less.

An Arduino pin, when set to digital output, can handle (source or sink) a maximum of 40mA. (While remaining within the ATmega's specification)

Pins on an ATmega are grouped into 8-pin 'ports'. When several pins on the same port are being used, then the maximum current from all the pins on the port is 100mA. I generally use 12mA as a maximum current, while I am experimenting. I usually enforce that limit using a resistor.

When an Arduino pin is used as a digital input, for a voltage within its safe operating range, it doesn't matter about limiting current with a resistor because an input pin already has a very high impedance (resistance).

When an input voltage might be outside the safe operating range for an input pin, then there are many choices.

Each Arduino pin has small diodes connecting it to Vcc (e.g. 5V) and ground, arranged so that a voltage below ground or above Vcc applied to the pin will be conducted to one of those rails. These diodes only handle small currents. So the pin can be protected from moderate voltage shorts (say under 12V) by putting a resistor on the input pin.

(I have scoured the ATmega328 data sheet but can't find a spec for these protection diodes, I believe they are rated well under 1mA)

A more predictable solution is to explicitly protect the input pins using a resistor to limit current, and diodes to the Vcc and ground rail.

(More robust and complex solutions to protect a pin exist, but these cover the simple case.)