## Sunday, May 15, 2011

### Measuring LDR resistance from dusk to night

[May 17 2011: I've created a Google spreadsheet and pasted the values for 3 days of measurement. Includes charts. If I can force myself to wake up before dawn I'll measure predawn to dawn LDR resistance as well and update the spreadsheet.]

I'm in the process of designing my latest model of automatic night light circuit (it turns on the lights at dusk and switches it off at dawn) and I want to measure the resistance of the light dependent resistor (LDR) with respect to ambient light level. But lacking a light meter I did the only thing I could and measured the LDR resistance with respect to time of day.

To do this I cobbled up the following circuit on a breadboard which I placed outdoors. It's an LDR voltage divider which is buffered by a single-supply op amp. I ran an unshielded twisted pair (UTP) cable from the circuit  to my workbench power supply and Fluke 8842A DMM. The goal was to record the voltage output of the unity gain buffer every five minutes and then derive the LDR resistance.

Circuit was provided 10VDC. Output of the 78L05 (in circuit) was measured to be a stable 4.987V under bright and dark ambient conditions. The 1Mohm resistor measures 1.014Mohm

The following graph shows the measured voltage output of the op amp versus time. Since it's configured as a voltage follower (unity gain buffer) it merely translates the very high impedance input to a very low impedance output; hence, the output would be the voltage across R2.

This graph shows the computed resistance of the LDR versus time.

Equation is derived from voltage divider rule: VS [R2 /(R1 + R2)] = VO

where
VS = VDD = 4.987V
VO = op amp output voltage
R2 = resistance of resistor in series with the LDR forming a voltage divider = 1.014 Mohm

Solving for R1 we obtain: (VS - VO)R2 / VO

LDR resistance was 8Kohm at 17:40. It increased exponentially for an hour but then began plateauing by 18:50 because residual sunlight was ebbing to nil rapidly. By that time my own home and the neighbor's lights as well as sky/cloud reflected city lights began to account for most of what the LDR was picking up. By 19:00 measurement shows there was absolutely no sunlight. City lights must've increased or cloud cover increased since resistance dipped a bit. Maximum resistance was at 18:55 at 15.142Mohm.

The MCP6232 is a rail-to-rail I/O op amp so its output can go very near ground. Just to make sure we haven't reached the op amp's "floor" (VOL in the datasheet, i.e., the minimum voltage above ground which it can output), I covered the LDR with a black opaque plastic can (old Kodak 35-mm film canister). The circuit didn't instantly provide a value; rather the voltage gradually (exponentially) decreased. After about a minute the op amp output was down to 10mV which translates to an LDR resistance of 500 Mohm! After several more minutes it crept further down still to 7.5mV or 665Mohm.