Object Sensing using IR LED + Photodiode

Thread Starter

abuhafss

Joined Aug 17, 2010
318
Hi

The other day, I built an object counter based on Arduino+LM358+IR led+Photodiode. It worked perfectly as designed. However, the next day, the IR led+Photodiode caused a big frustration to me. They do not sense object crossing them. If I bring my finger very close to the photodiode or LED, then they might response.

The IR led & Photodiode are fixed together using an electrical tape with a small piece of foam sandwiched between them.
I also replaced IR led & Photodiode, this time I enclosed the Photodiode in a a small piece of heatshrink tube. (This combination also showed no improvement).

I would like to hear any tips on how to effectively set up the Photodiode & IR led for perfect sensing of objects.
 

Thread Starter

abuhafss

Joined Aug 17, 2010
318
Why is there a piece of foam between them?
Are they trying to 'see' through the foam?
Sorry for my weak description. Right now I am away from the setup otherwise, I could have get the photos.
Anyway, here is an illustration of the 2 configurations.

I have never used IR diode & Photo diodes before, so don't have the idea of the precautions.
Photodiode.png
 

noweare

Joined Jun 30, 2017
115
what are you trying to sense. Maybe try moving the sensor so that the objects block the beam rather them being next to each other.
 

Thread Starter

abuhafss

Joined Aug 17, 2010
318
what are you trying to sense. Maybe try moving the sensor so that the objects block the beam rather them being next to each other.
It is to sense and count "filled aluminum tubes" passing thru a vertical pipe.
As I mentioned in the first post, the first day configuration (A) worked perfectly. The next day, before enclosing the circuit board in some box, I checked the circuit again................and that started the game.
 

noweare

Joined Jun 30, 2017
115
Once you put it in the box it probably shielded the rcvr. If your bouncing off of a cylinder you may try widening the distance between sender and rcvr.
 

Bernard

Joined Aug 7, 2008
5,784
The vertical pipe is transparent ? If so a beam break might be more reliable than photo reflective sensor.
In your drawing , 100k might work better than 10k ? How does tube OD compare to pipe ID ?
With photo reflective sensing, for me the best distance is about 3 mm. using a packaged detector like OPTEK K2362. where the LED & photo transistor are angled at about 40 deg. Also helpful if transmitter & receiver have close to the same spectrum, around 900 nm.
 
Last edited:

Thread Starter

abuhafss

Joined Aug 17, 2010
318
Thanks for the inputs from all you, really appreciate them.

The sensors are installed in the wall of an opaque PVC pipe having an internal diameter of 1 inch with wall thickness about 2mm. As I have mentioned, I have absolutely no experience of using IR leds and Photodiodes but I am bit concerned that if the circuit worked 100% as my desire in the first go, why it changed its behavior the next day....(rest assured no body touched or tempered it). Next, if it happened to worked perfectly on the first day then it should work again............the only thing is the proper installation of the sensors. I would like to have some tips on setting them.
 

Thread Starter

abuhafss

Joined Aug 17, 2010
318
If your bouncing off of a cylinder you may try widening the distance between sender and rcvr.
There are two different sizes of the aluminum tubes, 10mm and 18mm (diameter). And the tubes do not travel smoothly within the pipe, in fact they fall freely with lot of "dancing". So I don't think that widening the distance between the Tx & Rx would make any significant difference. What do you say?
 

Reloadron

Joined Jan 15, 2015
7,866
What you are looking at is reflective sensing along the lines of a VTR16D1 Reflective Opto Switch type configuration just as an example. Note in the link the angles of the transmitter and receiver and the sensing distance. Also the opacity of the sensed object is important as to does it reflect light well or absorb the light? With your schematic you would do better likely if you used a good comparator chip rather than a common op-amp type chip. A single version of the LM 339 would be a good choice like the LM 311 or similar. Also since you set a reference voltage on the comparator I would think about just using a digital input rather than analog input on your Arduino. An object is or is not sensed so it is sort of a yes or no type thing. Optoswitches, Optical Hybrids, Optoswitches, Optical Hybrids, and Custom Optical and Custom Optical Assemblies is another good read on the subject.

Ron
 

Thread Starter

abuhafss

Joined Aug 17, 2010
318
What you are looking at is reflective sensing along the lines of a VTR16D1 Reflective Opto Switch type configuration just as an example. Note in the link the angles of the transmitter and receiver and the sensing distance. Also the opacity of the sensed object is important as to does it reflect light well or absorb the light? With your schematic you would do better likely if you used a good comparator chip rather than a common op-amp type chip. A single version of the LM 339 would be a good choice like the LM 311 or similar. Also since you set a reference voltage on the comparator I would think about just using a digital input rather than analog input on your Arduino. An object is or is not sensed so it is sort of a yes or no type thing. Optoswitches, Optical Hybrids, Optoswitches, Optical Hybrids, and Custom Optical and Custom Optical Assemblies is another good read on the subject.

Ron
a) Objects are aluminum painted tubes which I believe do reflect quite well.
b) I'll try with LM393 comparator which have same pinouts.
c) I am using pin A0 as digital pin 14 because all other pins are engaged with 4-digit 7-segment module.
d) Thanks for the links.
 

Reloadron

Joined Jan 15, 2015
7,866
The LM393 is another good option, just remember it uses an open collector out so you want a pull up resistor on the output. Something in the order of 10K Ohm.

Ron
 

Bernard

Joined Aug 7, 2008
5,784
A 10 mm target in a 25 mm field is going to be a tough nut to crack. I'm thinking of one Tx & 4 Rxs similar to
detecting a falling water drop with a target zone of 10 mm. Tx & Rxs were 20 in apart & it worked.
 

Sensacell

Joined Jun 19, 2012
3,770
You are expecting too much from this simple technology.

It might work if the distance and orientation of the objects was more tightly controlled, but 10mm objects falling through a 25 mm tube? - not gonna work in any reliable way.

Maybe with an array of through-beam sensors, making a curtain of light for the part to break as it falls
 

Thread Starter

abuhafss

Joined Aug 17, 2010
318
A 10 mm target in a 25 mm field is going to be a tough nut to crack. I'm thinking of one Tx & 4 Rxs similar to
detecting a falling water drop with a target zone of 10 mm. Tx & Rxs were 20 in apart & it worked.
Can one Tx would be enough to beam 4 Rxs?
If yes, what would be the configuration?
(Rx)
(Rx)
(Tx)
(Rx)
(Rx)

OR

(Rx) (Rx)
(Tx)
(Rx) (Rx)

Also please confirm if a quad comparator would be required to handle 4 Rxs?
 
Last edited:

Thread Starter

abuhafss

Joined Aug 17, 2010
318
By the way, please enlighten me:

a) If Tx and Rx (both naked) are installed side by side, would the beam enter from the side?
b) Should the Rx be covered around the sides?
c) Would any layer of cured super glue on Rx affect the performance?
 
Top