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.

What values to use to get phototransistor to respond only to lazer

Status
Not open for further replies.

mik3ca

Member
circuit.png


I'm having trouble with this portion of my schematic. The microcontroller that I am using is actually an AT89S52 and everything is done on a PCB all assembled.

What I'm trying to do here is have the phototransistor respond only to red lazer beams (not normal light or infrared). I made two attempts with resistors:

I tried R1=68K, and R2=10K because 10K is a standard pull-up value and 68K because I didn't want detection too picky or too easy. If I made R1 smaller then I probably would detect nothing, but then again, maybe R1 is too small?

So then I tried the new settings of 4.7M for R1 and 240K for R2 so then I can make the ratio larger in hopes that it can detect any kind of light and still nothing is detected.

Now one thing I found out is when I turned my voltmeter on with the new resistor settings and I touched one lead to VCC and the other lead to NPN's collector, the detection takes place.

Before I assume the phototransistor is broken, are there better values for R1 and R2 I can use that would allow the microcontroller to detect when the light changes on the photodiode from super dark to super bright or vice-versa?
 
UPDATE:
I ran tests on the phototransistor in-circuit with the multimeter diode function, and it seems to respond to light. With correct polarity, the measurements that appeared on the meter were roughly 700 in darkness and 200 in bright white light. I'm not sure what the values refer to but at least I can conclude the phototransistor itself still works.
 
If you want the detector to respond only to the laser light, then you need a very narrow optical filter that lets through only the laser light wavelength.
Such a filter may not be cheap. :sorry:
 
Your entire premise is wrong, you can't electronically alter the response of the phototransistor, what EXACTLY! are you trying to do - it sounds like you're going about completely the wrong way.
 
You need an optical filter or a narrow bandwidth photodiode that inherently only responds to to laser light.

The only way to do it electronically is if the laser light is modulated. In which case you're not filtering out light that is non-laser. You're just filtering out any light that doesn't match the modulation, even if it is a laser.
 
I'm trying to detect changes in light. Ultimately I want to transmit data from one unit to this circuit via lazer beam. The data speed doesn't have to be high. 24 bits a second is ok. I just don't want the phototransistor to assume other light is the lazer beam. I don't mind modulating the data, but to start with, I want the microcontroller to be able to detect when light is sensed and when darkness is sensed. An equation will help me if I knew what it was.
 
I'm trying to detect changes in light. Ultimately I want to transmit data from one unit to this circuit via lazer beam. The data speed doesn't have to be high. 24 bits a second is ok. I just don't want the phototransistor to assume other light is the lazer beam. I don't mind modulating the data, but to start with, I want the microcontroller to be able to detect when light is sensed and when darkness is sensed. An equation will help me if I knew what it was.

You won't be able to get wavelength selecitivity without a change to your optical front end. You'll need to be satisfied that it just detects any light or no light of any wavelength and move on to data modulation in order to weed out ambient light.
 
Last edited:
Don't you have the datasheet for the laser so that you know its brightness?
Don't you have the datasheet for the phototransistor to see that with its specified light brightness it conducts typically 3.5mA so use Ohm's Law to calculate R1.

Your schematic does not show your VCC voltage. Why not, it is very important?
 
I agree with Colin... but if you want to roll your own (of sorts) with what components you have, then you will need to re-arrange your circuit a bit. The laser MUST be data modulated, but you should be able to get to at least 19.2k Baud with the change below. You won't be able to modulate the data with a carrier at 36-40kHz such as that used for IR with the components you have and without a filter unless you are able to do it in software. As far as not detecting IR and ambient light ... this circuit does pretty good for blocking ambient light, but any modulated IR will need an Optical filter. If you modulate your laser data with unique data packet BYTES (i.e. SYNC,DATA, DATA, CRC), then any IR interference should be ignored anyway without the need for an optical filter.


circuit.png
 
What distance do you want to send the data?
The lazer must be pointed exactly at the transistor.
 
I tried doing what you are trying and it failed. So I saved up my pocket money for 3 weeks and spent 18 cents on one of these:
images

I don't know what it is but is has a bump on one side
 
Right now, the distance can be as little as 10-15 cm. and VCC is 5V. Beau, I was kinda thinking that setup just before you answered, but I already made my PCB board, however, thanks to how a transistor is designed I could do a hack-job on the PCB itself and add spacers to the mounting areas so I don't crack the PCB when trying to screw the board into something.
 
I see my problem now that I look super close at my board. The collector and emitter pins are connected the wrong way around. I'm blaming Eagle.
 
OK, I tried Beau's idea and it didn't work. I then replaced 4.7M with 470K and that didn't work. I then made voltage measurements with the meter and when lights detected the output voltage going into the micro is 3.3V and when light is off then the voltage going in is about 4V. this right there is bad because the micro's logic high threshhold is 2.4V. I need to make it where one voltage is below 2.4V. Any other resistor ideas?
 
You don't need the transistor. The photo transistor already has too much gain, that's why I am reducing the gain. If it is a photo transistor the symbol is around the wrong way
 
The Photo transistor orientation in post #10 is correct, the Collector goes to ground and the Emitter goes to the Base of the NPN transistor (T1). The Photo transistor is reverse biased on purpose. Below are a couple of scope images from the circuit ... in one image, R2 = 100k in the other image R2 = 470k .... R1 remains the same at 4.7M. I used a TV remote at 4 feet away from the sensor. Using a laser shouldn't be an issue at all but it MUST be modulated (or pulsed) somehow. Just shining it at the sensor won't work in this circuit configuration. If it does, then you have the Photo transistor in the wrong direction. It might work close up, but you'll achieve much greater distance if the photo transistor is properly configured in the circuit.

100K.JPG
470K.JPG
 
Last edited:
If it is a photo transistor it must be connected as #1.
All transistors are photo transistors and a transistor will not work properly when connected up-side-down.
 
Colin,
I'm going to agree to disagree here and urge you to simply try it for yourself .... A Photo transistor in reverse bias mode acts like a capacitor where the amount of light falling on it will proportionately discharge that capacitor. Without going into too much detail, the transistor acts to self bias the output by quenching the positive supply keeping the transistor operating in it's most sensitive linear region, thus any slight change at the base will swing the output almost rail to rail as seen in the scope images.

Here is a similar effect using LED's as light sensors ....
https://www.sparkfun.com/news/2161
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top