Voltage divider for ADC
An LDR is a light dependent resistor. It doesn't generate voltage so you can't just connect it directly into an ADC because the ADC doesn't measure resistance, it measures voltage. So how can we generate a voltage from an LDR?







simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. (a) Using a constant current source. (b) Using a potential divider.

We know from Ohm's Law that V = IR so if we can run a current through our LDR then we can measure the voltage drop across it and, effectively, create a light-dependent voltage source.

Figure 1a shows how to do it with a constant current source. This makes the resistance to voltage calculation simple as the current is constant. Creating the constant current source can be more trouble than it's worth for most applications so we opt for a series resistor as shown in Figure 1b. The disadvantage with this arrangement is that the relationship is now non-linear and some more complicated mathematics have to be performed to work out the ratios.




  I read somewhere that it was used for "buffing" ...


That must have been an article about polishing something like your car. "Buffering" is a technique used in electronics to avoid altering the signal you are trying to measure by the act of taking the measurement. Usually a buffer amplifier is positioned between the signal being monitored and the device taking the measurement. The buffer amplifier is designed to have a very high input resistance so that it doesn't draw significant current from the device being measured. It isn't needed in this case.



Comment:


  So just to clarify, the resistors in the voltage divider circuit cause a current(V+/R) to flow to the LDR, which when multiplied with the LDR resistance gives its voltage. Am I right?


Yes. Take an LDR resistance measurement in the darkest and brightest situations and work out the best value of R1 to give you a decent voltage swing into the ADC. The equation is

$$ V_{ADC} = \frac {R_{LDR}}{R_1+R_{LDR}}V_+  $$

You can, of course swap the positions of R1 and the LDR if it suits your purposes. (Swap in the equation too.)




  Would the current from V+ even flow through the LDR? Wouldn't the current directly go to the analog input pin as there is no resistance along that path?


No, the ADC input typically has an internal resistance of > 100 k&Omega;. Check the datasheet. The idea is that it draws very little current from the device it is measuring.


  And even if there does flow some current through through the LDR, the value of that current would vary depending on the value of V+ and the resistor value? 


Correct. So we use a regulated voltage and a fixed resistor. A regulator maintains the voltage when the current draw varies.


  And hence this would also result in a variable LDR voltage value, right? 


No, for a given light level you will get repeatable readings provided V+ is constant and you have a reasonably stable resistor. For precision work you need to be concerned about temperature coefficient, etc., but for most hobby devices it wouldn't be a problem.