Electronic – Voltage across LED and source when LED is floating from one end

circuit-designinputled

Refer to these pictures and can you explain why is there 3.335V coming across LED and the LED isn't even turning on. Also to note is that changing the resistor value does not change voltage at D2(A2) when switch is open. (I am using the D2(A2) point as an input for a microcontroller).

(This is also the same voltage coming in my real life circuit)

Voltage at D2(A2)

LED Specification

Addition!!!

Extra Points:
Also is it safe to use the point D2(A2) as input to a micro-controller (PIC18F46K22) with it being brought to 0V when SW1 is closed and being brought to high logic level when the SW1 is open.

Best Answer

You have the answer there in the properties page. The drive current is 10mA. With your 10k resistor, how much current do you think is going through the LED?

The forward voltage of the LED is (almost) constant (is does vary with current/temperature slightly), so changing the resistor value won't change the voltage over the LED. What it will do, is change the current going through it.

Your properties page shows a 2.2V drop over the LED. You have a source voltage of 5V. To find the current through the LED, use the formula: Iled = Vs-Vled/R

Using this, you can see the current going through your LED is: (5-2.2)/10000 = 280uA which is nowhere near enough to turn it on.

Try changing your resistor to something like 220 or 330 ohms and you will see it turn on.

Here is your circuit as you have it set up (using the exact same components):

enter image description here Look at the current. Not enough to light it up.

Here it is with the resistor changed:

enter image description here LED on.

EDIT

It was pointed out by brhans that I may have misread the question. If you are wondering why the voltage you are measuring is not the 2.2V you are expecting, it is because you are not measuring across the LED. You are actually measuring the voltage across the switch. This means anything you change above it will not affect the voltage across it, as the switch is constant. If you want to measure the voltage over the LED, then you need to move your probe above it. With the switch open, it will be near enough 5V, and the bottom probe will be the voltage you are measuring, which is the diode drop with zero current flowing. Close the switch and you will see the voltage changes. To show you what I mean:

enter image description here

This shows the expected results. Close the switch and you will see the numbers change:

enter image description here

Note that the switch has an open resistance of 100Mohms. As andy aka points out, this will account for the voltage level you see.