Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

IR circuit issues

Vizier87

Active Member
Hi everyone.

I've built an IR circuit for "event detection" like this:

1722500625572.jpeg


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.

Thanks!
Vizier87
 
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.
 
1) Add positive feedback round the opamp, to make it 'snap', this is very important in comparator circuits.

2) Add PSU decoupling capacitors, essential in all electronic circuits.

3) Use a 5V regulator (7805 or 78L05) to power it, again with the required capacitors.

4) Remove the speaker - as already suggested you can't just hang a speaker on an opamp.
 
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.

1722513348236.png


Or use a LM386 kind of part, take a look at this thread -


Read the LM386 datasheet carefully as that part can oscillate and is not tolerant of HV (generated
by L loads).

Hysteresis calculator for comparator : https://www.allaboutcircuits.com/tools/hysteresis-comparator-calculator/

1722512208100.png



Regards, Dana.
 
Last edited:
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.
 
Last edited:
You are meeting the CM range for the inputs ?

View attachment 146571

Meeting the power pin bypassing recommendations ?

View attachment 146572

Regards, Dana.

If I understand you correctly, I believe I conformed to it, being that voltages measured at the inverting and non-inverting inputs at the op amp are around 3.2V in my temp settings. Then again...

1722563583257.png


I'm trying to find a loose Zener for now, but your mention of Zeners is just like this right?:

1722563810638.png



Just got hold of my design software back after a while, hope you don't mind.

Thank you everyone, I'm still parsing through the replies and making the adjustments.


I guess the days of the 7805 are not over yet...


Vizier87
 
The Vcc connection of pot should change to the junction of Zener and
R5.

Note I missed seeing that your 5V is regulated per your earlier statement :

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 thats the case you dont need Zener. But a 5V regulator has a tolerance so
you would see different trip points when trying different ones as a references.
So that begs the question how accurate do you want the trip point (Vref voltage)
to be ? The 7805 by the way has an output tolerance of +/- 2% depending
on whose datasheet you are looking at/using. Thats a possible 200 mV possible
difference one part to another.....

You still have no hysteresis around the comparator, so that can make the
comparison more sensitive to noise. Post #9 has a calculator to implement
one. Set it for 100 mV of Hysteresis for a starting point.


Regards, Dana
 
Last edited:
If you reference everything to 0V then it will be insensitive to a single supply voltage where input common-mode voltage range includes ground in the LM358 OA.

Using Vin+ to 0V and Vin- to the inverted cathode and anode grounded will accomplish this with negative feedback such as 10 Meg. Making restricted optical in the radial direction removes interfering light.


To make this even more sensitive with matched diodes you make two identical circuit paths and use only one of the two optical paths for your test and a 3rd of 4 Op Amps as the comparator.

You want to restrict the block light in the photo-diode (or reversed LED) to about 1uA. Treat this as DC noise current. Then an optical slot will attenuate more with a hair follicle and be your signal.

Using a ground reference with high gain makes this task more stable.

Adding a slotted foil or shield across the path centre will improve your SNR ! Noise is also the drift in the Op Amp due to input bias currents.

With an open loop gain=1e5 (100dB) in the quad LM358, you can use a neg. feedback resistor > 10Meg to the cathode which keeps the inputs at 0V

This worked well for me with a 9V battery but you can use a lower V.

You can also use an LED as a Photodiode but IR PD's have daylight-blocking filters are useful if using an IR LED. But I have used blue LEDs for both emitter and detector with proper optical shielding and again reducing the unblocked area of the detector to a slot makes the linear sensitivity much higher to a thin hair.

LED's will respond as photodiodes better to wavelengths shorter than the emitter wavelength.

It was perhaps 30 yrs ago, I used IR LEDs and PD to detect a 1/4W resistor wire across a 1m wide open optical path using recessed 5mm LED and IR Rx from Sharp with AGC and transmitting a unique repeating 5 bit data pattern and any error detected was only from a tiny blocked path. It was also immune to fluorescent ceiling lights.

Just remember to avoid unwanted stray positive AC (pf) feedback which causes oscillation by choice of only 1 inverting stage with stray wires and "star ground" to avoid ground shifts.


Here's a video but intended to work more on sensing UV from an oxy-H2 flame but just using 2 LED's could detect a faint shadow created by waving my fingers far away from a ceiling light. Only using two series high Meg resistors, 2 LEDs an LM358 and 9V battery. The emitter LED wasn't needed here but the Op Amp current limiting worked fine without a resistor to drive the LED to just act as an indicator.


1722627398326.png

>150 Meg video
 
Last edited:
sorry about the long-winded suggestion
 
Using a zener and thinking the reference will be the same across all input voltages is optimistic. Look on the datasheet of a zener and they show you the Vrev vs current. The voltage will only be constant at the zener if you supply it with constant current when you are changing the voltages. Not a good plan - much easier to use a voltage regulator as mentioned above. Also, using a capacitively coupled system with a zero-volt reference will work well. Otherwise, just re-think the whole design.
 
One sim using a 3.6V Zener :

1722637540827.png


For a supply change of 5.5V Vz changed ~70 mV.

Of course do we trust the model.....

A +/- 2% regulator ~ 90 mV......

Of course above not all error budget, eg. not looking yet at T changes.....


Regards, Dana.
 
Hi everyone.
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.

Thanks!
Vizier87

Hi

Please annotate all ref voltages, resistor values, and LED part numbers to your schematic.
Might be able to just raise supply to 9v, then buffer the reference voltage (or both inputs) by using an unused opamp.
 

Latest threads

New Articles From Microcontroller Tips

Back
Top