IR Phototransistor pinout/hookup question

I'm trying to build an optical tachometer with a nano and IR components salvaged from an old ps2 ball mouse.

I have it set up and working on a breadboard, but I don't understand why the electrical connections on the IR phototransistor are working.

I had found several web pages that said you can hook up only the collector and emitter to generate a pulse when IR is detected, but couldn't get that to work. I came to the arrangement in the picture by accident.

I have the collector current limited with a 150 ohm resistor and tied to ground with another 150ohm resistor, and the signal pin pulled high* with a 47k to the nano (because that's what I had lying around).
I was using another LED on the ouput of the IR detector (no 47k) to try to figure out the proper pinout of the phototransistor and accidentally figured out that the LED flashed signifigantly brighter with gnd tied to vcc. Why?

Should I have things hooked up differently? I am using the code on this page to test the setup for now; KISS.

*I'm new to all this and think that is the proper term for what is going on

I have the collector current limited with a 150 ohm resistor and tied to ground with another 150ohm resistor

Do you? I don't see anything going to ground on the breadboard except the 47K resistor.

and the signal pin pulled high* with a 47k

Looks like it's pulled low to me.

I'm assuming that you're using the breadboard's red rail for +5V, and it's blue rail for 0V. Correct me if I'm wrong.
If I'm right, your description doesn't match the circuit on the breadboard.

If it's an IR photo-transistor, you connect the emitter to ground, connect the collector to the +5V rail through a pullup resistor, then take your output to the Arduino from the collector. It will go low when it receives IR input.

Hi,
Is there a part number on the IR transistor?

Tom... :slight_smile:

Tom, no, that would be way too easy! ;D

Oldsteve,
Now that I look at it again, the 47k resistor *is limiting the output of the phototransistor, so that would be a pull down, yes?
Yes, blue gnd and red 5v+.
How is the 150ohm resistor from vcc a pullup resistor and not just limiting current to the phototransistor? is it limiting current to the phototransistor?
The way it's hooked up now, it goes high when it receives ir input (i tried with the ir led I have and also the tv remote). Is it common for phototransistors to be normally open or normally closed?

interestingfellow:
How is the 150ohm resistor from vcc a pullup resistor and not just limiting current to the phototransistor?

Do you know anything at all about phototransistors?
For one thing, they don't have Vcc, GND and OUT pins as you've labelled them. Usually, they have two pins, emitter and collector. Sometimes, the base is also drawn out to a pin. You don't need to connect to that at all.
As I mentioned earlier, usually the collector connects to the +ve supply via a pullup resistor, and the output is also taken from the collector. The emitter connects directly to ground. This is a 'common-emitter' configuration, no different to a normal transistor circuit, except light operates it rather than current into the base.

They can also be connected in 'common-collector' configuration, with the collector connected directly to the +ve supply, a pulldown resistor from the emitter to ground, and the output taken from the emitter. This is what you have put together, but you have an additional 150 ohm resistor between collector and the +ve supply, reducing the transistor's gain. And another 150 ohm resistor that seems to do nothing?

is it limiting current to the phototransistor?
The way it's hooked up now, it goes high when it receives ir input (i tried with the ir led I have and also the tv remote). Is it common for phototransistors to be normally open or normally closed?

Rather than waste further time with explanations, I've drawn up a diagram. (A bit of reading would have explained all of this.)

The common-emitter circuit goes low in the presence of IR, the common-collector circuit goes high in the presence of IR.

All of this is based on the assumption that it's an NPN transistor. If it's PNP, the connections are reversed.
I also assume that it's a standard phototransistor as you claim, and doesn't have additional internal circuitry like an amplifier.

If a bit of reading were all it took for anyone to understand anything, then colleges, teachers, tutors, and forums would all be very unnecessary.

No, I know very little about electrical engineering when compared to most of the people on this forum.

But, I do very much appreciate you taking time to answer my questions, and helping me better understand what I was missing.

Really: thank you.

interestingfellow:
If a bit of reading were all it took for anyone to understand anything, then colleges, teachers, tutors, and forums would all be very unnecessary.

Often, that's true, but in this case all you had to do was google "phototransistor circuit" or similar. Still, not to worry, you know how they work now. (Didn't mean to sound rude, but my patience gets stretched a little sometimes. :slight_smile:

No, I know very little about electrical engineering when compared to most of the people on this forum.

You're one step further up the ladder now.

But, I do very much appreciate you taking time to answer my questions, and helping me better understand what I was missing.

Really: thank you.

No problem.

OldSteve....I'm sorry for being a noob and asking noob things, but I'm stuck.

After tinkering quite a bit with the salvaged components unsuccessfully, I decided to eliminate potential problems 1 at a time. I bit the bullet and bought an IR emitter/detector set from radiocrack and I still can't get this breadboard and sketch to work. I tried both common emitter and collector arrangements that you provided above, and am going insane trying to figure out why it won't work.
AND, I did read several sources on my own trying to figure it out, but I'm still missing something.

When I use the code below:

void setup() {
  pinMode(4,INPUT);
  Serial.begin(9600);
}
void loop() {
  Serial.println(digitalRead(4));
  delay(100);
}

In common collector configuration, I get only "1" (high) over the serial monitor unless I unplug the phototransistor, and then it changes to "0".

In common emitter configuration, I get only "0"(low) in the serial monitor. . The only way I can see a change in serial monitor is if I unplug the sense wire to pin 4 and short it to the vcc rail.

I have verified that the IR led is emitting using my phone camera.
I have verified polarity of the emitter and the detector.
I have tried only 1 150ohm resistor driving the emitter to make it brighter.
I have tried 47k, 1k, and 150ohm on the detector in both configurations.
And, of course, I have tried it with the lights in the room on and off.
I used a hotel keycard in the paper sleve to block the emitter.
I also tried removing the emitter completely.
And I still get the same results.

Wth am I doing wrong?

interestingfellow:
OldSteve....I'm sorry for being a noob and asking noob things, but I'm stuck.

After tinkering quite a bit with the salvaged components unsuccessfully, I decided to eliminate potential problems 1 at a time. I bit the bullet and bought an IR emitter/detector set from radiocrack and I still can't get this breadboard and sketch to work. I tried both common emitter and collector arrangements that you provided above, and am going insane trying to figure out why it won't work.
AND, I did read several sources on my own trying to figure it out, but I'm still missing something.

When I use the code below:

void setup() {

pinMode(4,INPUT);
 Serial.begin(9600);
}
void loop() {
 Serial.println(digitalRead(4));
 delay(100);
}




In common collector configuration, I get only "1" (high) over the serial monitor unless I unplug the phototransistor, and then it changes to "0".

In common emitter configuration, I get only "0"(low) in the serial monitor. . The only way I can see a change in serial monitor is if I unplug the sense wire to pin 4 and short it to the vcc rail.

I have verified that the IR led is emitting using my phone camera.
I have verified polarity of the emitter and the detector.
I have tried only 1 150ohm resistor driving the emitter to make it brighter.
I have tried 47k, 1k, and 150ohm on the detector in both configurations.
And, of course, I have tried it with the lights in the room on and off.
I used a hotel keycard in the paper sleve to block the emitter.
I also tried removing the emitter completely.
And I still get the same results.

Wth am I doing wrong?

For one thing, an IR LED has a Vf of about 1.2V to 1.5V. Allowing for 1.2V, that means there will be 3.8V across the resistance.
An IR LED should be driven with much more current than a standard LED. Most want about 100mA continuous.
3.8V/100mA=38 ohms. So for maximum brightness from a constantly on IR LED you could be using a 39 ohm resistor, instead of the pair of 150 ohm resistors. At the moment, you only have 11mA going through the LED.
(You should double-check the datasheet of the IR LED, for Vf and for continuous current rating, then select a resistor accordingly.)

I can't see your photo-transistor well, but you say "flat=cathode". A photo-transistor doesn't have a cathode, only a collector and an emitter, (if it's 2-pin). still, assuming you have the emitter to ground, with a resistor to +5V, and the output taken off the collector, it should go low when exposed to IR.

And although weak, I would have thought that since the IR LED and the IR photo-transistor are so close together, it would still work. Try a much smaller resistor on the IR LED, between 39 ohms and 100 ohms, (check the datasheet first for specs), and change the 47K resistor on the photo-transistor to 4K7, or even 2K2. 47K is a bit too high a value.

I don't know what else to suggest if that fails. This is so simple, that if connected properly nothing can really go wrong, unless the phototransistor has been shorted/overloaded and is dead. Did you buy several? If so, try another. If not, you should have. :slight_smile: Putting 150 ohms on the collector as a load resistor wasn't a good idea. That's 33mA, and they're not typically rated anywhere near that high. Good chance it is dead. Edit: Correction, it's probably not dead - since in CE configuration, it stays low, it's staying switched 'on'. A dead transistor usually goes open and would stay high with a pullup resistor.
Don't just try random values on things - everything must be calculated, according to the datasheets.

Of course, this setup, even when working, is no good for any practical purpose, since it's not immune to ambient light/remote controls/fluorescent lights.
Ideally, you would drive the IR LED with a 38kHz or 40kHz carrier, modulate that carrier with codes, then use an IR receiver to 'demodulate' the carrier leaving just the codes (inverted). That's how an IR remote control does it.

By coincidence, I'm working with an IR LED and a receiver myself today, making an IR homing beacon and receiver for my robot car. (Using a 38kHz carrier and demodulating receiver.)

I'm a little puzzled. I have some IR stuff. The emitter is not painted black and the phototransistor is usually painted black. An IR LED sees visible and UV as well as IR so if it's not painted black, it will respond to room light. With what you have, you seem to have swapped the IR LED and the phototransistor. You have with the black one two 150 ohm resistors meaning you treated it as an IR LED. I thought at was wrong.

liudr:
I'm a little puzzled. I have some IR stuff. The emitter is not painted black and the phototransistor is usually painted black. An IR LED sees visible and UV as well as IR so if it's not painted black, it will respond to room light. With what you have, you seem to have swapped the IR LED and the phototransistor. You have with the black one two 150 ohm resistors meaning you treated it as an IR LED. I thought at was wrong.

My IR LEDs are dark-coloured, but not completely black, (I'm using one here right now). I don't think his is 'black' either, I think it's just the light. Also, he did say "I have verified that the IR led is emitting using my phone camera."

the phototransistor is usually painted black

Usually, but not always. I have some IR photo-transistors here that are in a water-clear case.
See here:- Infrared Phototransistor
And I already said "since it's not immune to ambient light /remote controls/fluorescent lights."

Yes, there is still some IR in other sources of light.

OK I didn't catch the "checked with camera part". Then paint the water clear phototransistor black already! I would use a black wet-erase marker and go over it several times. Let it dry and do another coating :slight_smile: One of my POV displays was made using IR sensing. Now I remember the phototransistor was clear.

liudr:
OK I didn't catch the "checked with camera part". Then paint the water clear phototransistor black already! I would use a black wet-erase marker and go over it several times. Let it dry and do another coating :slight_smile: One of my POV displays was made using IR sensing. Now I remember the phototransistor was clear.

You're still right that this is puzzling. He did say that he's tried it with the lights off. And despite the fact that the IR LED series resistance is way too high at 300 ohms total, at that range it should still work.
I reckon the photo-transistor must be a dud, or possibly not really a photo-transistor. I got some water-clear IR LEDs from eBay last week, and when I tested them yesterday, they were normal red (visible) LEDs - refund pending. :smiley:

And just as a final bit of proof regarding the dark-coloured IR emitter LEDs, I've attached a pic of the one I'm currently using. In my pic, you can see that it's not completely black, but very dark.

IR LED.JPG

It makes no difference the color of the case of the LED - only the receiver. You want it to appear black, because that is an IR pass/visible block filter.

liudr, are wet erase black markers transparent to IR?

I would just buy an IR phototransistor. If it doesn't have a black casing, it isn't only IR.

polymorph:
It makes no difference the color of the case of the LED - only the receiver. You want it to appear black, because that is an IR pass/visible block filter.

liudr, are wet erase black markers transparent to IR?

I would just buy an IR phototransistor. If it doesn't have a black casing, it isn't only IR.

Many with clear cases are sold as IR photo-transistors, as in the link in post #10. Just not intended for use in the open.

And none of this explains why his circuit doesn't work in the dark.

OP: You said you "verified polarity of the emitter and the detector." How did you do that for the detector?

FWIW, this guy found that "The Radioshack IR pairs are somewhat confusing, in that the IR LED and the detector kind of have "backwards" pins. On the IR LED the long pin is the positive side, whereas on the detector the short pin is the positive side (it was labeled as the "collector" on the diagram on the back of the package I got.)"

Also, it might help if you post the emitter and detector specs that are on the Radio Shack package (or just post a pic of the package).

DaveEvans:
OP: You said you "verified polarity of the emitter and the detector." How did you do that for the detector?

FWIW, this guy found that "The Radioshack IR pairs are somewhat confusing, in that the IR LED and the detector kind of have "backwards" pins. On the IR LED the long pin is the positive side, whereas on the detector the short pin is the positive side (it was labeled as the "collector" on the diagram on the back of the package I got.)"

Also, it might help if you post the emitter and detector specs that are on the Radio Shack package (or just post a pic of the package).

Yep, on my similar IR photo-transistor the short leg is the collector, long leg is the emitter. (Opposite to an IR or normal LED, on which the long leg is always the anode and short leg the cathode.)

With mine, that was clearly shown on the specs, though. Those specs are shown under "Description" in this link:- IR Phototransistor

Radio Shack story: :slight_smile:

Three years ago or so I bought an IR emitter and detector, p/n 276-0142, from Radio Shack and the detector was a photo-transistor. Then a year later I bought another pair, with exactly the same part number, and the detector was a photo-diode (or so the package said - I haven't tested it or used it)!

These days, I stick to Vishay, Osram, etc.

DaveEvans:
These days, I stick to Vishay, Osram, etc.

That's probably the best plan. The 38kHz demodulating receivers that I'm using are Vishay. (TSOP4838)