4
\$\begingroup\$

I am trying to design an op-amp circuit to generate a digital pulse when an LDR is quickly obscured from ambient light (like when you pass your hand over it). This is the circuit I built - a differentiator:

op-amp differentiator

And here is the output when I pass my hand over the LDR:

osc output

Is this the right approach? What should I do to get a cleaner digital pulse output? Should I use a comparator at the output stage?

NOTE: R below LDR is 10k.

Update:

Just wanted to mention that Microchip has a "Tips 'n Tricks Comparator PIC MCU - Microchip" document with a section on the "Data Slicer" circuit mentioned by @Andy.

ww1.microchip.com/downloads/en/DeviceDoc/41215c.pdf‎

\$\endgroup\$
4
  • \$\begingroup\$ You want a response only when the light source is quickly obscured, but not if the light gradually fades? \$\endgroup\$
    – The Photon
    Commented Jul 10, 2013 at 16:18
  • 1
    \$\begingroup\$ A comparator will give you an output pulse with clean digital logic levels. If you also want to have a consistent output pulse width, add a one-shot on the output of the comparator. \$\endgroup\$
    – The Photon
    Commented Jul 10, 2013 at 16:24
  • \$\begingroup\$ Thanks. So I am basically on the right track on the use of a differentiator? \$\endgroup\$
    – M-V
    Commented Jul 10, 2013 at 16:26
  • \$\begingroup\$ Basically yes... \$\endgroup\$ Commented Jul 10, 2013 at 17:00

2 Answers 2

5
\$\begingroup\$

I think one of the main disadvantages of your circuit is that the Vin+ is connected to ground aka negative supply rail and this will be pulling your output into significant saturation because Vin- is several volts difference from it. I'm also concerned a bit that as the device isn't rail to rail you might get some oddball situations where the output inverts because the common-mode range on the inputs is exceeded.

I'm thinking along the lines of what is called as a data slicer. This circuit will tend to keep Vin+ and Vin- closer to each other. Here's a half idea of a circuit which I'll make a few points about underneath: -

enter image description here

Assuming the light input to the LDR is constant, the voltages on Vin+ and Vin- will, apart from noise be very close. In effect the output will be a noise amplifier but in the presense of a small data signal, the output will amplify and reproduce the data as CMOS level signals - this is its main use.

Because you are not using data and you also don't want a big noisy output, you can put a resistor across the capacitor so that the input to Vin+ is slightly less than Vin-. Maybe try 1Mohm. This will seperate the inputs sufficiently to stop noise breaking through and also give you a control value to optimize the response you need. I'd try a 1Mohm pot (in series with 100k) across the cap and do some testing.

The output will be a decent pulse because the op-amp is being used as a comparator. NB I know this device works quite well like this.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks. Still trying to understand how it works. So the inputs to the comparator are Signal (-) and Low Pass Filtered Signal (+)? A sudden change in data then causes a difference between these signals. Clever! \$\endgroup\$
    – M-V
    Commented Jul 10, 2013 at 17:19
0
\$\begingroup\$

I would definitely make sure you have enough bypass capacitance on the power line of your IC. You may have it already but I don't see it drawn in there. Any cap in the low uF range will do (preferably two or more with different values but probably don't need to go haywire for this).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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