Pages: [1]   Go Down
Author Topic: Right way to use a pull up resistor  (Read 768 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the right way to use a pull up resistor?



or



I'm talking about the 100 Ohm resistor that is added in the first example. What is it's purpose?
Logged

Germany
Offline Offline
Faraday Member
**
Karma: 59
Posts: 3071
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It protects against a bad programming the pin as Output.
Logged

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

Can use the internal pullup instead:

pinMode (pinX, INPUT_PULLUP);

or

pinMode (pinX, INPUT);
digitalWrite (pinX, HIGH); // enables internal pullup

This keeps input pins from floating and providing nonsense readings.
100 ohm is way too low a value. Internal is 20K to 50K.
External only needs to be 10K.
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.

Germany
Offline Offline
Faraday Member
**
Karma: 59
Posts: 3071
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
100 ohm is way too low a value. Internal is 20K to 50K.

Agreed, this 100 Ohms before the pin is not a Pullup nor Pulldown resistance.
Quote
What is it's purpose?
If "none" is a too simplistic answer, there just remains (my previous reply) "to limit the current into the Arduino pin in case of errors".
Any other suggestions ?
Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 329
KC4MM
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Or to limit the current out of the pin. Suppose the pin were for some reason configured as an output and written to HIGH with the switch closed.
Logged

Offline Offline
Jr. Member
**
Karma: 1
Posts: 54
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So if it's correct that it serves to protect the chip, shouldn't it be at least 125 Ohm? The atmega is rated up to 40mA @ 5V so 5/0.04 = 125 Ohm (150 Ohm to be shure)
Logged

Cumming, GA
Offline Offline
Edison Member
*
Karma: 20
Posts: 1658
Ultimate DIY: Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It doesn't *have* to be there... unless you would like to save yourself from a stupid mistake on a breadboard where you would accidentally  cause a short on the PIN and "smoke" it.  I have seen designs with other non-Atmel microcontrollers where 200 Ohms is used.  In this particular circuit... it's best suited for bread board usage... but when you move to a final PCB where stray wires are unlikely, you can remove it.

So, it's probably "what it is" for the following reasons:

100 Ohm resistor is readily available
100 Ohm resistor is "close enough"
Many "hobbyists" go on and on about how 40 Ma is just a "line in the sand" set by Atmel as a safety margin and the pin can tolerate 60mA or even 80mA with no ill effects (I'm not one of those) but this discussion continues "ad nauseum" in other threads and does not need to be continued here

This is why I keep a few 220 Ohm DIP arrays in my "junkbox".



* dip.jpg (2.42 KB, 160x160 - viewed 6 times.)
« Last Edit: August 14, 2013, 12:33:31 pm by pwillard » Logged

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

If you're trying to limit current flow in & out of the pin, you want the resistor in series with the pin, not pulling up to 5V.
See "Protection Details" in the middle of the Rugged Circuits design discussion here
http://www.ruggedcircuits.com/html/ruggeduino.html
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.

Offline Offline
Faraday Member
**
Karma: 68
Posts: 2804
The last thing you did is where you should start looking.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
you want the resistor in series with the pin
I agree.
See attached:


* 8-15-2013 7-33-00 PM.jpg (49.66 KB, 481x413 - viewed 16 times.)
Logged

The way you have it in your schematic isn't the same as how you have it wired up! That goes for me too.

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12467
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually I'd just make both resistors 10k, then you only need to buy one value (or share resistors
in a resistor array) - the protection resistor's actual value isn't important at all so long as its > 200 or so
and not so high as to allow capacitive noise pickup by the input pin.

Having a 10k protection resistor also means that if the switch is remote and its cable gets damaged and
12V (say) gets onto the switch line, the Arduino isn't going to instantly be fried.
Logged

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

Lacey, Washington, USA
Offline Offline
Edison Member
*
Karma: 162
Posts: 2497
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That is what the OP had in the first diagram, the one he was asking about.
Logged

Steve Greenfield AE7HD
CET Consumer Electronics and Computer
Please don't read your attitudes into my messages

Pages: [1]   Go Up
Jump to: