Pull-up or Pull-down?

I am experimenting with Example 02.DIGITAL - DigitalInputPullup. The subject of the example is using the pull-up resistor on the Arduino board to light the built-in LED. The only thing missing from the tutorial is lighting a LED not on the Arduino board. I mean, can I take your word for it that there really is a 10k resistor on the board, between the current, the LED, and the ground? It's kinda small.
I burned out several LEDs before it was explained to me that the current had to be reduced with a resistor. Accordingly, I always look for the resistor in any circuit using a LED. Now then, if the built-in resistor on the Arduino board diminishes the current, why not build a breadboard layout with a LED and no external resistor, for use with the DigitalInputPullup Example?
I rigged it and the breadboard LED lights when the button is pressed. My question is about my layout. Is it correct? See attached schematic. It shows the Example layout (with no external LED or resistor), and next to it is my layout, using an external LED, but no external resistor.
And one more thing: About the terms "pull up" and "pull down," I have a notion they refer to whichever side of the LED the resistor is on, the VCC or the GND. Which is my layout?

.

Wire your LEDs/switches similar to one of these:

You need a resistor with pin 13 ~ 220 ohms.
.

You need to include a current limiting resistor for any external led you use. The uno has a 1k resistor right next to the led. If you look with a magnifying lens, you will see the number 102 on the black block next to it. The internal pullups are good for putting the pin in a known state (5v, HIGH) with no outside intervention. That switch in drawing 2 will place ground potential at the pin, dropping it to 0v(LOW). At the same time, the led is going to try and source it's current from pin 13. If pin 13 is just set as a high output, it will not be able to handle the current the unlimited led will pass, resulting in a burnt led or pin. If the pin was set to input pullup, it uses a 20kOhm resistor eq, so using ohms law, that comes out to 250uA.

Pull-up resistor is resistor connected to supply voltage on one end and to "something" on the other. Pull-down resistor is connected to GND and "something".
It is possible to activate internal pull-up resistors on Arduino. It is as if you connected 20-50k resistor between 5V and the pin. This way you may drive LEDs without other resistor. But depending on your expectations and LED you use it may be too dim. Also it is a bit dangerous - if you configure the pin as OUTPUT HIGH by mistake, you may damage the LED and/or Arduino.

You are mixing up pull-up/down resistors (which ARE on the board) with current limiting resistors. (which are NOT on the board). They are in different position in the circuit. Also, the pull-up/downs are rather associated with a pin as an input, while current-limiting resistors are rather associated with a pin as an output.*
They are both explained here: What is the resistor for ? - General Electronics - Arduino Forum

  • Current-limiting does not make sense for an input alone, since it is already very high impedance. The resistor will not matter. It might still be used e.g. with a clamping diode to protect the input.
    Pull-up/down resistors do not make sense with an output, since they are overridden by the output. It might still be used set the pin to a defined state while the MCU is e.g. starting or being flashed. A good example for this is the CS pin of an SPI connection. While it is common in the Arduino community to just put a wire between the two pins, this practice might totally ruin your day when you plan a PCB without the pullup and you intend to flash via ICSP, which might not work if the SPI device thinks it is enabled due to a floating CS pin. Practical example (where I learned this): ATMEGA328P + RFM69 radio.

ElCaron:
You are mixing up pull-up/down resistors (which ARE on the board) with current limiting resistors. (which are NOT on the board).

That doesn't make any sense to me:

There are pullups on the chip for each pin, and there is a current limiting resistor on the board (ie the PCB)
for the LED driven from pin 13.

There are also pull-ups on RX and TX on the pcb I believe. These prevent noise on those pins confusing
the bootloader at power up.

Ok, correction:
You are mixing up pullup/down resistors (pullups ARE on the chip, which is on the board) with current limiting resistors. (which are NOT on the board, except in the circuits that contain LEDs of course).

There are also pull-ups on RX and TX on the pcb I believe. These prevent noise on those pins confusing
the bootloader at power up.

I did mention that use case in the footnote, with the example of an SPI connection.

ElCaron:
Ok, correction:
You are mixing up pullup/down resistors (pullups ARE on the chip, which is on the board) with current limiting resistors. (which are NOT on the board, except in the circuits that contain LEDs of course).

Strictly speaking you are right. But resistor is still resistor: internal "pull-up resistors" may be used as current limiting resistors to power LEDs/transistor bases or any other light load.

Smajdalf:
Strictly speaking you are right. But resistor is still resistor: internal "pull-up resistors" may be used as current limiting resistors to power LEDs/transistor bases or any other light load.

Ok, I see that you could do that. I actually had to dim the power LED of my media center with a 10k resistor to avoid lighting the living room with it. So I guess the 20kΩ and 50kΩ of an Arduino pullup could be used to run an LED. So strictly speaking YOU are right, but is that a hack/usecase common enough to confuse a newbie with it here, or should we stay to the basic overview (which I even amended with some exceptions)?

There is an internal to the '328P pullup resistor for each pin.
There are No pulldown resistors.
There are No current limit resistors between any pin and the IO connectors.
There is No current limit resistor between D13 and the L LED. D13 drives a comparator, the comparator output has a current limit resistor for driving the L LED.

The Rx and Tx LEDs are driven by the USB/Serial adapter chip, not by any of the '328P outputs.

The Rx and Tx pins are pulled high by the output of the USB/Serial adapter chip; there are not pullups to the 5V supply. There are 1K series resistors between the USB/Serial adapter and the D0/D1 pins, thus when then 328P wants to drive those lines as outputs it needs to sink 5mA to overcome the high level of the USB/Serial adapter (5V/1000 = 5mA), and any external devices driving D0/D1 must similarly be able to overcome the 5mA pullup to pull the lines low. Going high, the 1K pullup helps the line go high.

This is wrong: "internal "pull-up resistors" may be used as current limiting resistors to power LEDs/transistor bases or any other light load." All the internal pullups will do is very weakly light an LED if the pin is set to an input and the LED Anode is connected to the pin and the cathode to Gnd. If the pin is set to an Output and there is no external current limit resistor, the IO pin or the LED will be damaged eventually. And maybe sooner rather than later.

CrossRoads:
This is wrong: "internal "pull-up resistors" may be used as current limiting resistors to power LEDs/transistor bases or any other light load." All the internal pullups will do is very weakly light an LED if the pin is set to an input and the LED Anode is connected to the pin and the cathode to Gnd. If the pin is set to an Output and there is no external current limit resistor, the IO pin or the LED will be damaged eventually. And maybe sooner rather than later.

Smajdalf:
It is possible to activate internal pull-up resistors on Arduino. It is as if you connected 20-50k resistor between 5V and the pin. This way you may drive LEDs without other resistor. But depending on your expectations and LED you use it may be too dim. Also it is a bit dangerous - if you configure the pin as OUTPUT HIGH by mistake, you may damage the LED and/or Arduino.

It greatly depends on the LED driven and circumstances. For example I have some blue LEDs that are too bright when driven with 5V and 1k resistor. Driven by internal pull-up they look just fine. They may be hardly visible in direct noon sunlight but in room I never had problems. The same is true for my red LEDs. But I have green and yellow LEDs and they are hardly visible when driven by internal pull-up.

Fascinating thread. I expected no less. Looks like back to the lab for me, but there are two points I take with me.

  1. Use a resistor with a LED, that is, don't depend on the internal pullup resistor.
  2. The point of the tutorial Example 02.DIGITAL - DigitalInputPullup is how to use the internal resistor to prevent the switch from floating.
    I am trying my best to leave it at that, although I have as many questions revolving around the topic for several posts.

brianeo:

  1. Use a resistor with a LED, that is, don't depend on the internal pullup resistor.
  2. The point of the tutorial Example 02.DIGITAL - DigitalInputPullup is how to use the internal resistor to prevent the switch from floating.
    I am trying my best to leave it at that, although I have as many questions revolving around the topic for several posts.

That sounds like good practice to me. Maybe down the road after you are up to speed on sinking/sourcing current and the limitations of both (component dependant items), you might find a viable reason to use the input pullup as a source, but you might be hard pressed to find a good reason to, as setting the pin as an output can source 20mA instead of >250uA. Most things that need current limiting require more specific resistances to meet the application.

Maybe the confusion is coming from overlooking the distinction that the pullup resistors are not in series while a resistor used to limit current is in series with the LED in question.

  1. Use a resistor with a LED, that is, don't depend on the internal pullup resistor.

You cannot just "depend on the internal pullup resistor" for an LED. It is not in appropriate position in the circuit. There IS a hack to run an LED over it very dimly, but it requires different code! (Your driving pin that you use to switch the LED on and off would actually be set as an input for that hack.) So in my opinion, it was a very confusing, very unnecessary smartass remark to bring that hack into the game here.

ElCaron:
You cannot just "depend on the internal pullup resistor" for an LED. It is not in appropriate position in the circuit.

I don't want to have theological argument about "appropriate position in circuit". The part of IC named "pull-up resistor" may be used as current limiting resistor to drive a LED. Possibly it is not be intended use but is there any problem? (Rhetorical question - I am aware about one but it is negligible.)

ElCaron:
So in my opinion, it was a very confusing, very unnecessary smartass remark to bring that hack into the game here.

In OP there was question:

brianeo:
Now then, if the built-in resistor on the Arduino board diminishes the current, why not build a breadboard layout with a LED and no external resistor, for use with the DigitalInputPullup Example?

I answered the question. Answering to OP is "unnecessary smartass remark"?

Back to the topic. In fact since I discovered this is possible I use it frequently for quick solderless breadboard experiments. Example:

The large chip is ATMega328p, all the LEDs except for the too bright red LED on the right are powered from internal pull-up (only 3 are turned on at the moment). I cannot imagine the mess if I used external current limiting resistors for all of them. It would probably need one extra breadboard.
Also note: software fault (driving LED without current limiting) = damaged LED, pin driver should survive. Hardware fault (touching legs of two "current limiting resistors") = destroyed drivers of one or both pins in contention. It is easy to do hardware fault yourself. If wife/pet/young brother "helps" you it is inevitable.

Smajdalf:
I answered the question. Answering to OP is "unnecessary smartass remark"?

That's debatable. The question was, if there is a current limiting resistor that protects an LED when it is driven by a pin. The asking poster clearly didn't understand the difference between a pullup and an in-series resistor.

Now then, if the built-in resistor on the Arduino board diminishes the current

For that, the answer is "No!". Not "Yes, you can use it for current limiting if you understand that you need completely different code and this is basically some kind of hack"

I have read the OP again (and again and again). It is a bit confusing but states "DigitalInputPullup" three times. I expected the OP knows difference between OUTPUT, HIGH and input with pull-up. After looking on schematic again it is probably not the case. Still the OP asked if internal pull-up resistor may be used to drive LED and if the schematic is right. So it may be used for this but the schematic is WRONG. It is possible to connect
pin X --- LED --- GND
without any resistor and light the LED by pinMode(X,INPUT_PULLUP). In this case using pinMode(X,OUTPUT) will burn the LED if pin X is set HIGH.
The pull-up resistors are not "on the board" but "inside the chip" if it makes a difference.

(As a side note IIRC digitalWrite(x,HIGH) also activates the pull-up if the pin is in input mode and digitalWrite(x,LOW) deactivate it.)