Go Down

Topic: Current on any pin (anaologue or digital) (Read 666 times) previous topic - next topic

Voidugu

Guys, i would like to ask whether i should connect any current limiting resistors on pins defined as inputs, for example on an analogue or a digital pin in order not to fry the chip? In the schematics, when a potentiometer is connected on an analogue pin , acting as a voltage divider, there are no resistors protecting the analogue pin from excessive current. If the potentiometer is throttled all the way up and the input voltage is 5v then there is no resistance protecting the pin from over-current. Why is that so? Why would we use a resistor when setting a pin as an output (eg a digital pin powering an led would be connected to a 250ohm resistor) but not when using the same pin as an input? If i would need to use any resistors what values would be suitable? And lastly would it make a difference if i used a 30 k potentiometer instead of a 5k or a 10k one?

Any answers are appreciated :)
Thank you

RuggedCircuits

Current limiting resistors are not strictly needed on inputs, because inputs do not draw any current from the voltage source that you hook up to them (well...just a wee bit of current, maybe a microamp at most).

When the potentiometer is all the way at 5V there is no over-current, because it is the pin that *draws* the current from the 5V; the 5V does not force any amount of current. If the Arduino pin requires only 1uA of current, then only 1uA of current flows from the 5V source.

You would use a resistor when setting a pin as an output because you do not know how much current will be demanded by whatever you hook up to it. In the worst case, consider hooking up a plain wire from the output pin to GND (0V). That would allow an infinite (theoretically) amount of current, blowing up the Arduino. The resistor limits this to 5V/R (slightly less, since the 5V output pin voltage decays as more current is drawn from it).

Now, if you want a degree of protection for your Arduino input pins you WOULD connect a series resistor, in the case of overvoltage (>5V) or undervoltage (<0V) because in those cases the Arduino input pin will draw a LOT more than 1uA, and this can damage the pin. So it's not a bad idea if you have the space and patience to add resistors. A 1k resistor would be suitable for a 5V source as it would limit current to 5mA or so if the source went >5V.

It would not make a difference if you used a 30k potentiometer. As you say, when the pot is throttled all the way up you would still be applying 5V directly to the pin through no resistance.

--
The Ruggeduino: compatible with Arduino UNO, 24V operation, all I/O's fused and protected

Voidugu

"because it is the pin that *draws* the current from the 5V; the 5V does not force any amount of current"

Isn't the amount of current drawn by a particular something controlled through the resistance of that something? I mean the Ohms law V=I*R
Taking into consideration that the voltage is a constant 5V supply, the only thing that can define current is the resistance right?
If the input pin has a high resistance then very little current will flow or be drawn by and vise versa isn't it?

Again thanks a lot man :>

MarkT

Arduino inputs (unless internal pull-ups are enabled) are likely to be  > 10^8 ohms (ie _extremely_ high resistance).  But only if you don't take them outside the 0V to 5V range (in which case the protection diodes come into play).

This high input resistance is characteristic of CMOS logic inputs in general - the input gates are made of an insulator so the only current flowing is leakage in the other components (disabled output drivers, protection diodes).

If the source could go outside the 0V to 5V range then current limiting resistors may be needed to protect the protection diodes from overcurrent (they are not very large).  Overcurrent into a protection diode might damage it, but also might put the chip into "latch-up", a state unique to CMOS and highly undesirable.

A chip in latchup tends to get hot very quickly - can only be cured by removing the power from the chip (and if you are lucky it still works).
[ I won't respond to messages, use the forum please ]

RuggedCircuits

Ohm's law only applies if what you have is a resistor. The pin input of a microcontroller is not a resistor. It is non-linear, drawing 1uA or less when the input voltage is between 0V and 5V, drawing much more outside that range.

--
The Rugged Motor Driver: two H-bridges, more power than an L298, fully protected

Voidugu

So what you guys are basically telling me is that i don't need a current limiting resistor on any pin (whether analogue or digital) defined as input as long as i am using the arduino's 5v supply

If i am going to use any external 5v or higher voltage supply then a resistor would need to be put in series with the input pin in order not to fry the chip right?

If i was going to do something like that would this schematic work? Would i need the 300 ohm protecting resistor? (sorry for my crappy drawing skills i did it on a mouse pad)

RuggedCircuits

Yes, I think you got it right.

--
The Basic Motor Driver: simple, inexpensive motor driver for 1 stepper motor or 2 DC motors

Grumpy_Mike

Quote
If i am going to use any external 5v or higher voltage supply then a resistor would need to be put in series with the input pin in order not to fry the chip right?

Never let the arduino see a voltage above 5V resistor or no resistor. The internal clamping diodes are very delicate and can only take less than 1mA. It is best not to rely on them.

There is a trend to put resistors on inputs, especially in the Parallex spin literature, this is absoloute rubbish and makes the inputs less resilient against noise.

Go Up