Newb Questions about Resistors

I'm completely new to electronics and have been playing with the Arduino for the last few days. In particular, I bought the Sparkfun Inventor's Kit which is very good at getting you to build circuits and introducing you to the programming, but not so great at explaining the ideas that go into designing the circuit. As a result, after doing some research I have some basic questions that it would be super helpful if I could get some help on.

  1. I just want to make absolutely sure that I have my calculation right. If I have the Arduino pin connected to an LED, since the pin outputs 5V on HIGH, and my LED has a voltage drop of 2V and has a suggested using current of 1.6-1.8mA, I would figure out the resistor I need with the following calculation:

(5V-2V)/0.017A=176.47ohm

Is this correct? The reason I am concerned is that the kit asks me to use a 330ohm resistor. I'm thinking that this is because that is just the smallest ohm value resistor that they chose to include in the kit...

  1. So if I were to plug an Arduino pin set on high into a circuit with no components, would that damage the pin? I would think it would because there is not much resistance in the wire and there would be 5V coming from the pin so
    5V/Low Resistance=Current Over 40mA

  2. There is a circuit described in the kit that includes a button and connected to that button is a 10K resistor. The manual gives the following explanation:

"We'll connect one side of the pushbutton to GND, and the other
side to a digital pin. When we press down on the pushbutton,
the pin will be connected to GND, and therefore will be read
as "LOW" by the Arduino."

"But wait - what happens when you're not pushing the button?
In this state, the pin is disconnected from everything, which
we call "floating". What will the pin read as then, HIGH or LOW?
It's hard to say, because there's no solid connection to either
5 Volts or GND. The pin could read as either one."

"To deal with this issue, we'll connect a small (10K, or 10,000 Ohm)
resistance between the pin and 5 Volts. This "pullup" resistor
will ensure that when you're NOT pushing the button, the pin will
still have a weak connection to 5 Volts, and therefore read as
HIGH."

I guess I'm a little confused by what is going on here and I'm not even sure if this is really a question about resistors. When the button is pushed, the pin will be connected to ground, and so that will register as a low. Why is that? Alternately, when the button is not pushed, I understand that the resistor makes it so that a tiny bit of current is flowing to the pin:

5V/10000ohm=0.0005A

But why does this register as high? What happens if you use a different resistor?

Thanks so much to anyone that can help me answer these questions!

  1. you have the decimal point in the wrong place 1.8mA is 0.0018.
  2. no resistance fitted equals an infinite resistance not a low resistance.
  3. the resistor value is not critical. It acts as a pull to high or low depending on how it is connected up.
  1. Yep, looks right assuming you meant 16-18mA not 1.6-1.8. If you meant 1.7mA then you would have a resistor of 1800.

  2. Not sure what you mean by "into a circuit with no components" but if you mean into 0v, then yes you'll get a dead short and BOOM

3 part 1) The button will register as low when you connect it to ground because ground IS low... the pin will be connected to 0v.

3 part 2) It's not the current that's really the point, it's the fact that it's connected to 5v which is what high is. You would get the same reading with no resistor, ie straight to 5v.... BUT and here's the important part, if you DID connect it straight to 5v with no resistor, when you push the button you'll be connecting that 5v straight through to 0v and BOOM as you can verify by looking at this schematic

Welcome to the world of electronics.

Q1) the current you use in the formula is 17mA though the figure in your text is 1.6 to 1.7mA. 17mA is a reasonable LED current so go with that and you get 176 ohms (drop the decimals, they are irrelevant) You say the kit recommends 330 ohms. This is OK but will only pass around 9mA so the LED will glow somewhat dimmer.

Q2) Plugging an output port into a circuit with NO components is connecting to an open circuit (infinite resistance) so NO current will flow, hence is completely safe.

Q3) With one end of the switch connected to ground and the other to the input terminal, same terminal connected to a 10k resistor with other end connected to +5 volts is a normal circuit. Assuming the switch is OPEN the terminal junction is connected to +5 via the 10k resistor (input HIGH). With the switch CLOSED the terminal junction is connected to ground (input LOW). The value of the resistor is of no electrical consequence (within reason) but you should limit the current to sensible levels. In that respect I'd suggest going no less than 1k ohms. Note that you can connect the input terminal directly to the+5 volts without causing input damage but you must NOT do so with the grounded switch circuit - If you did the switch would shorten out the 5 volt system when pressed.

Thanks so much for your help everyone! Your responses were extremely helpful. Just to clarify, I did indeed mean 17mA, not 1.7mA.

Also, a quick follow up. With the second question, what I meant was plugging a pin directly into the ground socket on the board. This would cause a problem right?

Again, thanks so much for the help.

dent424:
Thanks so much for your help everyone! Your responses were extremely helpful. Just to clarify, I did indeed mean 17mA, not 1.7mA.

Also, a quick follow up. With the second question, what I meant was plugging a pin directly into the ground socket on the board. This would cause a problem right?

If the pin is setup as a input pin then no problem, but when reading the pin in software with a digitalRead command it will always read a 0, very boring. However if the pin is set to be an output pin and level set to HIGH then there will be a direct short circuit to ground most likely destroying the output pin

Again, thanks so much for the help.

dent424:
With the second question, what I meant was plugging a pin directly into the ground socket on the board. This would cause a problem right?

If it's at 5v when you ground it yes, you will release the proverbial magic smoke

Got it. Thanks!