2

In the example circuit below (Arduino Uno R3), what would the equation be to identify the amperage going into pin 2 when the button is pressed? What if I used the 3.3v on the arduino or a 9v battery instead?

What is happening to the input pin when the button is not being pressed? (I assume it's a guaranteed LOW state due to any current being sapped by the GND, yes?)

What would happen without the pull down resistor? A short when the button is pressed? What would happen without the ground being connected at all? Anything?

A tutorial for how to choose a pull down resistor I seen suggested a resistance value of 10 times the impedance of the pin. I'm not quite sure where to find this impedance value, but I have seen on an arduino tutorial "A 10K resistor is a good value for a pullup or pulldown resistor." Just not much of an explanation of why that value.

Sorry for so many little questions in this one question, but these are the kinds of things I'm not seeing addressed in most tutorials.

Simple button test

  • Have you heard of Ohm's Law? – Majenko Dec 13 '16 at 16:50
  • @majenko I'm familiar enough with the concept for a typical series circuit or parallel circuit from a single tutorial or two, but that's about it. Branching off between the button and resistor is the bit that confuses me on how to calculate it here (I believe). – Mythics Winter Dec 13 '16 at 17:05
3

what would the equation be to identify the amperage going into pin 2 when the button is pressed?

Once the button has been pressed for more than a few nanoseconds the current will be 0 (or as near as).

Immediately the button is pressed the formula is I(t) = dQ(t) / dt since the input pin is a MOSFET gate and as such is seen (in simple terms) as a capacitor.

What if I used the 3.3v on the arduino or a 9v battery instead?

The same.

What is happening to the input pin when the button is not being pressed? (I assume it's a guarangeed LOW state due to any current being sapped by the GND, yes?)

It is pulled down to ground by the resistor.

What would happen without the pull down resistor? A short when the button is pressed? What would happen without the ground being connected at all? Anything?

The input will be HIGH when the button is pressed, and floating (initially HIGH) when released.

A tutorial for how to choose a pull down resistor I seen suggested a resistance value of 10 times the impedance of the pin. I'm not quite sure where to find this impedance value, but I have seen on an arduino tutorial "A 10K resistor is a good value for a pullup or pulldown resistor." Just not much of an explanation of why that value.

The main concern with a pullup or pulldown resistor is the current it demands from the power supply when the button is pressed. If it's too low then you will be wasting current. If it's too high then the input may take a while to turn off when you release the button. 10K is a "good" value since it is a good balance between those two factors.

The current from the supply is calculated as I=V/R, so 5/10000 = 0.5mA. Low power systems may choose a higher value (100kΩ, say) to reduce the current.

2

what would ... the amperage going into pin 2 when the button is pressed?

Virtually zero Amps, as pin 2 is set to an input. There is some input impedance, but according to the datasheet that is, at maximum, 1µA.

What if I used the 3.3v on the arduino?

Same thing. 1µA.

or a 9v battery instead?

Then you will blow up your chip.

What is happening to the input pin when the button is not being pressed? (I assume it's a guarangeed LOW state due to any current being sapped by the GND, yes?)

That's where the resistor in the circuit comes in. It's called a pull-down resistor. It will make sure the pin is LOW. Without it the pin is "floating", and could read as HIGH. e.g. due to some static in the air, or just having your hands nearby the pin.

What would happen without the pull down resistor? A short when the button is pressed?

If you remove the resistor, you shouldn't connect GND to the other side of the switch. That would indeed cause a short between 5V and GND, possibly damaging your powersupply/PC or blow up your wires, or traces on the Arduino PCB

What would happen without the ground being connected at all? Anything?

The pin would be floating and result in sometimes reading a HIGH even when the button isn't pressed.

A tutorial for how to choose a pull down resistor I seen suggested a resistance value of 10 times the impedance of the pin. I'm not quite sure where to find this impedance value, but I have seen on an arduino tutorial "A 10K resistor is a good value for a pullup or pulldown resistor." Just not much of an explanation of why that value.

The value here isn't very critical. Somewhere between 1k and 100k will work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.