I've built an IR circuit for "event detection" like this:
I just used one of the op-amps from an LM358.
Between L1 and L2, it needs to be sensitive enough so that even a strand of hair sets the LED D1 on.
Which I managed to do quite nicely.
My problem is, the circuit's comparator tuning at R3 is not specific for different power sources, even when they're all at 5V. If I plugged in different supply sources, I'd have to recalibrate the pot again. And also, once powered off, the calibration sometimes need to be tweaked again too, though not as much as switching to a different supply.
Is there a better way to handle this analogically? I know I could just probably use a uC to establish a baseline and capture the event based on the minor perturbations from the baseline but I prefer to keep this as analog as possible.
Unless your speaker has a very high resistance it will act almost as a short circuit on the LM358 output and will drag the output voltage down, probably below the point at which D1 (if that is meant to be an LED) will light.
You can drive a speaker, at low levels, by using a series R with speaker to decouple
the low Z load a speaker represents. You sacrifice efficiency and audio volume.
Start by using 1K ohm and drop it, maybe not < 100 ohms.
Or use a LM386 kind of part, take a look at this thread -
I need to drive a small (8Ω 250mW) speaker. The way I know how to do this is to use an Op Amp and a NPN/PNP push pull (the Op Amp alone can't provide enough current). Is there a better way to do this? Perhaps an Op Amp which is designed to put enough current out? I know the LM386 is...
www.electro-tech-online.com
Read the LM386 datasheet carefully as that part can oscillate and is not tolerant of HV (generated
by L loads).
Another approach is to remove the preset pot and connect the opamp positive input to a capacitor to 0V, and a fairly high value resistor (10k?) to opamp negative in.
Then add a much! higher value resistor from positive in to positive power, so the positive in is offset by just a few millivolts higher than the negative.
That should make it self-adaptive regardless of the exact photodiode or supply voltage - though it will not see a permanent interruption to the light beam. Some overall supply regulation would still improve it though.
Edit - just noticed that the opamp inputs appear reversed? As shown, the photodiode would be conducting and pulling the negative input low when there was no interruption, so setting the output high? Or is it supposed to be sensing reflection rather than interruption?
If it's for reflective sensing, the high value resistor should be from positive in to ground, rather than positive in to power. That will also be less sensitive to supply variations.
If you want to keep the fixed bias, try adding a normal or shottky diode (or two or both) in series with the 0V end of the preset, so the wiper voltage changes less with supply variations.