3

I'm a high school student, making a project which uses LDR, as we know resistance across the terminals varies according to the amount of light falling on it, but in my project I just need two definite states, either high or low as output, i.e after certain threshold the output should high/low.

Problem is that, I can do this with an Arduino but I want to keep it as simple as possible, so I'm looking solution of this problem in form of any combination of logic gates available in market.

I'm not still in college and don't have anyone around me capable of helping me with this matter, so I'm here looking forward to you guys.

Thank You

Tanishq Jaiswal
  • 345
  • 3
  • 13

1 Answers1

6

First you need to turn the variable resistance of the LDR into a variable voltage, then you compare that voltage to a threshold. The first is done with a simple resistor divider, with the LDR being one of the two resistor. The second is done with a comparator. Many opamps can work like comparators if used open loop.

Here is a example circuit:

When more light shines on the LDR, its resistance goes down. It and R2 form a resistor divider that makes a fraction of the power voltage at the junction between the two resistors. The fraction is dependent on both resistors. When the top one is lowered, the output voltage goes up. R2 should be about the resistance the LDR has at the light threshold you want to switch at. That gives you most sensitivity right around that light level.

R3 sets the light threshold. All it does is produce a voltage that is a fraction of the supply voltage, depending on how the knob is turned.

IC1 compares the two voltages. Its output goes high when the + input is higher than the - input, and low when + is lower than -.

One subtlety with this circuit is that it will probably oscillate or be unstable when the light is right at the threshold. In theory, the two opamp inputs are equal then. There is always some noise, so sometimes one will be more positive than the other, then in the next instant it will be reversed. It's actually informative to experiment with this circuit as it is and to observe the behavior right at the threshold.

To get snap action, add a big resistance from OUT to the + input. If the output is just at the point where it goes high, that higher output will make the plus input just a little higher, which makes OUT more solidly high, etc. Note that now going down requires a little lower threshold. A resistor from OUT to + adds hysetersis, which means there are actually two thresholds, a slightly high one for going up, and a slightly low one for going down. 1 MΩ should work for the hysteresis feedback resistance in this case.

Neil_UK
  • 166,079
  • 3
  • 185
  • 408
Olin Lathrop
  • 313,258
  • 36
  • 434
  • 925
  • Thank you very much sir for clearing my queries by your answer. – Tanishq Jaiswal Dec 27 '16 at 19:17
  • 2
    You might add that the poster should buy a cheap DMM, then measure the LDR at about the same light level he wants to switch at, then get R2 at the same value. This will make adjustment easy. If he's going to play around with circuits he needs a meter anyways. – WhatRoughBeast Dec 27 '16 at 19:22
  • What's the cap for? – D. Patrick Dec 28 '16 at 04:51
  • 1
    The cap C1 is a power supply bypass capacitor. This may keep the MPC6001 op-amp from oscillating, and may keep noise out of the circuit. – Paul Elliott Dec 28 '16 at 06:38