Author Topic: Phototransistor reflector  (Read 12078 times)

0 Members and 1 Guest are viewing this topic.

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Phototransistor reflector
« on: July 06, 2008, 09:43:56 AM »
Hi,

The QRD1113/14 reflective sensor consists of an infrared emitting diode and an NPN silicon phototransistor mounted side by side in a black plastic housing.

Here is the schematics from the datasheet.

And some images I cut and paste from the datasheet below:





It is obvious from the schematic that pin 3 is VCC and pin 4 is ground. Pin 1 is the collector which gets connected to VCC?

And pin 2 the emitter gets connected to my analog input. Is this correct?

Sorry for the dumb questions but I got to make sure this is right.

Do I need a resistor on any of these pins? If so what are they used for exactly?

The normalized current vs. distance curve is also below.



Thank in advance,
« Last Edit: July 06, 2008, 10:07:09 AM by vidam »

paulstreats

  • Guest
Re: Phototransistor reflector
« Reply #1 on: July 06, 2008, 10:53:57 AM »
I use these sensors quite a lot myself.

You have the pin labels correct.
You only need resistors to limit the current to the led's, i use pots instead to adjust them.
The phototransistor produce a changeing current but your adc port needs a changing voltage. To get the voltage change to represent the current change, you will have to use to resistors to produce a voltage dividing circuit for each one (see the photoresistors in the $50 robot tutorial and how the outputs go from there it is the same principle).

I have also taken to adding a capacitor to the inputs of the phototransistors when i use multiple of them (sometimes the changeing value of 1 can alter the values of the others otherwise). And also I found that a small signal diode straight after the phototransistor output (before the voltage divider) helps to keep a nice smooth signal ...

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Re: Phototransistor reflector
« Reply #2 on: July 06, 2008, 12:41:17 PM »
I use these sensors quite a lot myself.

You have the pin labels correct.
You only need resistors to limit the current to the led's, i use pots instead to adjust them.
The phototransistor produce a changeing current but your adc port needs a changing voltage. To get the voltage change to represent the current change, you will have to use to resistors to produce a voltage dividing circuit for each one (see the photoresistors in the $50 robot tutorial and how the outputs go from there it is the same principle).

I have also taken to adding a capacitor to the inputs of the phototransistors when i use multiple of them (sometimes the changeing value of 1 can alter the values of the others otherwise). And also I found that a small signal diode straight after the phototransistor output (before the voltage divider) helps to keep a nice smooth signal ...

Thanks paulstreets. It looks like I have my work cut out for me... run to radio shack to buy pots, testing etc. And do the math for the voltage divider circuit --> http://www.societyofrobots.com/schematics_photoresistor.shtml

paulstreats

  • Guest
Re: Phototransistor reflector
« Reply #3 on: July 06, 2008, 02:29:06 PM »
I chose the values for my voltage dividers by using pots as the dividing resistors and using a multimeter to assess the output. (why do all of the maths if you can do it visually).

Something else that you should think about is connecting the LED's to digital output ports through a mosfet. This way you can turn them on and off using the microcontrollers output which will allow you to cancel the background light, do modulation etc... (I make all of the LED's common to 1 mosfet and give them all common cathodes/annodes so they all switch on/off at the same time using only 1 i/o pin) Your robot can also switch them off when they arent needed and save power this way too.

Also their effective range is only supposed to be around 1 - 3 cm but ive managed to get them detecting things at 30cm (I think they can be pushed further than that too. especially if you just pulse the led's it will stop them from burning out so easily)
« Last Edit: July 06, 2008, 02:40:40 PM by paulstreats »

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Re: Phototransistor reflector
« Reply #4 on: July 06, 2008, 04:33:28 PM »
that is a great idea. what model number for the mosfet? Will this MOSFET from Radio shack work?
« Last Edit: July 06, 2008, 04:36:07 PM by vidam »

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Re: Phototransistor reflector
« Reply #5 on: July 06, 2008, 04:40:12 PM »
can I use the same mosfet for the phototransistor as well?

paulstreats

  • Guest
Re: Phototransistor reflector
« Reply #6 on: July 06, 2008, 05:33:31 PM »
The last time I used these I used the BC547B npn mosfet
farnell: http://uk.farnell.com/jsp/search/browse.jsp;jsessionid=LV45HKVUN3R4MCQLCISJKBQ?N=0&Ntk=gensearch_001&Ntt=bc547b&Ntx=&_requestid=323608

Because the LED's dont use much current, its not important to drive the gate above the input voltage (if you use mosfets for anything that requires a lot of power make sure to drive the gate voltage higher than the switch through). So because the led's are low powered we can connect the mosfet straight to an output pin. Yes you can also use this type of system to drive the phototransistors. If you have enough pins, there is no reason why you cant control power to all peripherals and sensors like this. As i mentioned in the brackets, something likely to draw a lot of current will need some kind of voltage booster between the mcu pin and the gate of the mosfet. Anthing likely to draw an above normal amount will require a power transistor with a heat sink.

The mosfet that you looked at will work but its very much an overkill for powering the ir LED's. You can tell by looking at the prices. The ones I used were like £0.14 / $0.07 and the ones you chose were like $1.50. Also there is a big difference in their sizes and their pcb footprints. (Also because your mosfets is meant for higher current applications it will also consume more power itself to operate).

my advice is to order a bunch of mosfets (general purpose types) so you have many going spare. They come in useful for loads of things, Just building them into your circuits can allow power control to nearly every application through the microcontroller. Im sure you can understand the power saving advantages offered. (I try to bulk purchase a lot of components so that i dont end up having to wait or even compromise on a design - bulk purchasing the mosfets that I used as a quantity of 50 mosfets only cost me $3.50 equivalent for the lot)

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Re: Phototransistor reflector
« Reply #7 on: July 06, 2008, 05:43:35 PM »
The last time I used these I used the BC547B npn mosfet
farnell: http://uk.farnell.com/jsp/search/browse.jsp;jsessionid=LV45HKVUN3R4MCQLCISJKBQ?N=0&Ntk=gensearch_001&Ntt=bc547b&Ntx=&_requestid=323608

Because the LED's dont use much current, its not important to drive the gate above the input voltage (if you use mosfets for anything that requires a lot of power make sure to drive the gate voltage higher than the switch through). So because the led's are low powered we can connect the mosfet straight to an output pin. Yes you can also use this type of system to drive the phototransistors. If you have enough pins, there is no reason why you cant control power to all peripherals and sensors like this. As i mentioned in the brackets, something likely to draw a lot of current will need some kind of voltage booster between the mcu pin and the gate of the mosfet. Anthing likely to draw an above normal amount will require a power transistor with a heat sink.

The mosfet that you looked at will work but its very much an overkill for powering the ir LED's. You can tell by looking at the prices. The ones I used were like £0.14 / $0.07 and the ones you chose were like $1.50. Also there is a big difference in their sizes and their pcb footprints. (Also because your mosfets is meant for higher current applications it will also consume more power itself to operate).

my advice is to order a bunch of mosfets (general purpose types) so you have many going spare. They come in useful for loads of things, Just building them into your circuits can allow power control to nearly every application through the microcontroller. Im sure you can understand the power saving advantages offered. (I try to bulk purchase a lot of components so that i dont end up having to wait or even compromise on a design - bulk purchasing the mosfets that I used as a quantity of 50 mosfets only cost me $3.50 equivalent for the lot)

I used to have a ton of these low-power transistors in undergraduate school as an EE major. There all missing now. The NPN transistor emitter is connected to the led or phototransistor, the collector is connected to Vcc (5v) and the base is connected to a digital output which controls the toggle of the power essentially?

Is mosfet another word for NPN transistor? I forget much from undergrad school. sorry!


paulstreats

  • Guest
Re: Phototransistor reflector
« Reply #8 on: July 06, 2008, 05:54:13 PM »
My apology,

Sorry they are transistors, I was just using them as a mosfet (They are basically similar in principle except that a mosfet is used for switching straight on/off and a transistor is regarded as always on (meaning that its output varies with its input)).

For this application the transistor can easily be used since all it needs is a voltage from the mcu to allow the current to flow from the power to the led's

Quote
The NPN transistor emitter is connected to the led or phototransistor, the collector is connected to Vcc (5v) and the base is connected to a digital output which controls the toggle of the power essentially?


Exactly, Its a way of letting your mcu control power without having to source/sink it. The power comes straight from the 5v bus, its the signal from the mcu that lets it flow. Doing things like this can also let you build your circuits as smaller component circuits making them easier to understand and debug.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: Phototransistor reflector
« Reply #9 on: July 20, 2008, 05:45:20 PM »
Quote
I chose the values for my voltage dividers by using pots as the dividing resistors and using a multimeter to assess the output. (why do all of the maths if you can do it visually).
One way is called guessing, and the other way is called engineering ;)

Quote
Is mosfet another word for NPN transistor?
Google around for info on PNP and NPN - these are different types of transistors and should be used in different ways.

Offline vidamTopic starter

  • Supreme Robot
  • *****
  • Posts: 423
  • Helpful? 1
  • Robotronics.org
    • DC/MD/VA Robotics and Automation Team
Re: Phototransistor reflector
« Reply #10 on: July 20, 2008, 06:00:46 PM »
Quote
I chose the values for my voltage dividers by using pots as the dividing resistors and using a multimeter to assess the output. (why do all of the maths if you can do it visually).
One way is called guessing, and the other way is called engineering ;)

Quote
Is mosfet another word for NPN transistor?
Google around for info on PNP and NPN - these are different types of transistors and should be used in different ways.

Trust me, as an Electrical and Computer Engineer, I already know the difference between PNP and NPN transistors.