Why a resistor from component's ground to arduino input

For makers who have purchased an Adafruit Starter Pack, get help with the tutorials here!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
gosbrut
 
Posts: 74
Joined: Thu Feb 20, 2014 5:36 pm

Why a resistor from component's ground to arduino input

Post by gosbrut »

Why a resistor is need to put between the button switch and a arduino input.

In some basic button tutorial i do the following as the book indicates an ilustrates, basically connect the 5V power to one pin of the button, and then the other pin of the button goes to one side of the resistor and then the other side of the resistor goes to the arduino input, why ? why i need to put a resistor before electricity flows to ground to arduino input ?

How to calculate which measure to apply, i mean what kind of resistance i need to put ?

Will be the same for other buttons ?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Why a resistor from component's ground to arduino input

Post by adafruit_support_bill »

Which tutorial are you following? Generally you need a pullup or pulldown resistor when connecting a button or switch. The easiest way to do this is using the internal pullup resistors in the Arduino. See lesson 6 for details. http://learn.adafruit.com/adafruit-ardu ... s/overview

gosbrut
 
Posts: 74
Joined: Thu Feb 20, 2014 5:36 pm

Re: Why a resistor from component's ground to arduino input

Post by gosbrut »

Im following the instructions that comes with the book in Arduino Starter Kit.
5V to button, button to resistor, resitor to ground to arduino input

Question is, why a resistor between the button and arduino ?
What will happen if i do not put any resistor between button and arduino input ?

Once i read your lesson 6 another question is: why button gets no power from arduino 5V ? does it get power from somewhere ? from where ? if not, how the electricity flow ?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Why a resistor from component's ground to arduino input

Post by adafruit_support_bill »

Im following the instructions that comes with the book in Arduino Starter Kit.
Are you referring to CIRC-07 from the ARDX starter kit?
5V to button, button to resistor, resitor to ground to arduino input

Question is, why a resistor between the button and arduino ?
What will happen if i do not put any resistor between button and arduino input ?
In the schematic from CIRC-07, the button connects to 5v via the resistor and the Arduino input is connected directly to the button.
Image
Once i read your lesson 6 another question is: why button gets no power from arduino 5V ? does it get power from somewhere ? from where ? if not, how the electricity flow ?
The button does not require any power to operate. The internal pullup resistor pulls the Arduino input to 5v when the switch is open. When closed, the switch pulls it back to ground.

gosbrut
 
Posts: 74
Joined: Thu Feb 20, 2014 5:36 pm

Re: Why a resistor from component's ground to arduino input

Post by gosbrut »

In the schematic from CIRC-07, the button connects to 5v via the resistor and the Arduino input is connected directly to the button.
Image
Let me check the book tomorrow as i dont have it here


Other thing is, why a 10K ohm ? i mean, why 10k and not 5k or 1k, how to calculate ?

gosbrut
 
Posts: 74
Joined: Thu Feb 20, 2014 5:36 pm

Re: Why a resistor from component's ground to arduino input

Post by gosbrut »

oops i see two resistor on your schematics, what about the 560ohm resistor, is used to avoid damage the led ?
and again, why 560ohm and not, lets say 1k ohm or 100ohm ?

gosbrut
 
Posts: 74
Joined: Thu Feb 20, 2014 5:36 pm

Re: Why a resistor from component's ground to arduino input

Post by gosbrut »

The button does not require any power to operate.
Sorry, i dont understand, if the button does not require power, why give it 5v ?
The internal pullup resistor pulls the Arduino input to 5v when the switch is open. When closed, the switch pulls it back to ground.
I dont understand, the internal pullup resistor, whats that ?

Give 5v to the arduino input when circuit open ?

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Why a resistor from component's ground to arduino input

Post by adafruit_support_bill »

what about the 560ohm resistor, is used to avoid damage the led ?
and again, why 560ohm and not, lets say 1k ohm or 100ohm ?
See this tutorial: http://learn.adafruit.com/all-about-leds
Sorry, i dont understand, if the button does not require power, why give it 5v ?
We don't. We connect it from the Arduino input to ground.
I dont understand, the internal pullup resistor, whats that ?
That is a resistor internal to the Atmega processor. We can enable it in a program using the PinMode function: http://arduino.cc/en/Reference/pinMode#.UyYo8vldV8E

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Starter Pack”