Pages: [1]   Go Down
Author Topic: What Resistor capacity should I chose (learning!)  (Read 921 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I've recetly discovered the Arduino and Electronics (so excited!!!) and can not get my head around selecting the right Resistor capacity.

for instance in the 1st example of the learning section, a 10k resistor was selected when connected to a push button:
http://arduino.cc/en/Tutorial/DigitalReadSerial

I really don't understand how you found this value. I know ohm's law is probably what i should be using (R=U/I) but I'm missing the value for I on this circuit... I would really like to understand rather than just copy!

thanks,

XBerg
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 596
Posts: 33271
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is one of those things which you are better off copying as it is not very critical. You could use 1K or 100K with much the same results. You want to make the input look like a logic one so you connect it to 5V but you want to pull it down with your switch so you don't want a short. The input impedance (resistance for now) of the pin is so high that the small amount of current it requires is not going to be affected much by an extra 10K. The actual values are in the data sheet in section 28 but at this stage there is no need to know.
Logged

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

I know ohm's law is probably what i should be using (R=U/I) but I'm missing the value for I on this circuit

You can use ohms law because while you may not know I, you already know R and V.

Solving for I:
5v/10k ohm = 0.5 miliamps
Logged

United States
Offline Offline
Full Member
***
Karma: 0
Posts: 104
Indubitably
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So are you calculating for the mA requirements of the specified component? I thought there was a 30 mA limit on Arduino I/O pins?
Logged

fuzzball27 >>-->

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could use 1K or 100K with much the same results. You want to make the input look like a logic one so you connect it to 5V but you want to pull it down with your switch so you don't want a short.

Great Grumpy Mike - I sort of understood the resistance was there to avoid a short - just not what sort of reistance i should put there smiley I have a full bag of resistors from 0 Ohm (wonder what such a resistance exists...) to several million ohm with lots of values in between! I understood the logic of calculating resistance for LEDs, but the button is eluding me. 
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 596
Posts: 33271
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
from 0 Ohm (wonder what such a resistance exists..
These are called zero ohm links and are used quite a lot by professional engineers. Mainly when laying out a PCB they often have alternatives they would like to try, like the choice between an internal oscillator and internal. They lay it out and then put zero ohm links round it so they can swap between one configuration and another just by removing and placing these links.

 To the others:-
Quote
I thought there was a 30 mA limit on Arduino I/O pins?
We are talking about inputs not outputs here.

Quote
5v/10k ohm = 0.5 miliamps
Yes but that is only the current going through the button when pressed, the arduio input pin takes some but that is very tiny.
Logged

0
Offline Offline
Shannon Member
****
Karma: 198
Posts: 11639
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This use of a resistor is called a pull-up or pull-down - its purpose is to hold a signal at logic HIGH (or LOW) until the button is pressed.

The value is extremely uncritical, so long as it is 10 times the switch's on-resistance and less than a tenth of the pin's input resistance it will work.

However to be practical we want to keep the current low to avoid wasting power, but we also want to keep the resistance low to reduce the risk of picking up noise from nearby signals via capacitive pick-up.

So in practice pull up and pull-down resistors tend to be in the range 1k to 100k.   Using a very low value resistor (1ohm) would mean wasting 25 watts of heat in it.  Using 10M ohm resistor would be sensitive to pickup and would only switch slowly (not a problem with a push button).

Often in digital electronics resistor values are uncritical in this way - however in analog electronics most resistors have to be the right value for the circuit to function.
Logged

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

Michigan, United States
Offline Offline
Jr. Member
**
Karma: 0
Posts: 69
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The concept of a pull-up/pull-down resistor can be understood mathematically with ohms law.

If you have a pull up resistor from a button to 5vdc and the button wires to ground when pressed then the reading of the voltage at the button can be found.

5VDC -----(RES)------- || ---------GND
                             Button

When this button is pressed, you have the following circuit
5vdc ----- (RES) ------- GND

When it is open you have an open circuit
V=IR
if I = 0 then V = 0
This means the drop across the resistor is 0VDC. No drop means that the voltage at the resistor is 5vdc

When you push the button, current flows and you will get a drop across the resistor equal to I*R which will be 5VDC. IN other words, the value at the button will be 0VDC.
Logged

Always Think!

Offline Offline
Newbie
*
Karma: 0
Posts: 41
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Fantastic! Thanks so much for the clarity of your responses. I love this forum!

Xberg
Logged

Pages: [1]   Go Up
Jump to: