The input is high-impedance and as such hardly draws any current. But let's, for sake of argument, pretend there flows a (rather large) current of 1\$\mu\$A. This current will flow through the 10k\$\Omega\$ pull-up resistor causing a 10mV (1\$\mu\$A \$\times\$ 10k\$\Omega\$) voltage drop across it. So in this case the voltage on the input pin will be \$V_{CC}\$ - 10mV, probably 5V - 10mV = 4.99V. That will be still recognized as a high level, so no problems here.

The 10k\$\Omega\$ is a typical value for pull-up resistors for this reason: even if there's a small leakage current the voltage drop is negligible. Don't be tempted to increase it to 1M\$\Omega\$, though it will decrease the current when the switch is closed. At 1\$\mu\$A leakage current the voltage drop will be 1\$\mu\$A \$\times\$ 1M\$\Omega\$ = 1V, and then the 5V will drop to 4V. For a 5V supply this will still be OK, but for a 3.3V supply the resulting 2.3V may be too low to be always seen as a high level.

For the pull-down the story is about the same. There doesn't flow any current in the input; you can't say that it would be connected to ground (in which case closing the switch would indeed cause a short-circuit). As such the input takes the voltage you apply to it. If the switch is closed this is \$V_{CC}\$. If the switch is open it's ground (through the pull-down resistor). If there's no current flowing (ideal world) then there's no voltage drop across the resistor either, and the input will be at \$GND\$ level. In a real world situation it may be a few mV.

Analog inputs measure voltages, not resistance. It is possible to *infer* the value of a resistor by setting up a circuit in a certain way and measuring voltage on an analog input. But analog inputs on their own only measure voltage. Can you show the context from the manual you're referring to that claims an analog input obtains resistance?

The results you're getting for your three experiments sound perfectly correct. In Dia 1, as you seem to understand, the analog pin sees 5V and reports it. Analog inputs draw extremely little current. So little, in fact, that the current can be ignored in most cases*.

In Dia 2, you've created a resistor divider between 5V and GND. It's not really appropriate to call the 2nd resistor a "pull-down" resistor in this context. Redrawn, Dia 2 looks like:

^{simulate this circuit – Schematic created using CircuitLab}

The analog input pin draws no current, but there is a current path from 5V to GND. This causes a voltage drop across both resistors. The voltage at the middle is easily solved using Ohm's Law. The equation for the divided voltage looks like:
$$V_{divide}=5V\frac{R2}{R1+R2}$$
The "decreased value" you observed was in fact the divided voltage value. Choosing different values for R1 and R2 will give you a different analog voltage readings.

For Dia 3, consider the effect of Ohm's Law on that resistor. Remember, virtually no current is consumed by the analog input pin. If there's no current, then the *I* in \$V=IR\$ is zero. If the *I* is zero, then the voltage drop *V* is zero. If the voltage drop is zero, then there's no change in voltage on either side of the resistor. Therefore, both sides of the resistor read 5V and the analog pin will read a high value, exactly as you observed.

*There are times when this assumption is not correct and will result in measurement errors. But those cases can be safely ignored for introductory purposes.

## Best Answer

When working with a digital circuitry that senses analog voltage, for example a microcontroller, or let's say Arduino, you are measuring voltages. However, without current, voltage cannot be present.

For a voltage to be created on a component, there need to be a current flowing on it. According to Ohm's law;

\$V=I*R\$, when \$I=0\$, the equation becomes; \$V=0*R=0\$. Thus, no voltage will be present, and the microcontroller will not be able to measure anything.

Proper way of sensor connectionCheck out the schematic below. First, have a look at the left side, a proper LDR connection with a proper pull-down resistor. A current will flow through R2 and create a voltage drop on it.

\$Vanalog =Isensor*R_2\$, where \$Isensor\$ is determined with the total resistance of the sensor and \$R_2\$. Since LDR's resistance changes with the light, the current, hence the voltage will change.

You may have noticed that there is a resistor I drew in the input. This is called the input resistance, or impedance, of the microcontroller and is generally very big, such as \$10M\Omega\$.

In this configuration input resistance and \$R_2\$ are connected in parallel, so their effective resistance is going to be;

\$\dfrac{1}{\Omega_{total}}=\dfrac{1}{R_2}+\dfrac{1}{R_{in}}=9990.00999\Omega\$ which is almost equal to \$10k\Omega\$. So, there will be no change.

The voltage

`AnalogValue`

is then,\$Vanalog=Isensor*10k\$, where \$Isensor\$ is \$\dfrac{Vcc}{R_1+10k}\$

Let's say our sensor \$R_1\$ is 10k at the current lighting condition. And \$Vcc=5V\$;

\$Isensor=\dfrac{Vcc}{R_1+10k}=\dfrac{5}{10k+10k}=250 \mu A\$, \$Vanalog=2.5V\$

What if there was no pull-down resistor?If there was no pull-down resistor, the configuration would be as shown in below diagram. The sensor current, \$Isensor\$ would be the same as \$Iinput\$, since all the currents on a wire are the same. Our microcontroller measures the

`AnalogValue`

, the voltage on the pin.Let's calculate the values for this scenario, too:

We know that \$Isensor=Iinput\$, now let's assume, again, that LDR is \$10k\$,

`AnalogValue`

is calculated as follows;\$Vanalog=Isensor*R_{in}\$, where \$Isensor\$ is \$\dfrac{Vcc}{R_1+R_{in}}=\dfrac{5}{10k+10M}\approx500*10^-9\approx500nA\$

Thus, \$Vanalog=Isensor*10M\approx(500*10^-9)(10*10^6)\approx5V\$

As you can see, since almost no current flows, there is almost no voltage dropped on the sensor and even though we could read 2.5V on the previous proper configuration, we have read 5V with the same light, i.e. when \$R_1=10k\$. This configuration will not work.