Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: joe61 on October 01, 2011, 02:43:02 PM

Title: Calculating resistor for transistor
Post by: joe61 on October 01, 2011, 02:43:02 PM
I suck at this, I admit. I'm trying to work out the attached circuit which is indented to light up an LED in proportion to the current coming off a phototransistor.

I can make it work the way I want, but I'd like to understand what I'm doing. I think the real difficulty is that I'm not understanding the data sheet (http://www.vishay.com/docs/81321/tept5700.pdf) for the phototransistor.

I don't understand what it's telling me about how much current / voltage I should normally expect from the emitter. I've done some measurements on a breadboard with 5V on the positive rail. I get 4.7V coming off the emitter, and when my desk lamp is right on top of the phototransistor it reads about 50mA. I can't match that up with what I'm seeing in the datasheet.

I guess I'm asking how to read this thing. Maybe too big a question, but it doesn't hurt to ask.

Thanks

Joe
Title: Re: Calculating resistor for transistor
Post by: waltr on October 01, 2011, 06:58:35 PM
First, be careful with your units:
Quote
I get 4.7V coming off the emitter, and when my desk lamp is right on top of the phototransistor it reads about 50mA.
Are you sure you measured 50mA or did you mean 50mV??

Figure 4 of the photo-transistor data sheet relate the illuminance to the current through the photo-transistor collector to emitter( Ipce). Now apply Ohm's Law to the resistor between the emitter of the photo-transistor the the base of the LED drive transistor.
If the voltage at emitter of the photo-transistor relative to the common (also called ground) is 4.7V then the drop across the resistor is 4.7-0.6 = 4.1V and the current is 4.1V/R1 = Amps. Since you didn't give the value of R1 I can't calc the current so I'll make some assumptions.

Look at Fig4, say the illuminance is 200 lx. Then the photo-transistor current is about 150uA. Use this current and the voltage drop across R1, 4.1/0.00015 = 27k Ohm resistor. Am I close to the resistor value you used?

Now the next part is the driving the LED. Do remember that BJT's are current driven devices (the current through the Base multiplied by the DC gain equals the current flowing from collector to emitter). This means that the photo-transistor's current flows into the Base the the LED drive transistor and the photo-transistor's current can be derived from Fig4 or calculated from the measured voltage drop across R1.

Any help?

Title: Re: Calculating resistor for transistor
Post by: Soeren on October 01, 2011, 07:17:37 PM
Hi,

I can make it work the way I want, but I'd like to understand what I'm doing. I think the real difficulty is that I'm not understanding the data sheet (http://www.vishay.com/docs/81321/tept5700.pdf) for the phototransistor.
To be honest, I think it's more that you don't understand the circuit as a whole (and while you probably read this as offensive, judging from previous discussions, it's not meant to be).


I don't understand what it's telling me about how much current / voltage I should normally expect from the emitter.
There's a graph at page 3 upper right (Fig. 4 - Photo Current vs. Illuminance), showing this relationship.
Rougly speaking, you get ~75nA each lx, or in other words, I = lx * 75 * 10^-9
If you don't have a light meter, you can find tables with approximate values of average light in different settings (like living room, hall, workplace etc.) on the web, but they are only indicators, as my measurements have shown and will depend a lot of the sight of whoever put up the light.


I've done some measurements on a breadboard with 5V on the positive rail. I get 4.7V coming off the emitter, and when my desk lamp is right on top of the phototransistor it reads about 50mA. I can't match that up with what I'm seeing in the datasheet.
That must be the emitter of the 2N2222(?), as the phototransistor should give only around 750µA at 1000 lx and that sound like a reasonable value for a desklamp up close (depending on the wattage of course).
An energy saving bulb is not as good as a regular "bulb" for this.


I guess I'm asking how to read this thing. Maybe too big a question, but it doesn't hurt to ask.
Just look at fig. 4.
However, the circuit as a whole is a bad way of regulating the light. If you use a white LED, the color will shift over the range, but more important, it will depend a lot on the specific transistor used - not the type number, but the exact specimen you've got. This is because you operate the transistor in its linear region without any biasing or gain tailoring, so everything depends on the untamed parameters of the transistor.

It's a cheap and simple circuit, but if you want to make it top notch for a white LED, use the phototransistor to control a PWM circuit. like a 555 where you modulate the control voltage, or an op-amp based PWM circuit with the photo current injected in the feedback.
Title: Re: Calculating resistor for transistor
Post by: joe61 on October 01, 2011, 08:35:19 PM
First, be careful with your units:
Quote
I get 4.7V coming off the emitter, and when my desk lamp is right on top of the phototransistor it reads about 50mA.
Are you sure you measured 50mA or did you mean 50mV??
The scale on my multimeter was set to milliamps, so yes, that's what it was. I just double checked and got the same results.

Quote
Figure 4 of the photo-transistor data sheet relate the illuminance to the current through the photo-transistor collector to emitter( Ipce).
So that's what that means. I need to see if DigiKey has a secret decoder ring for next time. I wonder if there's some kind of abeviation glossary online that gives the meanings for acronyms like this? (Yes, I will ask google).

Quote
Now apply Ohm's Law to the resistor between the emitter of the photo-transistor the the base of the LED drive transistor.
Ok, so you have to know the illuminance in order to know the emitter current. I see that makes sense now that it's been pointed out. I don't have a way to come up with luminance though (I'm not sure what it is even other than "how bright it is").

Quote
If the voltage at emitter of the photo-transistor relative to the common (also called ground) is 4.7V then the drop across the resistor is 4.7-0.6 = 4.1V and the current is 4.1V/R1 = Amps. Since you didn't give the value of R1 I can't calc the current so I'll make some assumptions.
Actually, calculating the value of R1 is what I'm trying to do.

Quote
Look at Fig4, say the illuminance is 200 lx. Then the photo-transistor current is about 150uA. Use this current and the voltage drop across R1, 4.1/0.00015 = 27k Ohm resistor. Am I close to the resistor value you used?
I've actually been using a 100K resistor. I thought that was a bit much.

Quote
Now the next part is the driving the LED. Do remember that BJT's are current driven devices (the current through the Base multiplied by the DC gain equals the current flowing from collector to emitter). This means that the photo-transistor's current flows into the Base the the LED drive transistor and the photo-transistor's current can be derived from Fig4 or calculated from the measured voltage drop across R1.

Any help?

Yes, thanks. I'll have to come up with some way to estimate luminance on my desk. Probably I can reverse engineer it by starting from resistor values that work.

Thanks very much. Sorry if I garbled part of this, I'm pretty tired. I'm going to go to bed and try again tomorrow.

Joe
Title: Re: Calculating resistor for transistor
Post by: joe61 on October 01, 2011, 08:43:33 PM
To be honest, I think it's more that you don't understand the circuit as a whole (and while you probably read this as offensive, judging from previous discussions, it's not meant to be).
No, I tried to be clear that I don't understand it. You should know by now I don't know what I'm doing anyway :-)

I've done some measurements on a breadboard with 5V on the positive rail. I get 4.7V coming off the emitter, and when my desk lamp is right on top of the phototransistor it reads about 50mA. I can't match that up with what I'm seeing in the datasheet.
Quote
That must be the emitter of the 2N2222(?), as the phototransistor should give only around 750µA at 1000 lx and that sound like a reasonable value for a desklamp up close (depending on the wattage of course).

No, it was the emitter of the phototransistor. Waltr make a similar comment, so I'm not sure what's happening.

Quote
Just look at fig. 4.
However, the circuit as a whole is a bad way of regulating the light. If you use a white LED, the color will shift over the range, but more important, it will depend a lot on the specific transistor used - not the type number, but the exact specimen you've got. This is because you operate the transistor in its linear region without any biasing or gain tailoring, so everything depends on the untamed parameters of the transistor.
I"m sure you're right, however I'm not really concerned with controlling the LED, I'm just trying to learn.

Thanks

Joe
Title: Re: Calculating resistor for transistor
Post by: joe61 on October 02, 2011, 07:41:04 AM
Now that I've slept I looked at the measurement of the current from the phototransistor's emitter again. I missed the decimal point last night, the reading is actually 0.5mA

Sorry, this is making more sense to me now though, thanks again.

Joe
Title: Re: Calculating resistor for transistor
Post by: waltr on October 02, 2011, 09:31:23 AM
Keep trying and these things will become clearer. Same with reading data sheets and do use google and Wiki to look up units or other terms you don't know.