0

Why a resistor from component's ground to arduino input
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Why a resistor from component's ground to arduino input

by gosbrut on Sun Mar 16, 2014 1:50 pm

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 ?
gosbrut
 
Posts: 74
Joined: Thu Feb 20, 2014 5:36 pm

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

by adafruit_support_bill on Sun Mar 16, 2014 2:03 pm

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

adafruit_support_bill
 
Posts: 81536
Joined: Sat Feb 07, 2009 10:11 am

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

by gosbrut on Sun Mar 16, 2014 2:25 pm

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 ?
gosbrut
 
Posts: 74
Joined: Thu Feb 20, 2014 5:36 pm

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

by adafruit_support_bill on Sun Mar 16, 2014 2:36 pm

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.

adafruit_support_bill
 
Posts: 81536
Joined: Sat Feb 07, 2009 10:11 am

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

by gosbrut on Sun Mar 16, 2014 4:43 pm

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

by gosbrut on Sun Mar 16, 2014 4:45 pm

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

by gosbrut on Sun Mar 16, 2014 4:48 pm

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 ?
gosbrut
 
Posts: 74
Joined: Thu Feb 20, 2014 5:36 pm

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

by adafruit_support_bill on Sun Mar 16, 2014 6:44 pm

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

adafruit_support_bill
 
Posts: 81536
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.