Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: MadMax on November 20, 2008, 10:05:25 AM
-
To begin: Yes, I've read the photoresistor tutorial, this is a bit more complicated.
I have a tube, a IR LED on one end, a phototransistor one the other end (sensitive to the IR wavelength, offcourse).
When the signal arrives at my PIC chip, it reads the voltage before the 10k resistor, I do not know how high the resistor marked with the '?' should be, and can't figure it out. Is somebody able to help me?
(http://home.hetnet.nl/~maxhenger/value.jpg)
-
Read this http://www.societyofrobots.com/electronics_led_tutorial.shtml
-
No, the problem I have is that I need a value between (optimal) 0-255 when a voltage reaches my A/D converter in my microchip. So I need a voltage between (optimal) 0V - 5V. I'm not talking about the LED, it is getting 0.02A at the correct voltage, I'm talking about the voltage divider.
-
I'll take a stab.
If the unknown and the 10kohm resistor are truly both connected to the same ground, then the voltage is the same through them and they're in parallel.
I'll call the unknown A, the 10k B, and the phototran (looks more like a photodiode or high resistance photoresistor) P
Thus the voltage out (i.e. what's measured across either resistor) is
Vin * (A||B)/(A||B+P)
It depends largely on what your input voltage Vin is. It's probably 5V.
Playing a bit with numbers on paper, A||B = 300kOhm seems a nice number. That gives you 3/4 Vin in dark, and 1/6 Vin in light.
At the same time, theoretically you don't need that 10kOhm resistor, but I don't know what constraints there may be on the actual physical circuit.
-
@Gertlex, you just beat me to it. I came to the same conclusion. 300K maximizes your spread between high and low readings.
-
Actually, I think you have a problem there. The impedance you're showing for your phototransistor is way too high when it's on. It should be much lower. The impedance of your analog input should not exceed about 10 Kohm, or the analog reading will be wonky. Normally you would put your NPN phototransistor between gnd and analog in. Then a resistor (try something like 4.7 Kohm) between analog in and Vcc. That should give you a nice sweep between gnd and Vcc.
-
hmm, yes, I've done some calculations in the meantime... And (Vcc * 1 * 10 ^ 3) / (1 * 10 ^ 6 + 1 * 10 ^ 3) = (Vcc * 1000) / (1.001 * 10 ^ 6)... That is a pretty useless voltage devider ::)... gotta do new calculations, thank you Arcman