-1

I've just started working with the Arduino UNO SMD edition and I'm also quiet new to electronics in general. Recently I wanted to try out this tutorial https://www.arduino.cc/en/Tutorial/Button and I ran into a problem with the pull-down resistor. In the tutorial they recommend a 10kOhm resistor but I've got only 460Ohms laying around. Obviously I could link dozens of them in series but I was wondering if it is possible to replace this 10k resistor with 460 Ohms. Would that be enough? I'm assuming, that the 5V Output can supply up to 500mA (datasheet) and the ground can take up to 500mA. Following Ohms Law I = U/R given 460Ohms there should be a current of 11mA flowing. Is it correct that the ground can take this amount of current?

Hope you can answer my question and may point out mistakes i made.

Greetings Tmirror

  • 1
    11mA is within the limits of an Arduino pin (which is 20mA). The only problem is that it wastes more electricity while the button is pressed. This is more of a issue when running of a battery. – Gerben May 24 '18 at 14:45
  • You are talking about an I/O pin I think. I'm talking about the 5V power supply pin, which is directly connected to the power source. This one can supply up to 500mA not 20mA. Or do I missunderstood something? – Tmirror May 24 '18 at 14:55
  • 1
    Sorry, you’re right. Disregard my first sentence. Second part is still valid. An alternative would be to use internal pull-up resistor that is in the ATMega328. That way you don’t need to add any resistor. – Gerben May 24 '18 at 14:59
  • Thank you for your answer. So my assumption and math was correct? It's not dangerous for the Arduino (or me laugh) to only use 460 Ohms? – Tmirror May 24 '18 at 15:05
  • 1
    Your calculation was correct. No danger. Power dissipation is 50mW, so assuming you are using a regular quarter watt throughhole resistor, there is also no danger of the resistor overheating. – Gerben May 24 '18 at 15:12
0

Why are you messing with pulldown resistors at all? Use the internal pullup resistor instead. Connect your button between the pin and Gnd so the pin goes low when pressed.

Here's a simple code example:

byte inputPin = 2;

void setup(){
    pinMode (inputPin, INPUT_PULLUP); // turns on internal pullup
    Serial.begin(9600);
}

void loop(){
    if (digitalRead(inputPin) == LOW){
        Serial.print ("button pressed");
    }

    else {
        Serial.print ("button open");
    }

    delay(200);  // limits reading to 5 times a second to avoid flooding the PC with messages

}
  • 1
    i corrected the formatting of your example code .... please do not post improperly formatted code. .... correct indentation is the first thing that beginners need to learn. – jsotola May 24 '18 at 22:27
  • How do you get the code box? When I edit the post, I don't what was added to create the code box. – CrossRoads May 25 '18 at 3:17

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.