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.

The load and ideal base resistor

Status
Not open for further replies.

mik3ca

Member
My objective here is to detect when light falls on any one photo sensor. Based on datasheets, the sensor uses 15uS rise if Rl (load?) is 1K and fall times for the lights themselves and the logic gate uses roughly 400nS for rise and fall time. The power supply is 4-5VDC fed through a regulator all powered by batteries.

This is my circuit
circuit.png

R4 is 10K. In my actual circuit I applied 10K as a SIP resistor unit across all P0 pins so each pin is pulled up by a 10K.

R1 is also 10K.

I chose R2 to be 1M because I want lots of sensitivity so that even room light can make the microcontroller detect it but that isn't working, I mean the hfe of this transistor is > 100 so 10K * 100=1000K=1M right or is my calculation bad?

I chose 2.2K for R3 but I might consider lowering that somewhat but not too much because I don't want to create a short-circuit with the microcontroller (which can happen if gate output is high and micro sets the pin low).

I also think that the number of phototransistors might affect the resistance required as well.

Anyone got a good equation I can use?

Also, for the purposes of calculating phototransistor response time, is the actual response time in this case 150uS instead of 15uS because R1 is 10K instead of 1K?
 
I can't see the point of R4. The 74HC00 output will always be high or low voltage, never high impedance. R3 will protect from overloading if the microcontroller pin becomes an output.

I wouldn't connect R2 where you have it. I would put it between Vcc and the transistor base. Where you have it, it is giving negative feedback and reducing the gain of the transistor stage, so you need a larger change in light to get a complete switch.

I don't know how much the load resistance on the phototransistors makes to the response time. I would guess that very bright lights would generate lots of spare electrons or holes in the semiconductor, so a low current would increase the response time while those leak away.
 
I think you have it utterly confused. The load for the phototransistors is R2+ R1, which will lead to very slow response.
R3 and R4 make no sense. Ok, maybe R3 does if you aren´t for some really weird reason able to make sure your code doesn´t set that pin as output...

For fast response and high sensitivity you would have to use a photodiode and a fast, low input current opamp.
 
I think you have it utterly confused. The load for the phototransistors is R2+ R1, which will lead to very slow response.
R3 and R4 make no sense. Ok, maybe R3 does if you aren´t for some really weird reason able to make sure your code doesn´t set that pin as output...

For fast response and high sensitivity you would have to use a photodiode and a fast, low input current opamp.

I choose phototransistor for better sensitivity which is a photodiode already amplified.

Ok so I should lower R2 and possibly R1 and I say possibly because I don't want this section of the circuit to use too much current. I can consider lowering R3 down to maybe 100 ohms and I can see that R4 can be omitted but I didn't want to leave the other port 0 lines floating so I used a SIP resistor bus.

I'm gonna see what LTspice can do for me on this
 
In addition to what others have said, it may be useful to make the logic gate buffer a schmit trigger type such as a 74xx14.
Otherwise you may get some strange effects due to noise when the light level is around the threshold of high/low.

JimB
 
I would make R3 less than 1/10th of R4. I can see that if R4 is one of an array, it would be more difficult to leave out than to keep in. R3 at 1 kΩ will keep the current at < 5 mA if you do make the microcontroller pin an output.

Altering the values will not get over the problem of having R2 where it is. With the layout shown, you will get a big linear region where the transistor is neither on nor off, which you don't want. The whole idea of a transistor is to increase the gain so that the input of the 74HC00 is always high or low, and never in the middle.

Using a Schmitt trigger is a good idea. If you have a 74HC14 then you could get rid of the transistor completely.
 
I think the key issue here is that you can have fast or sensitive with a phototransistor, but not both at the same time. To get that 15us, R2 (if connected to Vcc) or R2+R1 in the the original schematic have to be 1k. If the sensitivity with Rl=1k is not good enough then you can use higher Rl but you trade off speed.
 
I think the key issue here is that you can have fast or sensitive

That I agree with. Since I already made this on a PCB, a schmitt trigger is not an option.

However, the fortunate thing is because I'm only driving the micro with a 22.1184Mhz crystal, the fastest each instruction executes is around 540nS but to scan the sensors and process them in software takes way more than that. Probably at least 10 or 15uS but I can make the scanning much lower.

Ideally, I want to be able to scan the photodiode status 16 times in a 250ms period (64x a second).

So what everyone and everything is telling me which I will do is lower the base resistor. I should lower the collector resistor too. Yes I can see more current being used but higher speed means more current anyway.

I think 2N3904 is an acceptable transistor for my purpose unless a different one can give better results with the same pinout.
 
Ideally, I want to be able to scan the photodiode status 16 times in a 250ms period (64x a second).
Does not compute. You can scan the status as often as you please, but what is the signal that the phototransistor is receiving? And why do you care if the circuit reacts within 15us or 150us of a change, when you need the signal to be high for at least 15625us for your micro to notice it reliably?
 
That means I should change my 1M resistor to 470K. The signal I'm generating through the phototransistor is also something I control 99.9% of the time and I say that because someone might at one point walk in with a camera and take a picture with the flash on.

The signal itself comes from an IR emitter and can also come from a lazer beam.
 
and the reason I care is because sometimes I may want to scan at a faster rate to determine the validity of the signal. Its like how serial port data is scanned for data. Sample 4x and the majority bit wins. It's not just a light detector only, data will also be transmitted this way as well. thats why I said a rate of 64x/second as in 64 bits a second.
 
ok i replaced the 1M to 470K resistors and did some tests. yes I have a 2.2K in series with the phototransistor. With light voltmeter reads 0.2V and dim light it reads 4.9V. I also replaced "nand" with "and" gate because ordering "and" is cheaper and application wise i found more benefits with "and" gate.

Now I gotta figure out in software how to read the values unless that 10k pullup is making the readings bad
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top