The book mentioned that we need to connect a 10kOhm resistor in series with the push button.
But why 10kOhm? Not other resistance? And how should the correct resistance be calculated?
thanks.
The book mentioned that we need to connect a 10kOhm resistor in series with the push button.
But why 10kOhm? Not other resistance? And how should the correct resistance be calculated?
thanks.
I presume your button is wired to GND and a digital input of your arduino card, or to +5V and digital input?
the "high" value resistor will help your wiring to have a constant value of current (0 or +5V according to your wiring).
If not, you could have floatting value as the digital pin may be affected by surroundings.
You may use a resistor with higher value and have the same effect. A resistor with a weaker value will let more current flows trought it according to Ohms' law: U = R*I.
EDIT: quick maths:
U = 5V; R = 10kOhm, I = 0,5mA.
U = 5V; R = 1 kOhm, I = 5mA.
I propose you make a quick search in google with terms "input pull-up" or "input pull-down" or go get the arduino documentation. It will provide wiring examples and explanations (better than mine).
Good rule of thumb for the value.
It order to be able to calculate the resistance you need to know what current you want it to draw, and by and large you don't know this.
The bigger the resistance the less current it takes meaning the more likely it is to be disrupted by interference like mains, radio or motor interference.
The lower the resistance the more current it will take meaning the more current the switch has to carry leading to shorter button life, and of course taking more current, producing slightly more heat, which in a big system can add up,and cause reliability problems.
Electronics is often called an art because balancing these compromises is what professional engineers do and there are no definitive answers.
This leads beginners to ask how to exactly calculate things which many times is a a question beyond there ability because of unknown and often unknowable things like this one where the electromagnetic environment the system will operate in is not known or if it is, takes a lot of expensive equipment to measure. In most cases professional engineers have to take the equipment to specialist test houses to have the measurements made. These cost in the region of $800 to $1400 a day, with a minimum time of half a day.
So use 10K and if you have any problems with interference pick-up try 1K.
I think what you're describing is a pushbutton wired to ground and an input, with a resistor from 5V to that same input. If that's correct, this is a classic pullup arrangement, and 10k provides the necessary current into that pin for the processor to sense that input as logic "high". Within limits, that current could be lower or higher, which is why you'll see a range of values touted for 'pullup' resistance; if you want to calculate the resistance, you'll have to find a processor data sheet and look at iih - "current (with) input high".
When the input is forced to 'GND' when you press the pushbutton, the current from the resistor goes directly to ground, and in addition, a small current flows out of the input structures of the processor pin. That outflow is sensed as a logic "low".
That's the Cole's Notes, el simplo version of what's going on, but it's enough to get you started.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.