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.
- 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...
-
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 -
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!