Maker Pro
Maker Pro

LED optic sensor circuit

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I connected the photodiode as you suggested - reverse biased and +5V supply and the resistor. It measured 5volts. I shined my flashlight directly onto the photodiode and the voltage went practically to 0
That would indicate that it is a phototransistor and was connected the way you want it.
I hooked up the LED and moved the photodiode very close - there was no change in voltage. I did this to both of the 'tinted' components. I then tried a normal LED and when I moved the photodiode close, the voltage dropped by about 2 mV
Forgive me if this is a stupid question, but are you pointing the top of the two component as each other? That is the direction in which they emit and absorb light. If you simply put them side by side, with the tops both pointing up, I would expect the result you are getting.

Bob
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Also, the emitter is rated as 1.3V and 150mA. To get that current with a 5V supply, the resistor would be 25 Ohms. With a 220 resistor you may not be getting a lot of light out of it. Try lowering the resistor.

Bob
 

Lance Mannion

Jun 9, 2014
37
Joined
Jun 9, 2014
Messages
37
Bob,

Thanks for the help. Yes, I'm pointing the heads of the two components right at each other - top to top. I even move them around and there was no change. I'll try lowering the resistor.

The action of the phototransistor is the opposite of what I'm actually looking for. I'm looking for the following: when +5V is applied and the path is clear, I want about 800 mV and when something is blocking the sensor, I want 4-5V.

Thanks
 

kpatz

Feb 24, 2014
334
Joined
Feb 24, 2014
Messages
334
What voltage and resistor value are you driving the LED with? IR LEDs have a lower voltage drop (1.2V typical) and a higher current rating than visible LEDs. Some can handle 100 mA, though I recommend keeping it below 30-40 mA for maximum life.

The sensor is working as you want (other than it not responding well to the LED emission): low voltage when illuminated and high voltage when obstructed/dark.

In the circuit you're talking about, it senses golf balls when they obstruct the path between the LED and the sensor, causing the voltage to rise since the photodiode gets darkened.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
I've used those combo packs from RadioShack and IIRC the tinted one is the LED and the clear one is the sensor, which is actually a photodiode, not a phototransistor.
Some of the reviews on the RS site said that too.
I tried the diode test on both components.
1. tinted component - hooked leads up to DMM - display showed '1' or open. shined light - no change. switched leads and shined light - no change
2. clear component - hooked leads up to DMM 0 display showed 617. Shined light - display changed to 670. reversed biased the leads and the display read '1' or open. Shined light and the display read -300.
Based on this, does this prove the tint component is the LED and the clear one is the photodiode?
Maybe :) The way to be sure is to watch the LED using a cellphone camera, and trying both components, both ways round, with a 220 ohm limiting resistor. Only the LED will emit light, and it will emit light only when connected the right way round.
If this is a photodiode, would this not produce the results I was looking for in my initial post? Do I need to get an actual phototransistor in order to get those results?? Again, the results I'm looking for is a voltage of 800 mV when the sensor path is clear and 4-5 volts when the sensor path is blocked (i.e. golf ball has passed sensor)
You need a phototransistor. If you have a photodiode, you can add an external transistor. Connect the photodiode's cathode to the transistor's collector, and the photodiode's anode to the transistor's base. This uses the photodiode in photoconductive mode, which is the way normal phototransistors work. kpatz's earlier suggestion uses photovoltaic mode and I'm not sure if it will work very well.
I connected the photodiode as you suggested - reverse biased and +5V supply and the resistor. It measured 5volts. I shined my flashlight directly onto the photodiode and the voltage went practically to 0
That sounds like it's a phototransistor.
I hooked up the LED and moved the photodiode very close - there was no change in voltage. I did this to both of the 'tinted' components. I then tried a normal LED and when I moved the photodiode close, the voltage dropped by about 2 mV
I would expect the voltage to drop pretty low with a normal LED shining on it. Is your flashlight a lot brighter than a normal LED?
I just found another camera and when I plugged in both 'tinted' LEDs, I could see a little purple light on each so I guess they are emitting.
You should see a good clear bright light from the IR LED on your camera display.
That would indicate that it is a phototransistor and was connected the way you want it.
Yes, I agree.
Also, the emitter is rated as 1.3V and 150mA. To get that current with a 5V supply, the resistor would be 25 Ohms. With a 220 resistor you may not be getting a lot of light out of it. Try lowering the resistor.
I don't think that's a good idea - I don't trust Radio Shack's specifications, and in any case, 20 mA should be plenty of current to get a good visible indication on a cellphone camera display.
The action of the phototransistor is the opposite of what I'm actually looking for. I'm looking for the following: when +5V is applied and the path is clear, I want about 800 mV and when something is blocking the sensor, I want 4-5V.
That's what you're getting. With no light falling on it, the output voltage is high, and with light falling on it, it drops low. That's what I would expect with a phototransistor, and it matches the description of what you need, AFAIK.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
So the only mystery left is why the IR emitter cannot turn on the phototransistor. I still say you should try higher current, maybe not going all the way down to a 25 Ohm, but may a 100 Ohm resistor.

Bob
 

Lance Mannion

Jun 9, 2014
37
Joined
Jun 9, 2014
Messages
37
Thanks for the feedback guys. Yes, I think the circuit is working correctly. That is, voltage is low when light hits phototransistor and voltage goes up when the light is blocked.

I thought I'd try a regular LED so I bought a bright one from Radio Shack. When the phototransistor is directly across the bright white LED (7000mcd), the voltage drops to about 3.5V. The LED was connected with a 220ohm resistor. The voltage is still not nearly low enough. The only way I get the voltage to drop very low is to shine my flashlight on the phototransistor. My flashlight is extremely bright.

Any other suggestions as I've definitely have gotten closer!
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
You're still using a 10K resistor on the detector? You should be. The 220 ohm, or lower, resistor is only for the LED.

Well, maybe we should go back to the theory that the detector is a photodiode, not a phototransistor.

You can try connecting it to a separate transistor. Any small-signal NPN will do - 2N3904, 2N2222, BC547/8. If you don't already have something, Radio Shack will almost certainly have 2N3904 on the shelf. Connect it like this:

Phototransistor using photodiode.gif

The thing on the left is the device you have, which seems like it could be a photodiode. At the moment you have it connected the same way as shown on the diagram, but with its anode connected to 0V instead of to the base of the transistor.

When this is all figured out, you definitely should post a review on the Radio Shack site, saying whether the tinted one is the emitter or the detector, whether the detector is a photodiode or a phototransistor, and which terminal matches with the flat on the skirt for each of them. If we can't stop Radio Shack selling an over-priced, under-documented component, at least we can help other potential buyers!
 

Rick L

May 21, 2014
14
Joined
May 21, 2014
Messages
14
I'm using RadioShack photo transistors in a project I'm currently working on. http://www.radioshack.com/product/index.jsp?productId=2049724 I'm not sure if the one I'm using is the same as the one you are using, my guess would be they are the same. The ones I am using I can turn on with a white diode from a distance of 2 inches. I actually had to dim the diode at that distance because the phototransistor was saturated and wouldn't switch quick enough for my application.
There should be a flat on the phototransistor that designates the collector leg, see attached pic.
 

Attachments

  • phototran.jpg
    phototran.jpg
    77.7 KB · Views: 102

Lance Mannion

Jun 9, 2014
37
Joined
Jun 9, 2014
Messages
37
Kris,

OK - I can try to hook up a transistor as well. If it's actually a phototransistor and not a photodiode, will the additional transistor cause a problem? Can I hook it up the same way?

I do have the 10K resistor on the detector.
 

Lance Mannion

Jun 9, 2014
37
Joined
Jun 9, 2014
Messages
37
Rick,

Thanks for the response. I'm actually using a 'detector' from a package that contained a pair of components - one an LED, the other a 'detector'. I don't actually know if the detector is a phototransistor or a photodiode. It may be the same as yours. The product is here:
http://www.radioshack.com/product/index.jsp?productId=2049723

I guess I could always buy the component you indicate so I know it's a phototransistor and remove at least one unknown

The space between my LED and the phototransistor will be about 2.5 inches. What type of white LED are you using? Do you know its brightness?? Also, what value of resistor do you have before the LED? I can't seem to get the detector to go down close to 800mV, which is my goal :(
 
Last edited:

Lance Mannion

Jun 9, 2014
37
Joined
Jun 9, 2014
Messages
37
Before I try the transistor tomorrow, I thought I'd hook it up in the pipe just to see what kind of readings I get...With the components in the pipe, the voltage only drops to about 4.9V ;( That's using the bright white LED not the LED from the original package. When I stick something into the pipe to block the light, the voltage goes up to 5V. So, it's working but I can't seem to get a strong enough LED to drop the detector to 800mV when there is no obstruction.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
OK - I can try to hook up a transistor as well. If it's actually a phototransistor and not a photodiode, will the additional transistor cause a problem? Can I hook it up the same way?
It could cause a problem with slow turn-off, which might possibly mean it would fail to detect the ball if it was falling quickly. But if it's a phototransistor, it definitely should not need an extra transistor. If it's a phototransistor, you should get the behaviour that Rick L describes.
I do have the 10K resistor on the detector.
Good!
Before I try the transistor tomorrow, I thought I'd hook it up in the pipe just to see what kind of readings I get...With the components in the pipe, the voltage only drops to about 4.9V ;( That's using the bright white LED not the LED from the original package. When I stick something into the pipe to block the light, the voltage goes up to 5V. So, it's working but I can't seem to get a strong enough LED to drop the detector to 800mV when there is no obstruction.
OK. You might as well try the transistor, on the basis that what you have there is a photodiode.

Would you consider buying the two Digikey parts I mentioned in post #4? At least, check out what they would charge you for shipping. Having properly identified, known devices, with proper data sheets, would save a LOT of time and confusion.
 

Lance Mannion

Jun 9, 2014
37
Joined
Jun 9, 2014
Messages
37
Kris,

I ordered those Digikey parts yesterday. The shipping was less than 4 bucks. Hopefully, they'll get here soon :) At least I know the circuit works the way I want. Now I just have to hope these components work better.

Thanks
 

kpatz

Feb 24, 2014
334
Joined
Feb 24, 2014
Messages
334
Another way to see if it's a photodiode or phototransistor is to test it with the diode-test function on your meter, without light shining on it (put a piece of dark tape over it). It'll conduct in the forward direction with a typical diode voltage drop but not the reverse direction if it is a photodiode. A phototransistor won't conduct in either direction when dark.

Some of the reviews say the LED and sensor aren't well wavelength matched, which could be why the LED won't make the diode conduct as well as it should. That said, I've used them in a project and they worked well together. In my application I pulsed the LED with a microcontroller and used an op-amp to amplify the signal from the photodiode, and then fed into the comparator input on the micro, to sense the (reflected) pulses. It worked well.
 

Lance Mannion

Jun 9, 2014
37
Joined
Jun 9, 2014
Messages
37
As you suggested above, I tested the detector on the diode mode

First reading displayed 633
- I shined the light on the detector and it showed little change
- I put tape over the detector and it showed little change

Second reading (reversed leads) displayed 1 (open circuit)
- I shined the light on the detector and the reading went to -233
- I put tape over the detector and it showed 1 - open circuit
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
OK, that's a pretty clear indication that it's a photodiode. On the first reading you took, where the multimeter displayed 633, your red probe was on the anode and the black probe was on the cathode. Which one of these corresponds to the flat on the skirt at the base of the package?

Also, is the detector the clear one or the tinted one?

With that information you should be able to connect the transistor to convert it into a phototransistor. This should give the behaviour you want - collector voltage >4V in the dark, and <0.8V in light.

Edit: BTW here's a good application note:

http://www.hofoo.com.cn/uploadfiles/phototransistor-ired data book.pdf
 
Last edited:

Lance Mannion

Jun 9, 2014
37
Joined
Jun 9, 2014
Messages
37
On the package, the flat side is the cathode and the black lead from the MM was on cathode.

The detector is the clear one.

I'll try to hook up a transistor following your instructions or maybe I'll just spend the $2 on the specific phototransistor at radio shack

thanks for the link and the info

feels like I'm getting closer (crossed finger emoticon)
 

Lance Mannion

Jun 9, 2014
37
Joined
Jun 9, 2014
Messages
37
Just got back from radio shack with the phototransistor...Eureka!

I put the phototransistor in and the voltage went down to almost zero. I obstructed the path and the voltage jumped up to 5V!!!! sweet!

The only issue now is that the phototransistor and LED combo make the phototransistor read about 160mV from about 2.5 inches apart instead of the 800mV that I was looking for. Ha- I would have killed for this problem 2 days ago :) I guess I could try some 'dimmer' LEDs.

I'll definitely leave some feedback on radioshack's website about the transmitter and detector combo pack. Not at all what I thought I was buying.

Thanks all for your help, especially Kris who was the first to respond and to figure out my circuit from the corroded remains.
 

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
Cool! That's great.

You don't need to match the 800 mV. The circuit that is monitoring that signal is almost certainly digital; in other words, it has a threshold (that will be somewhere between 1V and 3V, probably) and it only cares whether your voltage is below that threshold or above it. So if the voltage drops down to 160 mV instead of 800 mV, the circuit won't care.

There's an improvement you can make, to fine-tune the sensitivity of the detector circuit. Add a resistor between the base and the emitter of the transistor you've added. The lower the value of this resistor, the more the sensitivity is reduced, and the quicker the circuit will respond to an interruption in the light. You should set up the detector sensitivity so that it will reliably respond to the LED, even if the LED's brightness drops a bit as it gets old, but isn't more sensitive than it needs to be. Here's how I would do it.

Install the LED and the detector in the pipe. Change the 220 ohm resistor to, say, 680 ohms. This will make the LED run at very roughly 1/3 of its normal brightness. Get a 100k trimpot (http://www.radioshack.com/product/i...ce=CAT&znt_medium=RSCOM&znt_content=CT2032230), and using the "wiper" and one end terminal, adjust it for maximum resistance, then connect it between base and emitter of the transistor. Power up the circuit. The collector voltage should still be low (< 500 mV) like it was before you made the changes. Turn the trimpot until the voltage starts to climb quickly. If possible get the voltage around 800 mV. Disconnect the trimpot and measure its resistance, buy the closest resistor you can find, and install it permanently. Change the LED resistor back to 220 ohms.
 
Top