Understanding pull down resistors

Hi,
I'm trying to use the Arduino to read the state an LED that's being controlled by another 3V microcontroller. I can solder a wire to the positive side of the LED, and land that wire to the Arduino input pin. But I think I need a pull down resistor on that exact same pin right? So that the pin isn't floating when the LED is off?

How does the pull-down resistor effect the LED and the existing microcontroller? When the microcontroller has the LED turned on, my pull down resistor will be drawing a bit of current (3V over 10kohm resistor is like 0.3mA). Is that typically OK for most microcontrollers?

Are you connecting the ground of your Arduino to the ground of the other microcontroller?

I suggest you monitor the voltage on one side of your LED (not necessarily the positive side) using an analogue input to your Arduino. You do not need a pull-down resistor but it would be advisable to put a resistor of roughly 10kΩ in series with the analogue input; this resistor will come into play if your other microcontroller is powered-up while the Arduino is not powered-up.

That input pin will not float because when the LED is off, it is off because the positive side of the LED is connected not to +5 but to ground.

OK, two things being looked at here as Archibald notes.

One is isolation between the two systems in case of one being powered and the other not. This mandates a resistor - 10k at minimum but 47k probably more appropriate - in series with the monitoring Arduino input.

The second is a matter of voltages. Now to consider this, it is necessary to know exactly how the LED is connected. (It also helps to know the colour of the LED.) A LED must necessarily have a current-limiting resistor in series so that if say, you have the MCU output going through a resistor to the LED whose other terminal is then grounded, what you want to sense is not the voltage on the LED, but the voltage on the MCU pin driving it which for 3.3 V will be somewhere near the 3.3 V, but less on the LED - about 2 V for a Red LED, 3 V or so for a blue or white.

So if the LED is connected to ground and you merely sense the positive side of the LED, you may or not detect a logic "HIGH" to the Arduino input at all, which is why Archibald suggests you might need to take an analog measurement instead. So you really need to connect directly to the output of the MCU driving the LED.

As to the need for a pull-down, we would mostly program an Arduino so that the pin is always an output, and therefore goes either HIGH or LOW. When it is driven LOW, then the resistor will promptly pull the voltage on the LED to zero. In fact, if you set the output pin HIGH but made it an input instead, it would actually light the LED faintly with the internal pull-up current.

In general the LED will be its own pull-down, though not as effectively as an incandescent lamp.

The problem with LEDs is the high bandgap voltage means that they are very good insulators for quite
a big voltage range below Vf, so will float in that range. About 0.5V(*) below the forward voltage a semiconductor
pn-diode will have an established depletion zone, so for a 3.2V white LED that means below about 2.7V
the LED carries only leakage- and photo- currents.

Thus for 3.3V logic a pull-down would be necessary, no question. The Arduino logic thresholds at 5V
are 1.5V and 3.0V IIRC, so this could be an issue (with green, blue or white LEDs)

(*) The current falls off one decade per 60mV at room temperature, so 0.5V is 8 orders of magnitude.
This same law explains why germanium and schottky diodes have large leakage currents, since there
is only 0.3V or so between Vf and 0V.

Basically the same exponential law governs all diodes, due to the term e^(e.V/k.T)

Archibald:
Are you connecting the ground of your Arduino to the ground of the other microcontroller?

Paul__B:
OK, two things being looked at here as Archibald notes.

One is isolation between the two systems ...

The second is a matter of voltages. ...

Oh, thanks for pointing that out to me. I don't understand the "isolation" topic. Why is a resistor needed in series with the input? If one system is powered up and the other isn't - is that a problem? On the Arduino side, the pinmode should be "INPUT", not "INPUT_PULLUP", right? Does that have anything to do with this?

The other microcontroller is battery powered. I have access to the positive and negative terminals of the battery. Can I just solder in a wire to the negative end of the battery holder and pull it over to any of the GND pins on my Arduino like this?

http://s9.postimg.org/prguyaksf/diagram.jpg

I also have access to the digital output pin on the foreign microcontroller. So, I expect to see +3.0V on that pin when the LED is on. I see that if I pull in a common GND reference, I don't really need a pull-down resistor.

You need the isolation resistor because if you merely connect a pin of one MCU directly to a pin of the other, then the powered one will (if the output goes HIGH) feed current back into the un-powered one through the internal protection diode between that port pin and Vcc and the protection diode is not rated for more than 1 mA at most.

If your "Foreign" MCU switches the LED either HIGH or LOW, always as an output, then no pull-down is needed. And if the LED is red, then it would itself pull the output down to 1.5 V anyway.

Paul__B:
You need the isolation resistor because if you merely connect a pin of one MCU directly to a pin of the other, then the powered one will (if the output goes HIGH) feed current back into the un-powered one through the internal protection diode between that port pin and Vcc and the protection diode is not rated for more than 1 mA at most.

Ok thanks. I'm still pretty new to this and trying to understand. I've been googling how MCU's read digital input pins. Internally, there's a ground path for the input pin, because there's a very small amount of current that flows into the input pin, right? So if current is flowing, the resistor in front of the input pin gets a voltage drop. The amount of drop depends on the size of the internal resistance?

When the Arduino is turned off, does this internal resistance disappear, so if there isn't an external resistor, lots of current would flow into that input pin?

When the Arduino is powered on, the internal resistance exists, and it's so much higher than the 10kOhm external resistor that most of the voltage from the foreign MCU drops over the internal resistor, and very little is dropped over the external resistor, so we still read the voltage correctly?

I don't really understand the mechanism, but is that functionally correct?

http://s13.postimg.org/qyi5rye07/internal_resistance.jpg

No, no current flows into an input pin, they are isolated by the gate-oxide layers of the input FETs.

(Actually some current flows, but you can't easily measure a few picoamps).

If what you need is to know if an LED is on, then why not do it with a photo-detector on the second Arduino? That way there would not need to be an electrical connection at all.

arusr:
I don't understand the "isolation" topic. Why is a resistor needed in series with the input? If one system is powered up and the other isn't - is that a problem?

Yes it's a problem. Your Arduino has protection diodes on its inputs like this:

If your Arduino is not powered up and the output from the "foreign MCU" is high (about 3 volts) current will flow through diode D1. That will tend to start to power up the Arduino because its Vcc will rise. As pointed out by Paul, the current could be excessive for diode D1. Your foreign MCU may not like it either. The suggested resistor in series with the Arduino's input does not provide electrical isolation.

arusr:
On the Arduino side, the pinmode should be "INPUT", not "INPUT_PULLUP", right? Does that have anything to do with this?

Yes, pinMode should be INPUT.

arusr:
The other microcontroller is battery powered. I have access to the positive and negative terminals of the battery. Can I just solder in a wire to the negative end of the battery holder and pull it over to any of the GND pins on my Arduino like this?

Yes.

arusr:
I also have access to the digital output pin on the foreign microcontroller. So, I expect to see +3.0V on that pin when the LED is on. I see that if I pull in a common GND reference, I don't really need a pull-down resistor.

I'm not so sure you will see +3.0V when the LED is on. Could the LED and its series resistor be connected between the output and +3V or have you checked?

I still think it's best to use an analogue input to the Arduino. To determine whether the LED is on, you will need to check whether the digital reading from the analogue input is above or below a certain threshold. I expect you will not need a pull-down resistor.

The other microcontroller is battery powered. I have access to the positive and negative terminals of the battery. Can I just solder in a wire to the negative end of the battery holder and pull it over to any of the GND pins on my Arduino like this?

Yes.
when an input is unpowered it looks like a diode to the positive and negative supply. So anything over 0.5V is going to cause a lot of current to flow. As it will flow into the power rail it will try and power up the unpowered device. This is a bad thing and can end up damaging both devices.