Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I'm looking at this light sensor:

enter image description here

What exactly is the point of having an LM358 (a Dual Op-Amp I believe) for a Light Sensor? Maybe I'm missing something....but what exactly purpose does it serve?

I know this is probably a simple and stupid question. But why can't you just read the Analog data out from the Light Sensor?

share|improve this question

2 Answers 2

up vote 11 down vote accepted

The LDR and a 10 k\$\Omega\$ resistor together form a voltage divider, whose output depends on the LDR's resistance. If you connect the output to a low impedance circuit that will get parallel to one of the resistors and distort the reading.

edit (re Sauron's question for further explanation)
"Impedance" is the general word for any type of load, but here we can call it "resistance". Suppose our LDR's resistance is 10 k\$\Omega\$. Then with the 10 k\$\Omega\$ series resistance they will form a 1/2 divider, and the output will be 2.5 V. But if the output would go to the next part in the circuit, which also has a 10 k\$\Omega\$ resistance to ground, that would become parallel to the LDR's series resistance, and two 10 k\$\Omega\$ resistors in parallel result in a 5 k\$\Omega\$ resistance. So the divider is no longer the LDR's 10 k\$\Omega\$ in series with the series resistor's 10 k\$\Omega\$, but with 5 k\$\Omega\$, and then the divider's ratio becomes 1/3 instead of 1/2. The output will be 1.67 V instead of 2.5 V. That's how a load resistance can distort a reading. In practice the difference may not be that large, but in many cases a reading of 2.4 V instead of the expected 2.5 V is already a too large error.

A unity gain buffer isolates the divider from its load.

enter image description here

The opamp has a high input impedance and thus won't change the reading.

If you connect the divider's output directly to a microcontroller's ADC the buffer will probably not be necessary.
The values from the LDR's graph give approximately

30 k\$\Omega\$ to 100 k\$\Omega\$ at 1 lux,
15 k\$\Omega\$ average at 10 lux,
2.5 k\$\Omega\$ to 3.5 k\$\Omega\$ at 100 lux.

With a 10 k\$\Omega\$ series resistor that means that for a 5V supply the output voltage may vary between 0.45 V and 4 V. The LM358's output can handle the lower limit, but the 4 V may be a problem. To be sure, if you have to use a buffer, use an Rail-To-Rail opamp instead. Like I said, for connection with a microcontroller you probably don't need one.

edit
Then you don't really need the PCB, just buy an LDR. Russell comments on the limited range of the LDR used here, and he's right. 100 lux is what you get on a very dark day. As soon as the sun comes out you'll easily have more than that, even indoors. Instead of selecting an other LDR I would switch to a phototransistor. They are much faster than the incredibly slow LDRs and since they have a current output the resistor voltage will be linear with incident light. You use them the same way: in series with a resistor.

This phototransistor is adapted to the eye's spectral sensitivity. It is specified from 10 lux (twilight) to 1000 lux (overcast day), though I worked with it at levels as low as 1 lux (deep twilight) and as high as several thousands of lux (full daylight) without problems.

Illumination level descriptions from here

share|improve this answer
    
+1 This is the voltage follower mentioned in the description. –  starblue Jun 16 '12 at 7:20
    
"If you connect the output to a low impedance circuit that will get parallel to one of the resistors and distort the reading". IM not super familiar with Impedance and how it affects things, can you explain "why" this is? –  Mercfh Jun 17 '12 at 6:00
    
@Sauron - edited my answer. Let me know if there's anything else that needs clarifying. Have a nice day. –  stevenvh Jun 17 '12 at 6:17
    
@stevenvh Thank you very much! makes much more sense! –  Mercfh Jun 17 '12 at 18:36

Their diagram is shown below.
I have added the connection from Opamp inverting input to Opamp output as this was shown by the D1 net labels but easily missed due to the pathetic diagram. quality. There was no need to use net-labels to sho this connection in this case, and doing so hides the classic unity gain buffer configuration.
When 100% of an opamp's output is fed back to the inverting input, as is done here, the output tracks the noninverting input. The output can drive whatever the opamp is capable of driving, whereas the input can be of low drive capability, needing only to be able to drive the opamp input.

The opamp noninverting input "sees" the voltage at the R_LDR & R1 common point =

Vin = Vcc x (R1/(R1 + R_LDR)

enter image description here


Bad circuit!

An important point, which they appear to have missed, is that the LM358 opamp has a maximum allowable input voltage of less than Vcc by as much as 1.5V at 25 C or as much as 2V across the whole temperature range.
This means that at 25C when Vcc = 5V, the maximum input voltage that the IC can deal with is 5 - 1.5 = 3.5 VDC. If the input voltage is ever higher than 3.5 VDC with Vcc = 5V then the output may be indeterminate.

A look at their picture shows R1 = 10k.

enter image description here

As above, the voltage into the opamp = Vcc x (R1/(R1 + R_LDR)
This will equal 3.5V when 3.5V drop across R1 and 1.5V drop across R_LDR. so this occurs when R_LDR = 1.5/3.5 x 10k = 4300 Ohms.
As the LDR resistance drops with increasing light, the upper legal light limit is when R_LDR = 4200 Ohms, BUT the LDR is shown on their Wiki page as decreasing to as little as 1K at 100 lux. (There is shown to be a spread from 1k to 2k for typical product).

The light value where Vin = 3.5V can be read from the graph. As can be see, when LDR = 4k3, lux level = somewhere in the 40 to 70 lux range. As the LDR is shown as being 1K at 100 lux, someopamps will allow less than half the desired range to be measured. In practice many opamps may exceed 3.5V common mode ranmge and measurable lux level will be higher.

LDR choice:

Maximum lux level is shown as 100 lux. That is a level which is adequate for reading but well below what is recommended for domestic illumination. Full sunlight is 100,000 lux and a typical overcast but not totally stormy day may be 10,000 lux. So the 100 lux limit of the sensor seems very low for interesting experimental purposes. The PCBA is an OK price at $5 (although someone like Sparkfun would be expected to sell something this simple for much less) BUT in many cases, buying an LDR and adding a resistor and feeding 5V in, with no opamp buffer, would produce an equally useful result, plus the ability to select an LDR liable to be more generally useful.

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.